From 032ac670dd10827380d198f73a92166c33e90b81 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 22 Nov 2023 14:28:15 +0100 Subject: [PATCH 1/2] Fix chainHead_follow error code --- lib/src/json_rpc/parse.rs | 2 +- light-base/src/json_rpc_service/background/chain_head.rs | 2 +- wasm-node/CHANGELOG.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/json_rpc/parse.rs b/lib/src/json_rpc/parse.rs index d9e201bf26..b526b0be2c 100644 --- a/lib/src/json_rpc/parse.rs +++ b/lib/src/json_rpc/parse.rs @@ -289,7 +289,7 @@ pub fn build_error_response( (SerdeErrorCode::ServerError(n), msg) } ErrorResponse::ApplicationDefined(n, msg) => { - assert!(!(-32700..=-32000).contains(&n)); + assert!(!(-32768..=-32000).contains(&n)); (SerdeErrorCode::MethodError(n), msg) } }; 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 7d254d2622..1ad7202422 100644 --- a/light-base/src/json_rpc_service/background/chain_head.rs +++ b/light-base/src/json_rpc_service/background/chain_head.rs @@ -98,7 +98,7 @@ impl Background { "Rejected `chainHead_unstable_follow` subscription due to limit reached." ); request.fail(json_rpc::parse::ErrorResponse::ApplicationDefined( - -32100, + -32800, "Maximum number of `chainHead_unstable_follow` subscriptions reached", )); return; diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index 69a18e934a..53bd80ea25 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -11,6 +11,7 @@ - Fix panic when the runtime of a chain provides consensus information that is inconsistent with the information found in the finalized block. ([#1317](https://github.com/smol-dot/smoldot/pull/1317)) - Incoming notification substreams are now properly when accepted when a peer doesn't have a slot or gets a slot later on. ([#1369](https://github.com/smol-dot/smoldot/pull/1369)) +- Fix panic when `chainHead_unstable_follow` is called too many times. ## 2.0.10 - 2023-11-17 From 9247b9e4ee99f58685ebb0836ed3e4f77e2e4a8d Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 22 Nov 2023 14:28:59 +0100 Subject: [PATCH 2/2] CHANGELOG --- 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 53bd80ea25..85b2577551 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -11,7 +11,7 @@ - Fix panic when the runtime of a chain provides consensus information that is inconsistent with the information found in the finalized block. ([#1317](https://github.com/smol-dot/smoldot/pull/1317)) - Incoming notification substreams are now properly when accepted when a peer doesn't have a slot or gets a slot later on. ([#1369](https://github.com/smol-dot/smoldot/pull/1369)) -- Fix panic when `chainHead_unstable_follow` is called too many times. +- Fix panic when `chainHead_unstable_follow` is called too many times. ([#1392](https://github.com/smol-dot/smoldot/pull/1392)) ## 2.0.10 - 2023-11-17