diff --git a/consensus/src/context/task.rs b/consensus/src/context/task.rs index 74142c5..f65fdcb 100644 --- a/consensus/src/context/task.rs +++ b/consensus/src/context/task.rs @@ -327,7 +327,7 @@ impl ContextTask { } BlockChainContextRequest::HardForkInfo(_) | BlockChainContextRequest::FeeEstimate { .. } => { - todo!() + todo!("finish https://github.com/Cuprate/cuprate/pull/297") } }) } diff --git a/p2p/address-book/src/book.rs b/p2p/address-book/src/book.rs index b21b45e..6117b6e 100644 --- a/p2p/address-book/src/book.rs +++ b/p2p/address-book/src/book.rs @@ -415,7 +415,7 @@ impl Service> for AddressBook { | AddressBookRequest::ConnectionCount | AddressBookRequest::SetBan(_) | AddressBookRequest::GetBan(_) - | AddressBookRequest::GetBans => todo!(), + | AddressBookRequest::GetBans => todo!("finish https://github.com/Cuprate/cuprate/pull/297"), }; ready(response) diff --git a/p2p/p2p-core/src/client/handshaker/builder/dummy.rs b/p2p/p2p-core/src/client/handshaker/builder/dummy.rs index 51f8af3..c754465 100644 --- a/p2p/p2p-core/src/client/handshaker/builder/dummy.rs +++ b/p2p/p2p-core/src/client/handshaker/builder/dummy.rs @@ -132,7 +132,7 @@ impl Service> for DummyAddressBook { | AddressBookRequest::ConnectionCount | AddressBookRequest::SetBan(_) | AddressBookRequest::GetBan(_) - | AddressBookRequest::GetBans => todo!(), + | AddressBookRequest::GetBans => todo!("finish https://github.com/Cuprate/cuprate/pull/297"), })) } } diff --git a/storage/blockchain/src/service/read.rs b/storage/blockchain/src/service/read.rs index 1dd02d1..bed2cf2 100644 --- a/storage/blockchain/src/service/read.rs +++ b/storage/blockchain/src/service/read.rs @@ -1,5 +1,12 @@ //! Database reader thread-pool definitions and logic. +#![expect( + unreachable_code, + unused_variables, + clippy::unnecessary_wraps, + reason = "TODO: finish implementing the signatures from " +)] + //---------------------------------------------------------------------------------------------------- Import use std::{ collections::{HashMap, HashSet}, @@ -107,12 +114,14 @@ fn map_request( R::CompactChainHistory => compact_chain_history(env), R::FindFirstUnknown(block_ids) => find_first_unknown(env, &block_ids), R::AltBlocksInChain(chain_id) => alt_blocks_in_chain(env, chain_id), - R::TotalTxCount - | R::DatabaseSize - | R::Difficulty(_) - | R::OutputHistogram - | R::CoinbaseTxSum - | R::MinerData => todo!(), + R::Block(height) => block(env, height), + R::BlockByHash(hash) => block_by_hash(env, hash), + R::TotalTxCount => total_tx_count(env), + R::DatabaseSize => database_size(env), + R::Difficulty(height) => difficulty(env, height), + R::OutputHistogram => output_histogram(env), + R::CoinbaseTxSum => coinbase_tx_sum(env), + R::MinerData => miner_data(env), } /* SOMEDAY: post-request handling, run some code for each request? */ @@ -607,3 +616,46 @@ fn alt_blocks_in_chain(env: &ConcreteEnv, chain_id: ChainId) -> ResponseResult { Ok(BlockchainResponse::AltBlocksInChain(blocks)) } + +/// [`BlockchainReadRequest::Block`] +fn block(env: &ConcreteEnv, block_height: BlockHeight) -> ResponseResult { + Ok(BlockchainResponse::Block(todo!())) +} + +/// [`BlockchainReadRequest::BlockByHash`] +fn block_by_hash(env: &ConcreteEnv, block_hash: BlockHash) -> ResponseResult { + Ok(BlockchainResponse::Block(todo!())) +} + +/// [`BlockchainReadRequest::TotalTxCount`] +fn total_tx_count(env: &ConcreteEnv) -> ResponseResult { + Ok(BlockchainResponse::TotalTxCount(todo!())) +} + +/// [`BlockchainReadRequest::DatabaseSize`] +fn database_size(env: &ConcreteEnv) -> ResponseResult { + Ok(BlockchainResponse::DatabaseSize { + database_size: todo!(), + free_space: todo!(), + }) +} + +/// [`BlockchainReadRequest::Difficulty()`] +fn difficulty(env: &ConcreteEnv, block_height: BlockHeight) -> ResponseResult { + Ok(BlockchainResponse::Difficulty(todo!())) +} + +/// [`BlockchainReadRequest::OutputHistogram`] +fn output_histogram(env: &ConcreteEnv) -> ResponseResult { + Ok(BlockchainResponse::OutputHistogram(todo!())) +} + +/// [`BlockchainReadRequest::CoinbaseTxSum`] +fn coinbase_tx_sum(env: &ConcreteEnv) -> ResponseResult { + Ok(BlockchainResponse::CoinbaseTxSum(todo!())) +} + +/// [`BlockchainReadRequest::MinerData`] +fn miner_data(env: &ConcreteEnv) -> ResponseResult { + Ok(BlockchainResponse::MinerData(todo!())) +} diff --git a/storage/txpool/src/service/read.rs b/storage/txpool/src/service/read.rs index 5e75529..3135322 100644 --- a/storage/txpool/src/service/read.rs +++ b/storage/txpool/src/service/read.rs @@ -1,3 +1,10 @@ +#![expect( + unreachable_code, + unused_variables, + clippy::unnecessary_wraps, + reason = "TODO: finish implementing the signatures from " +)] + use std::sync::Arc; use rayon::ThreadPool; @@ -58,7 +65,8 @@ fn map_request( match request { TxpoolReadRequest::TxBlob(tx_hash) => tx_blob(env, &tx_hash), TxpoolReadRequest::TxVerificationData(tx_hash) => tx_verification_data(env, &tx_hash), - TxpoolReadRequest::Backlog | TxpoolReadRequest::Size => todo!(), + TxpoolReadRequest::Backlog => backlog(env), + TxpoolReadRequest::Size => size(env), } } @@ -102,3 +110,15 @@ fn tx_verification_data(env: &ConcreteEnv, tx_hash: &TransactionHash) -> ReadRes get_transaction_verification_data(tx_hash, &tables).map(TxpoolReadResponse::TxVerificationData) } + +/// [`TxpoolReadRequest::Backlog`]. +#[inline] +fn backlog(env: &ConcreteEnv) -> ReadResponseResult { + Ok(TxpoolReadResponse::Backlog(todo!())) +} + +/// [`TxpoolReadRequest::Size`]. +#[inline] +fn size(env: &ConcreteEnv) -> ReadResponseResult { + Ok(TxpoolReadResponse::Size(todo!())) +} diff --git a/types/src/blockchain.rs b/types/src/blockchain.rs index 3d87d88..7126c21 100644 --- a/types/src/blockchain.rs +++ b/types/src/blockchain.rs @@ -8,6 +8,8 @@ use std::{ ops::Range, }; +use monero_serai::block::Block; + use crate::{ types::{Chain, ExtendedBlockHeader, OutputOnChain, VerifiedBlockInformation}, AltBlockInformation, ChainId, @@ -104,6 +106,12 @@ pub enum BlockchainReadRequest { /// A request for all alt blocks in the chain with the given [`ChainId`]. AltBlocksInChain(ChainId), + /// TODO + Block(usize), + + /// TODO + BlockByHash([u8; 32]), + /// TODO TotalTxCount, @@ -165,6 +173,7 @@ pub enum BlockchainWriteRequest { /// This pairs with [`BlockchainReadRequest`] and [`BlockchainWriteRequest`], /// see those two for more info. #[derive(Debug, Clone, PartialEq, Eq)] +#[expect(clippy::large_enum_variant)] pub enum BlockchainResponse { //------------------------------------------------------ Reads /// Response to [`BlockchainReadRequest::BlockExtendedHeader`]. @@ -245,6 +254,13 @@ pub enum BlockchainResponse { /// Contains all the alt blocks in the alt-chain in chronological order. AltBlocksInChain(Vec), + /// The response for: + /// - [`BlockchainReadRequest::Block`]. + /// - [`BlockchainReadRequest::BlockByHash`]. + /// + /// TODO + Block(Block), + /// The response for [`BlockchainReadRequest::TotalTxCount`]. /// /// TODO