From 82b0aefe6208f9a66eaabb2b365acd022dfdc3a8 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 13 Nov 2023 15:47:34 +0100 Subject: [PATCH 1/3] Rename `hash` to `hashOrHashes` --- full-node/src/json_rpc_service.rs | 2 +- lib/src/json_rpc/methods.rs | 2 +- light-base/src/json_rpc_service/background/chain_head.rs | 2 +- wasm-node/CHANGELOG.md | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/full-node/src/json_rpc_service.rs b/full-node/src/json_rpc_service.rs index 7b055159c6..9f119b87c7 100644 --- a/full-node/src/json_rpc_service.rs +++ b/full-node/src/json_rpc_service.rs @@ -590,7 +590,7 @@ fn spawn_client_main_task( } methods::MethodCall::chainHead_unstable_unpin { follow_subscription, - hash, + hash_or_hashes: hash, } => { if let Some(follow_subscription) = chain_head_follow_subscriptions.get_mut(&*follow_subscription) diff --git a/lib/src/json_rpc/methods.rs b/lib/src/json_rpc/methods.rs index c8ea8f902a..5904771075 100644 --- a/lib/src/json_rpc/methods.rs +++ b/lib/src/json_rpc/methods.rs @@ -488,7 +488,7 @@ define_methods! { ) -> (), chainHead_unstable_unpin( #[rename = "followSubscription"] follow_subscription: Cow<'a, str>, - hash: HashHexStringSingleOrArray + #[rename = "hashOrHashes"] hash_or_hashes: HashHexStringSingleOrArray ) -> (), chainSpec_v1_chainName() -> Cow<'a, str>, diff --git a/light-base/src/json_rpc_service/background/chain_head.rs b/light-base/src/json_rpc_service/background/chain_head.rs index c33218e57d..52c6bf9298 100644 --- a/light-base/src/json_rpc_service/background/chain_head.rs +++ b/light-base/src/json_rpc_service/background/chain_head.rs @@ -840,7 +840,7 @@ impl ChainHeadFollowTask { } methods::MethodCall::chainHead_unstable_unpin { follow_subscription: _, - hash, + hash_or_hashes: hash, } => { let all_hashes = match &hash { methods::HashHexStringSingleOrArray::Single(hash) => { diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index a4174633d1..dd133a1221 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Changed + +- The `hash` parameter of `chainHead_unstable_unpin` has been renamed to `hashOrHashes`, in accordance with the latest changes in the JSON-RPC API specification. ([#1097](https://github.com/smol-dot/smoldot/pull/1097)) + ### Fixed - Fix panic when requesting a block with a specific hash from the peer-to-peer network and none of the peers has the block. ([#1303](https://github.com/smol-dot/smoldot/pull/1303)) From 603cb29e9d631689686baa59f5b3b0f843f638b0 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 13 Nov 2023 15:48:13 +0100 Subject: [PATCH 2/3] PR link --- wasm-node/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index dd133a1221..30bed2b578 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -4,7 +4,7 @@ ### Changed -- The `hash` parameter of `chainHead_unstable_unpin` has been renamed to `hashOrHashes`, in accordance with the latest changes in the JSON-RPC API specification. ([#1097](https://github.com/smol-dot/smoldot/pull/1097)) +- The `hash` parameter of `chainHead_unstable_unpin` has been renamed to `hashOrHashes`, in accordance with the latest changes in the JSON-RPC API specification. ([#1329](https://github.com/smol-dot/smoldot/pull/1329)) ### Fixed From 7dbe06106463b980f28039d8e3ab550646c292fa Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 13 Nov 2023 15:49:11 +0100 Subject: [PATCH 3/3] More renames --- full-node/src/json_rpc_service.rs | 4 ++-- light-base/src/json_rpc_service/background/chain_head.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/full-node/src/json_rpc_service.rs b/full-node/src/json_rpc_service.rs index 9f119b87c7..0efa7efbf3 100644 --- a/full-node/src/json_rpc_service.rs +++ b/full-node/src/json_rpc_service.rs @@ -590,12 +590,12 @@ fn spawn_client_main_task( } methods::MethodCall::chainHead_unstable_unpin { follow_subscription, - hash_or_hashes: hash, + hash_or_hashes, } => { if let Some(follow_subscription) = chain_head_follow_subscriptions.get_mut(&*follow_subscription) { - let block_hashes = match hash { + let block_hashes = match hash_or_hashes { methods::HashHexStringSingleOrArray::Array(list) => { list.into_iter().map(|h| h.0).collect::>() } diff --git a/light-base/src/json_rpc_service/background/chain_head.rs b/light-base/src/json_rpc_service/background/chain_head.rs index 52c6bf9298..1c23e38659 100644 --- a/light-base/src/json_rpc_service/background/chain_head.rs +++ b/light-base/src/json_rpc_service/background/chain_head.rs @@ -840,9 +840,9 @@ impl ChainHeadFollowTask { } methods::MethodCall::chainHead_unstable_unpin { follow_subscription: _, - hash_or_hashes: hash, + hash_or_hashes, } => { - let all_hashes = match &hash { + let all_hashes = match &hash_or_hashes { methods::HashHexStringSingleOrArray::Single(hash) => { either::Left(iter::once(&hash.0)) }