From 4f3b943b129f105a4a44b9ea59c66f340ceeabc4 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Mon, 25 Nov 2024 19:18:20 -0500 Subject: [PATCH] fixes --- rpc/interface/src/route/bin.rs | 3 +-- rpc/interface/src/router_builder.rs | 1 + rpc/types/README.md | 2 +- rpc/types/src/json.rs | 4 ++-- rpc/types/src/misc/distribution.rs | 8 ++------ rpc/types/src/misc/misc.rs | 6 +++--- test-utils/src/rpc/data/json.rs | 6 +++--- 7 files changed, 13 insertions(+), 17 deletions(-) diff --git a/rpc/interface/src/route/bin.rs b/rpc/interface/src/route/bin.rs index fac6ed5..0239ecd 100644 --- a/rpc/interface/src/route/bin.rs +++ b/rpc/interface/src/route/bin.rs @@ -9,8 +9,7 @@ use cuprate_rpc_types::{ bin::{ BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksRequest, GetHashesRequest, GetOutputDistributionRequest, GetOutputIndexesRequest, GetOutsRequest, - GetTransactionPoolBacklogRequest, GetTransactionPoolBacklogResponse, - GetTransactionPoolHashesRequest, + GetTransactionPoolBacklogRequest, GetTransactionPoolHashesRequest, }, RpcCall, }; diff --git a/rpc/interface/src/router_builder.rs b/rpc/interface/src/router_builder.rs index d18a694..8f54194 100644 --- a/rpc/interface/src/router_builder.rs +++ b/rpc/interface/src/router_builder.rs @@ -181,6 +181,7 @@ generate_router_builder! { bin_get_o_indexes => "/get_o_indexes.bin" => bin::get_o_indexes => (get, post), bin_get_outs => "/get_outs.bin" => bin::get_outs => (get, post), bin_get_transaction_pool_hashes => "/get_transaction_pool_hashes.bin" => bin::get_transaction_pool_hashes => (get, post), + bin_get_txpool_backlog => "/get_txpool_backlog.bin" => bin::get_txpool_backlog => (get, post), bin_get_output_distribution => "/get_output_distribution.bin" => bin::get_output_distribution => (get, post), } diff --git a/rpc/types/README.md b/rpc/types/README.md index baff356..f87bd1a 100644 --- a/rpc/types/README.md +++ b/rpc/types/README.md @@ -52,7 +52,7 @@ TODO: update after finalizing optimization tradeoff. +TODO: updated after deciding compatibility <-> optimization tradeoff. - Fixed byte containers diff --git a/rpc/types/src/json.rs b/rpc/types/src/json.rs index 859c825..a07a6f3 100644 --- a/rpc/types/src/json.rs +++ b/rpc/types/src/json.rs @@ -1378,12 +1378,12 @@ define_request_and_response! { }, #[doc = serde_doc_test!( - GET_OUTPUT_DISTRIBUTION_RESPONSE => GetOutputDistributionResponse { + GET_OUTPUT_DISTRIBUTION_V2_RESPONSE => GetOutputDistributionV2Response { base: AccessResponseBase::OK, distributions: vec![Distribution::Uncompressed(DistributionUncompressed { start_height: 1462078, base: 0, - distribution: vec![], + distribution: vec![0, 1, 2], amount: 2628780000, binary: true, })], diff --git a/rpc/types/src/misc/distribution.rs b/rpc/types/src/misc/distribution.rs index e920d12..996e123 100644 --- a/rpc/types/src/misc/distribution.rs +++ b/rpc/types/src/misc/distribution.rs @@ -44,7 +44,7 @@ fn decompress_integer_array(_: &[u8]) -> Vec { "rpc/core_rpc_server_commands_defs.h", 2468..=2508 )] -/// Used in [`crate::json::GetOutputDistributionResponse`]. +/// Used in [`crate::json::GetOutputDistributionV2Response`]. /// /// # Internals /// This type's (de)serialization depends on `monerod`'s (de)serialization. @@ -82,10 +82,8 @@ impl Default for Distribution { pub struct DistributionUncompressed { pub start_height: u64, pub base: u64, - /// TODO: this is a binary JSON string if `binary == true`. pub distribution: Vec, pub amount: u64, - pub binary: bool, } #[cfg(feature = "epee")] @@ -95,7 +93,6 @@ epee_object! { base: u64, distribution: Vec, amount: u64, - binary: bool, } /// Data within [`Distribution::CompressedBinary`]. @@ -212,10 +209,9 @@ impl EpeeObjectBuilder for __DistributionEpeeBuilder { }) } else if let Some(distribution) = self.distribution { Distribution::Uncompressed(DistributionUncompressed { - binary: self.binary.ok_or(ELSE)?, - distribution, start_height, base, + distribution, amount, }) } else { diff --git a/rpc/types/src/misc/misc.rs b/rpc/types/src/misc/misc.rs index 8f7467b..91b492a 100644 --- a/rpc/types/src/misc/misc.rs +++ b/rpc/types/src/misc/misc.rs @@ -178,7 +178,7 @@ define_struct_and_impl_epee! { 2139..=2156 )] #[derive(Copy)] - /// Used in [`crate::json::GetOutputHistogramResponse`]. + /// Used in [`crate::json::GetOutputHistogramV2Response`]. HistogramEntry { amount: u64, total_instances: u64, @@ -257,7 +257,7 @@ define_struct_and_impl_epee! { 1637..=1642 )] #[derive(Copy)] - /// Used in [`crate::json::GetTransactionPoolBacklogResponse`]. + /// Used in [`crate::json::GetTransactionPoolBacklogV2Response`]. TxBacklogEntry { weight: u64, fee: u64, @@ -271,7 +271,7 @@ define_struct_and_impl_epee! { "rpc/rpc_handler.h", 45..=50 )] - /// Used in [`crate::json::GetOutputDistributionResponse`]. + /// Used in [`crate::json::GetOutputDistributionV2Response`]. OutputDistributionData { distribution: Vec, start_height: u64, diff --git a/test-utils/src/rpc/data/json.rs b/test-utils/src/rpc/data/json.rs index 0431821..36c10f5 100644 --- a/test-utils/src/rpc/data/json.rs +++ b/test-utils/src/rpc/data/json.rs @@ -1085,9 +1085,9 @@ r#"{ "result": { "backlog": [ { - weight: 0, - fee: 0, - time_in_pool: 0, + "weight": 0, + "fee": 0, + "time_in_pool": 0 } ], "status": "OK",