From df5f0a6c7d0765ecdad52b4dd10ff2d5065e6df5 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Sat, 28 Sep 2024 14:22:45 +0200 Subject: [PATCH] update node --- Cargo.lock | 40 ++-------------------------------------- Cargo.toml | 2 +- node/src/rpc.rs | 16 ++-------------- node/src/service.rs | 15 +++++++-------- 4 files changed, 12 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59eadd1f3..f03aa617b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2211,7 +2211,7 @@ dependencies = [ "gdev-runtime", "gtest-runtime", "hex", - "jsonrpsee 0.23.2", + "jsonrpsee 0.24.5", "log", "memmap2 0.9.5", "num-format", @@ -4461,10 +4461,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b089779ad7f80768693755a031cc14a7766aba707cbe886674e3f79e9b7e47" dependencies = [ "jsonrpsee-core 0.23.2", - "jsonrpsee-server 0.23.2", "jsonrpsee-types 0.23.2", "jsonrpsee-ws-client", - "tokio", ] [[package]] @@ -4475,7 +4473,7 @@ checksum = "126b48a5acc3c52fbd5381a77898cb60e145123179588a29e7ac48f9c06e401b" dependencies = [ "jsonrpsee-core 0.24.5", "jsonrpsee-proc-macros", - "jsonrpsee-server 0.24.5", + "jsonrpsee-server", "jsonrpsee-types 0.24.5", "tokio", "tracing", @@ -4557,16 +4555,10 @@ dependencies = [ "anyhow", "async-trait", "beef", - "bytes", "futures-timer", "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "http-body-util", "jsonrpsee-types 0.23.2", - "parking_lot 0.12.3", "pin-project", - "rand", "rustc-hash 1.1.0", "serde", "serde_json", @@ -4632,34 +4624,6 @@ dependencies = [ "syn 2.0.79", ] -[[package]] -name = "jsonrpsee-server" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "654afab2e92e5d88ebd8a39d6074483f3f2bfdf91c5ac57fe285e7127cdd4f51" -dependencies = [ - "anyhow", - "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "http-body-util", - "hyper 1.4.1", - "hyper-util", - "jsonrpsee-core 0.23.2", - "jsonrpsee-types 0.23.2", - "pin-project", - "route-recognizer", - "serde", - "serde_json", - "soketto 0.8.0", - "thiserror", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tracing", -] - [[package]] name = "jsonrpsee-server" version = "0.24.5" diff --git a/Cargo.toml b/Cargo.toml index bec6e89c6..f014f81de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ enum-as-inner = { version = "=0.5.1", default-features = false } futures = { version = "0.3.30", default-features = false } tera = { version = "1", default-features = false } hex = { version = "0.4.3", default-features = false } -jsonrpsee = { version = "0.23", default-features = false } # Version should exactly match polkadot one +jsonrpsee = { version = "0.24.3", default-features = false } # Version should exactly match polkadot one lazy_static = { version = "1.4.0", default-features = false } log = { version = "0.4.21", default-features = false } maplit = { version = '1.0.2', default-features = false } diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 203e22d08..f5e6f09b2 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -21,8 +21,6 @@ #![warn(missing_docs)] -pub use sc_rpc_api::DenyUnsafe; - use common_runtime::{AccountId, Balance, Block, BlockNumber, Hash, Index}; use jsonrpsee::RpcModule; use sc_consensus_babe::{BabeApi, BabeWorkerHandle}; @@ -70,8 +68,6 @@ pub struct FullDeps<C, P, SC, B> { pub pool: Arc<P>, /// The SelectChain Strategy pub select_chain: SC, - /// Whether to deny unsafe calls - pub deny_unsafe: DenyUnsafe, /// Manual seal command sink pub command_sink_opt: Option< futures::channel::mpsc::Sender<sc_consensus_manual_seal::EngineCommand<sp_core::H256>>, @@ -109,7 +105,6 @@ where client, pool, select_chain, - deny_unsafe, command_sink_opt, babe, grandpa, @@ -121,14 +116,7 @@ where keystore, } = babe; module.merge( - Babe::new( - client.clone(), - babe_worker_handle, - keystore, - select_chain, - deny_unsafe, - ) - .into_rpc(), + Babe::new(client.clone(), babe_worker_handle, keystore, select_chain).into_rpc(), )?; } @@ -150,7 +138,7 @@ where .into_rpc(), )?; - module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; + module.merge(System::new(client.clone(), pool).into_rpc())?; module.merge(TransactionPayment::new(client).into_rpc())?; if let Some(command_sink) = command_sink_opt { // We provide the rpc handler with the sending end of the channel to allow the rpc diff --git a/node/src/service.rs b/node/src/service.rs index 6893dc373..894644308 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -27,7 +27,7 @@ use sc_consensus_grandpa::{FinalityProofProvider, SharedVoterState}; use sc_consensus_manual_seal::{run_manual_seal, EngineCommand, ManualSealParams}; use sc_rpc::SubscriptionTaskExecutor; use sc_service::{ - error::Error as ServiceError, Configuration, PartialComponents, TaskManager, WarpSyncParams, + error::Error as ServiceError, Configuration, PartialComponents, TaskManager, WarpSyncConfig, }; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_consensus_babe::inherents::InherentDataProvider; @@ -193,9 +193,9 @@ where .transpose()?; #[cfg(feature = "native")] - let executor = sc_service::new_native_or_wasm_executor(config); + let executor = sc_service::new_native_or_wasm_executor(&config.executor); #[cfg(not(feature = "native"))] - let executor = sc_service::new_wasm_executor(config); + let executor = sc_service::new_wasm_executor(&config.executor); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, _>( @@ -337,7 +337,7 @@ where Block, <Block as sp_runtime::traits::Block>::Hash, N, - >::new(&config.network); + >::new(&config.network, config.prometheus_registry().cloned()); let metrics = N::register_notification_metrics(config.prometheus_registry()); let peer_store_handle = net_config.peer_store_handle(); let (grandpa_protocol_config, grandpa_notification_service) = @@ -363,12 +363,12 @@ where spawn_handle: task_manager.spawn_handle(), import_queue, block_announce_validator_builder: None, - warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)), + warp_sync_config: Some(WarpSyncConfig::WithProvider(warp_sync)), block_relay: None, metrics, })?; - let role = config.role.clone(); + let role = config.role; let force_authoring = config.force_authoring; let backoff_authoring_blocks: Option<()> = None; let name = config.network.node_name.clone(); @@ -591,7 +591,7 @@ where let rpc_setup = shared_voter_state.clone(); Box::new( - move |deny_unsafe, subscription_task_executor: SubscriptionTaskExecutor| { + move |subscription_task_executor: SubscriptionTaskExecutor| { let grandpa_deps = crate::rpc::GrandpaDeps { shared_voter_state: rpc_setup.clone(), shared_authority_set: shared_authority_set.clone(), @@ -604,7 +604,6 @@ where client: client.clone(), pool: pool.clone(), select_chain: select_chain.clone(), - deny_unsafe, babe: babe_deps.clone(), grandpa: grandpa_deps, command_sink_opt: command_sink_opt.clone(), -- GitLab