Open hinto-janai opened 1 week ago
Request | |
---|---|
PopBlocks(u64) | This will be a request for the blockchain manager. |
Prune | This should be left as a TODO |
Pruned | The could just return false for now until we decide on how pruning will be done. |
TopBlock | The could be a request to the context cache to get the blockchain context and then a request to the DB with the top block height |
TopBlockExtendedHeader | Same as above |
TopBlockHash | The blockchain context cache can already give this information. |
BlockWeightLimit | The blockchain context cache can already give this information. |
BlockWeightMedian | The blockchain context cache can already give this information. |
CurrentHardFork | The blockchain context cache can already give this information. |
HardForkInfo | This request should go to the context cache - it is not currently available though |
FeeEstimate | This request should go to the context cache - it is not currently available though |
The transaction pool is going to have a specific interface for requests that mutate the pool, just to keep in mind, it wont directly use the write handle.
Request | |
---|---|
RelayBlock | This will be handled by the blockchain manager |
Syncing | Same as above |
Synced | Same as above |
Target | Same as above |
TargetHeight | Same as above |
PeerlistSize | This should go to the address book service |
ConnectionCount | Same as above |
SetBan | Same as above |
GetBan | Same as above |
GetBans | Same as above |
What
This is a discussion for what data is required for
cuprated
's RPC system.Notably, this is:
The following tables (except the general process state) are newly proposed requests/responses to be added to each system's
tower::Service
API such that the RPC system can fulfill the request. The RPC system is assumed to have read access (and write access where needed) to all systems viatower::Service
handles.Blockchain
PopBlocks(u64)
u64
/pop_blocks
n
blocks, return the new heightPrune
prune_blockchain
Pruned
bool
prune_blockchain
Block(u64)
Block
get_block
BlockByHash([u8; 32])
Block
get_block
Block
; for convenienceTopBlock
Block
Block
, Same asBlock
; for convenienceTopBlockExtendedHeader
ExtendedBlockHeader
ExtendedBlockHeader
; for convenienceKeyImageSpent([u8; 32])
bool
/is_key_image_spent
KeyImagesSpent
TopBlockFull
(Block, ExtendedBlockHeader)
get_last_block_header
cuprate_rpc_types::misc::BlockHeader
TopBlockHash
[u8; 32]
get_info
TotalTxCount
u64
get_info
cuprate_rpc_types::json::GetInfoResponse::tx_count
DatabaseSize
(u64, u64)
get_info
cuprate_rpc_types::json::GetInfoResponse::{database_size,free_space}
BlockWeightLimit
u64
get_info
cuprate_rpc_types::json::GetInfoResponse::block_weight_limit
BlockWeightMedian
u64
get_info
cuprate_rpc_types::json::GetInfoResponse::block_weight_median
Difficulty(usize)
u128
get_info
cuprate_rpc_types::json::GetInfoResponse::difficulty[_top64]
CurrentHardFork
HardFork
hard_fork_info
HardFork
HardForkInfo(Hardfork)
HardForkInfo
hard_fork_info
cuprate_rpc_types::json::HardForkInfoResponse
; https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server.cpp#L2751; https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/cryptonote_basic/hardfork.cpp#L408;OutputHistogram
OutputHistogram
get_output_histogram
CoinbaseTxSum
CoinbaseTxSum
get_coinbase_tx_sum
FeeEstimate(grace_blocks: u64)
get_fee_estimate
MinerData
get_miner_data
get_alternate_chains
Transaction pool
Backlog
Vec<TxBacklogEntry>
get_txpool_backlog
PoolSize
u64
get_info
cuprate_rpc_types::json::GetInfoResponse::tx_pool_size
Flush(Vec<[u8; 32]>)
()
flush_txpool
Vec
is empty).P2P
RelayBlock(Block)
()
submit_block
ConnectionInfo
get_connections
cuprate_rpc_types::misc::ConnectionInfo
Syncing
bool
get_info
cuprate_rpc_types::json::GetInfoResponse::busy_syncing
Synced
bool
get_info
cuprate_rpc_types::json::GetInfoResponse::synchronized
Target
u64
get_info
cuprate_rpc_types::json::GetInfoResponse::target
TargetHeight
u64
get_info
cuprate_rpc_types::json::GetInfoResponse::target_height
PeerlistSize
(u64, u64)
get_info
cuprate_rpc_types::json::GetInfoResponse::{white,grey}_peerlist_size
ConnectionCount
(u64, u64)
get_info
cuprate_rpc_types::json::GetInfoResponse::{incoming,outgoing}_connections_count
SetBan(cuprate_rpc_types::json::SetBanRequest)
()
set_ban
n
secondsGetBan
cuprate_rpc_types::json::GetBan
banned
GetBans
Vec<cuprate_rpc_types::json::GetBan>
get_ban
cuprated
stateThere is extra state the RPC needs on the more global binary/process level.
This is state that makes sense as global
static
s on thecuprated
-level (or some library exposed to all).START_INSTANT
,START_INSTANT_UNIX
SystemTime
,u64
get_info
cuprate_rpc_types::json::GetInfoResponse::start_time