Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Mark sync_state_genSyncSpec JSON-RPC as safe (#10832)
Browse files Browse the repository at this point in the history
* Mark sync_state_genSyncSpec JSON-RPC as safe

* Note that parameter is unused

* Ideally I'd wait for compilation to be finished before pushing, but it's really taking a long time

* Remove deny_unsafe parameter

* Remove unused dependency
  • Loading branch information
tomaka authored Feb 15, 2022
1 parent 9d96262 commit b9927cd
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bin/node/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ where
client,
shared_authority_set,
shared_epoch_changes,
deny_unsafe,
)?,
));

Expand Down
1 change: 0 additions & 1 deletion client/sync-state-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
8 changes: 1 addition & 7 deletions client/sync-state-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ pub struct SyncStateRpcHandler<Block: BlockT, Backend> {
client: Arc<Backend>,
shared_authority_set: SharedAuthoritySet<Block>,
shared_epoch_changes: SharedEpochChanges<Block>,
deny_unsafe: sc_rpc_api::DenyUnsafe,
}

impl<Block, Backend> SyncStateRpcHandler<Block, Backend>
Expand All @@ -148,12 +147,11 @@ where
client: Arc<Backend>,
shared_authority_set: SharedAuthoritySet<Block>,
shared_epoch_changes: SharedEpochChanges<Block>,
deny_unsafe: sc_rpc_api::DenyUnsafe,
) -> Result<Self, Error<Block>> {
if sc_chain_spec::get_extension::<LightSyncStateExtension>(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::<Block>::LightSyncStateExtensionNotFound)
}
Expand Down Expand Up @@ -185,10 +183,6 @@ where
Backend: HeaderBackend<Block> + sc_client_api::AuxStore + 'static,
{
fn system_gen_sync_spec(&self, raw: bool) -> jsonrpc_core::Result<jsonrpc_core::Value> {
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::<Block, Error<Block>>)?;
Expand Down

0 comments on commit b9927cd

Please sign in to comment.