From 0fb827cbc4a4282d82c92d13c9bd081de99f90f0 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 10 Feb 2022 09:45:14 +0100 Subject: [PATCH 1/5] Mark sync_state_genSyncSpec JSON-RPC as safe --- client/sync-state-rpc/src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/client/sync-state-rpc/src/lib.rs b/client/sync-state-rpc/src/lib.rs index f416b3a0e8f73..947516267ed65 100644 --- a/client/sync-state-rpc/src/lib.rs +++ b/client/sync-state-rpc/src/lib.rs @@ -185,10 +185,6 @@ where Backend: HeaderBackend + sc_client_api::AuxStore + 'static, { fn system_gen_sync_spec(&self, raw: bool) -> jsonrpc_core::Result { - if let Err(err) = self.deny_unsafe.check_if_safe() { - return Err(err.into()) - } - let mut chain_spec = self.chain_spec.cloned_box(); let sync_state = self.build_sync_state().map_err(map_error::>)?; From 5276c268a97e6408e74cc49c2dd60868653159ad Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 10 Feb 2022 10:12:49 +0100 Subject: [PATCH 2/5] Note that parameter is unused --- client/sync-state-rpc/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/sync-state-rpc/src/lib.rs b/client/sync-state-rpc/src/lib.rs index 947516267ed65..de429053ddb70 100644 --- a/client/sync-state-rpc/src/lib.rs +++ b/client/sync-state-rpc/src/lib.rs @@ -134,7 +134,6 @@ pub struct SyncStateRpcHandler { client: Arc, shared_authority_set: SharedAuthoritySet, shared_epoch_changes: SharedEpochChanges, - deny_unsafe: sc_rpc_api::DenyUnsafe, } impl SyncStateRpcHandler @@ -143,12 +142,15 @@ where Backend: HeaderBackend + sc_client_api::AuxStore + 'static, { /// Create a new handler. + /// + /// The `deny_unsafe` parameter is deprecated and unused. It is there only to maintain + /// API backwards compatibility. pub fn new( chain_spec: Box, client: Arc, shared_authority_set: SharedAuthoritySet, shared_epoch_changes: SharedEpochChanges, - deny_unsafe: sc_rpc_api::DenyUnsafe, + _deny_unsafe: sc_rpc_api::DenyUnsafe, ) -> Result> { if sc_chain_spec::get_extension::(chain_spec.extensions()) .is_some() From 7be8fd5489a3a558000086e341d58de5a600ce1c Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 10 Feb 2022 10:22:04 +0100 Subject: [PATCH 3/5] Ideally I'd wait for compilation to be finished before pushing, but it's really taking a long time --- client/sync-state-rpc/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/sync-state-rpc/src/lib.rs b/client/sync-state-rpc/src/lib.rs index de429053ddb70..70dac8d4f30bc 100644 --- a/client/sync-state-rpc/src/lib.rs +++ b/client/sync-state-rpc/src/lib.rs @@ -155,7 +155,7 @@ where if sc_chain_spec::get_extension::(chain_spec.extensions()) .is_some() { - Ok(Self { chain_spec, client, shared_authority_set, shared_epoch_changes, deny_unsafe }) + Ok(Self { chain_spec, client, shared_authority_set, shared_epoch_changes }) } else { Err(Error::::LightSyncStateExtensionNotFound) } From c36373de87e48c7612f528e023e68117ca8699a9 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 14 Feb 2022 11:06:52 +0100 Subject: [PATCH 4/5] Remove deny_unsafe parameter --- bin/node/rpc/src/lib.rs | 1 - client/sync-state-rpc/src/lib.rs | 4 ---- 2 files changed, 5 deletions(-) diff --git a/bin/node/rpc/src/lib.rs b/bin/node/rpc/src/lib.rs index 30f7a0fdf023c..31f2f41086885 100644 --- a/bin/node/rpc/src/lib.rs +++ b/bin/node/rpc/src/lib.rs @@ -165,7 +165,6 @@ where client, shared_authority_set, shared_epoch_changes, - deny_unsafe, )?, )); diff --git a/client/sync-state-rpc/src/lib.rs b/client/sync-state-rpc/src/lib.rs index 70dac8d4f30bc..6fc0d17800fed 100644 --- a/client/sync-state-rpc/src/lib.rs +++ b/client/sync-state-rpc/src/lib.rs @@ -142,15 +142,11 @@ where Backend: HeaderBackend + sc_client_api::AuxStore + 'static, { /// Create a new handler. - /// - /// The `deny_unsafe` parameter is deprecated and unused. It is there only to maintain - /// API backwards compatibility. pub fn new( chain_spec: Box, client: Arc, shared_authority_set: SharedAuthoritySet, shared_epoch_changes: SharedEpochChanges, - _deny_unsafe: sc_rpc_api::DenyUnsafe, ) -> Result> { if sc_chain_spec::get_extension::(chain_spec.extensions()) .is_some() From 9f31c7d429527611164a2fc8ded5071b8db3af06 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 14 Feb 2022 11:35:13 +0100 Subject: [PATCH 5/5] Remove unused dependency --- Cargo.lock | 1 - client/sync-state-rpc/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index feb721e6092cf..164c1d945e466 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8809,7 +8809,6 @@ dependencies = [ "sc-consensus-babe", "sc-consensus-epochs", "sc-finality-grandpa", - "sc-rpc-api", "serde", "serde_json", "sp-blockchain", diff --git a/client/sync-state-rpc/Cargo.toml b/client/sync-state-rpc/Cargo.toml index b413446c321f2..3e064685488d4 100644 --- a/client/sync-state-rpc/Cargo.toml +++ b/client/sync-state-rpc/Cargo.toml @@ -22,7 +22,6 @@ sc-client-api = { version = "4.0.0-dev", path = "../api" } sc-consensus-babe = { version = "0.10.0-dev", path = "../consensus/babe" } sc-consensus-epochs = { version = "0.10.0-dev", path = "../consensus/epochs" } sc-finality-grandpa = { version = "0.10.0-dev", path = "../finality-grandpa" } -sc-rpc-api = { version = "0.10.0-dev", path = "../rpc-api" } serde_json = "1.0.74" serde = { version = "1.0.136", features = ["derive"] } sp-blockchain = { version = "4.0.0-dev", path = "../../primitives/blockchain" }