Conversation
| start_height: u64, | ||
| }, | ||
| AccessResponseBase { | ||
| m_blocks_ids: ByteArrayVec<32> = default::<ByteArrayVec<32>>(), "default", |
There was a problem hiding this comment.
Typo fix The field name in monerod is m_block_ids.
| #[cfg(feature = "epee")] | ||
| define_request_and_response! { | ||
| get_o_indexesbin, | ||
| "cc73fe71162d564ffda8e549b79a350bca53c454" => | ||
| core_rpc_server_commands_defs.h => 487..=510, | ||
| GetOutputIndexes, | ||
| #[derive(Copy)] | ||
| Request { | ||
| txid: [u8; 32], | ||
| }, | ||
| AccessResponseBase { | ||
| o_indexes: Vec<u64> as ContainerAsBlob<u64>, | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Removed the duplicate of GetOutputIndexes that wrapped o_indexes in ContainerAsBlob<u64>. monerod uses plain KV_SERIALIZE(o_indexes) for both, not KV_SERIALIZE_CONTAINER_POD_AS_BLOB.
| GetOuts, | ||
| Request { | ||
| outputs: Vec<GetOutputsOut> = default::<Vec<GetOutputsOut>>(), "default", | ||
| get_txid: bool, |
There was a problem hiding this comment.
| define_request_and_response! { | ||
| UNDOCUMENTED_METHOD, | ||
| "cc73fe71162d564ffda8e549b79a350bca53c454" => | ||
| core_rpc_server_commands_defs.h => 2522..=2556, | ||
|
|
||
| RpcAccessInfo, | ||
|
|
||
| Request { | ||
| client: String, | ||
| }, | ||
|
|
||
| AccessResponseBase { | ||
| hashing_blob: String, | ||
| seed_height: u64, | ||
| seed_hash: String, | ||
| next_seed_hash: String, | ||
| cookie: u32, | ||
| diff: u64, | ||
| credits_per_hash_found: u64, | ||
| height: u64, | ||
| } | ||
| } | ||
|
|
||
| define_request_and_response! { | ||
| UNDOCUMENTED_METHOD, | ||
| "cc73fe71162d564ffda8e549b79a350bca53c454" => | ||
| core_rpc_server_commands_defs.h => 2558..=2580, | ||
|
|
||
| RpcAccessSubmitNonce, | ||
|
|
||
| Request { | ||
| client: String, | ||
| nonce: u32, | ||
| cookie: u32, | ||
| }, | ||
|
|
||
| AccessResponseBase {} | ||
| } | ||
|
|
||
| define_request_and_response! { | ||
| UNDOCUMENTED_METHOD, | ||
| "cc73fe71162d564ffda8e549b79a350bca53c454" => | ||
| core_rpc_server_commands_defs.h => 2582..=2604, | ||
|
|
||
| RpcAccessPay, | ||
|
|
||
| Request { | ||
| client: String, | ||
| paying_for: String, | ||
| payment: u64, | ||
| }, | ||
|
|
||
| AccessResponseBase {} | ||
| } | ||
|
|
||
| /// An entry in [`RpcAccessTrackingResponse`]. | ||
| #[derive( | ||
| serde::Serialize, serde::Deserialize, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash, | ||
| )] | ||
| pub struct RpcAccessTrackingEntry { | ||
| rpc: String, | ||
| count: u64, | ||
| time: u64, | ||
| credits: u64, | ||
| } | ||
|
|
||
| cuprate_epee_encoding::epee_object!( | ||
| RpcAccessTrackingEntry, | ||
| rpc: String, | ||
| count: u64, | ||
| time: u64, | ||
| credits: u64, | ||
| ); | ||
|
|
||
| define_request_and_response! { | ||
| UNDOCUMENTED_METHOD, | ||
| "cc73fe71162d564ffda8e549b79a350bca53c454" => | ||
| core_rpc_server_commands_defs.h => 2606..=2644, | ||
|
|
||
| RpcAccessTracking (restricted), | ||
|
|
||
| Request { | ||
| clear: bool, | ||
| }, | ||
|
|
||
| ResponseBase { | ||
| data: Vec<RpcAccessTrackingEntry>, | ||
| } | ||
| } | ||
|
|
||
| /// An entry in [`RpcAccessDataResponse`]. | ||
| #[derive( | ||
| serde::Serialize, serde::Deserialize, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash, | ||
| )] | ||
| pub struct RpcAccessDataEntry { | ||
| client: String, | ||
| balance: u64, | ||
| last_update_time: u64, | ||
| credits_total: u64, | ||
| credits_used: u64, | ||
| nonces_good: u64, | ||
| nonces_stale: u64, | ||
| nonces_bad: u64, | ||
| nonces_dupe: u64, | ||
| } | ||
|
|
||
| cuprate_epee_encoding::epee_object!( | ||
| RpcAccessDataEntry, | ||
| client: String, | ||
| balance: u64, | ||
| last_update_time: u64, | ||
| credits_total: u64, | ||
| credits_used: u64, | ||
| nonces_good: u64, | ||
| nonces_stale: u64, | ||
| nonces_bad: u64, | ||
| nonces_dupe: u64, | ||
| ); | ||
|
|
||
| define_request_and_response! { | ||
| UNDOCUMENTED_METHOD, | ||
| "cc73fe71162d564ffda8e549b79a350bca53c454" => | ||
| core_rpc_server_commands_defs.h => 2646..=2692, | ||
|
|
||
| RpcAccessData (restricted), | ||
|
|
||
| Request { }, | ||
|
|
||
| ResponseBase { | ||
| entries: Vec<RpcAccessDataEntry>, | ||
| hashrate: u32, | ||
| } | ||
| } | ||
|
|
||
| define_request_and_response! { | ||
| UNDOCUMENTED_METHOD, | ||
| "cc73fe71162d564ffda8e549b79a350bca53c454" => | ||
| core_rpc_server_commands_defs.h => 2695..=2720, | ||
|
|
||
| RpcAccessAccount (restricted), | ||
|
|
||
| Request { | ||
| client: String, | ||
| delta_balance: i64 = default::<i64>(), "default", | ||
| }, | ||
|
|
||
| ResponseBase { | ||
| credits: u64, | ||
| } | ||
| } |
There was a problem hiding this comment.
These types were all not included with the initial RPC stuff, added them now, although they wont be used.
| current_height: u64 = default::<u64>(), "default", | ||
| #[cfg_attr(feature = "serde", serde(skip_serializing_if = "crate::free::is_zero"))] | ||
| target_height: u64 = default::<u64>(), "default", |
There was a problem hiding this comment.
| impl<'de> Deserialize<'de> for JsonRpcRequest { | ||
| fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { |
There was a problem hiding this comment.
I wanted to avoid this, but I don't think we can. I added 2 step deserialisation as it's the only way to handle the different ways the empty params field can be accepted.
| SetBans(SetBansRequest), | ||
| GetBans(GetBansRequest), | ||
| Banned(BannedRequest), | ||
| FlushTransactionPool(FlushTransactionPoolRequest), |
There was a problem hiding this comment.
| #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] | ||
| #[cfg_attr(feature = "serde", serde(untagged))] | ||
| pub enum OtherRequest { | ||
| GetInfo(GetInfoRequest), |
There was a problem hiding this comment.
| fn compress_integer_array(v: &[u64]) -> Vec<u8> { | ||
| let mut out = Vec::with_capacity(v.len() * 2); | ||
| for val in v { | ||
| VarInt::write(val, &mut out).expect("Writing to vec should not fail"); | ||
| } | ||
| out |
There was a problem hiding this comment.
| match name { | ||
| "start_height" => self.start_height = Some(read_epee_value(r)?), | ||
| "base" => self.base = Some(read_epee_value(r)?), | ||
| "amount" => self.amount = Some(read_epee_value(r)?), | ||
| "binary" => self.binary = Some(read_epee_value(r)?), | ||
| "compress" => self.compress = Some(read_epee_value(r)?), | ||
| "compressed_data" => self.compressed_data = Some(read_epee_value(r)?), | ||
| // `distribution` arrives as a raw LE-u64 blob when `binary=true` | ||
| // (monerod uses `KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N`) or as a | ||
| // typed EPEE u64 array when `binary=false`. Detect via marker. | ||
| "distribution" => { | ||
| let marker = read_marker(r)?; | ||
| self.distribution = Some(if marker == ContainerAsBlob::<u64>::MARKER { | ||
| ContainerAsBlob::<u64>::read(r, &marker)?.into() | ||
| } else { | ||
| Vec::<u64>::read(r, &marker)? | ||
| }); | ||
| } | ||
| _ => return Ok(false), | ||
| } |
There was a problem hiding this comment.
| #[doc = monero_definition_link!("cc73fe71162d564ffda8e549b79a350bca53c454", "/rpc/core_rpc_server_commands_defs.h", 91)] | ||
| /// RPC miror version. | ||
| pub const CORE_RPC_VERSION_MINOR: u32 = 14; | ||
| pub const CORE_RPC_VERSION_MINOR: u32 = 15; |
There was a problem hiding this comment.
MINOR bump to 15: the still relevant addition in monerod is monero-project/monero#9383, which adds top_block_hash to /getblocks.bin's response
Should be added with the bump or new issue? theres already a TODO for it fwiw
There was a problem hiding this comment.
Ah yeah, this PR is split from my wider RPC changes, where this is already done. I'll leave this for now as it'll be ok once the rest is merged.
| "rpc_access_submit_nonce" => { | ||
| Self::RpcAccessSubmitNonce(de!(RpcAccessSubmitNonceRequest)) | ||
| } |
There was a problem hiding this comment.
nits: maybe inhibit rustfmt here to have unified formatting ?
There was a problem hiding this comment.
would rather just leave this
SyntheticBird45
left a comment
There was a problem hiding this comment.
first pass. Will approve tomorrow
|
fuzz CI error is not due to this PR |
Will add comments on the main changes.