mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 23:57:56 +00:00
* update polkadot and substrate * add jsonrpsee glue code * fix tests * update substrate & polkadot * update substrate & polkadot * update Cargo.lock * revert Cargo.toml * revert changes in Cargo.toml * update companion * revert substrate change * add Cargo.lock * update substrate manually * update polkadot
This commit is contained in:
Generated
+509
-845
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@ use cumulus_primitives_core::ParaId;
|
||||
use cumulus_test_service::{initial_head_data, run_relay_chain_validator_node, Keyring::*};
|
||||
use futures::join;
|
||||
|
||||
#[substrate_test_utils::test]
|
||||
#[substrate_test_utils::test(flavor = "multi_thread")]
|
||||
#[ignore]
|
||||
async fn sync_blocks_from_tip_without_being_connected_to_a_collator() {
|
||||
let mut builder = sc_cli::LoggerBuilder::new("");
|
||||
|
||||
@@ -23,7 +23,7 @@ use std::sync::Arc;
|
||||
/// If there is a block of the parachain included/backed by the relay chain that isn't circulated in
|
||||
/// the parachain network, we need to recover the PoV from the relay chain. Using this PoV we can
|
||||
/// recover the block, import it and share it with the other nodes of the parachain network.
|
||||
#[substrate_test_utils::test]
|
||||
#[substrate_test_utils::test(flavor = "multi_thread")]
|
||||
#[ignore]
|
||||
async fn pov_recovery() {
|
||||
let mut builder = sc_cli::LoggerBuilder::new("");
|
||||
|
||||
@@ -23,5 +23,5 @@ parking_lot = "0.12.0"
|
||||
derive_more = "0.99.2"
|
||||
async-trait = "0.1.53"
|
||||
thiserror = "1.0.31"
|
||||
jsonrpsee-core = "0.11.0"
|
||||
jsonrpsee-core = "0.12.0"
|
||||
parity-scale-codec = "3.1.2"
|
||||
|
||||
@@ -23,7 +23,7 @@ futures = "0.3.21"
|
||||
futures-timer = "3.0.2"
|
||||
parity-scale-codec = "3.1.2"
|
||||
parking_lot = "0.12.0"
|
||||
jsonrpsee = { version = "0.11.0", features = ["client"] }
|
||||
jsonrpsee = { version = "0.12.0", features = ["client"] }
|
||||
tracing = "0.1.34"
|
||||
async-trait = "0.1.53"
|
||||
url = "2.2.2"
|
||||
|
||||
@@ -76,4 +76,4 @@ std = [
|
||||
|
||||
runtime-benchmarks = [
|
||||
"sp-runtime/runtime-benchmarks"
|
||||
]
|
||||
]
|
||||
|
||||
@@ -20,7 +20,7 @@ log = "0.4.17"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
hex-literal = "0.3.4"
|
||||
jsonrpc-core = "18.0.0"
|
||||
jsonrpsee = { version = "0.12.0", features = ["server"] }
|
||||
|
||||
# Local
|
||||
parachain-template-runtime = { path = "../runtime" }
|
||||
|
||||
@@ -17,7 +17,7 @@ use sp_block_builder::BlockBuilder;
|
||||
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
|
||||
|
||||
/// A type representing all RPC extensions.
|
||||
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
|
||||
pub type RpcExtension = jsonrpsee::RpcModule<()>;
|
||||
|
||||
/// Full client dependencies
|
||||
pub struct FullDeps<C, P> {
|
||||
@@ -30,7 +30,9 @@ pub struct FullDeps<C, P> {
|
||||
}
|
||||
|
||||
/// Instantiate all RPC extensions.
|
||||
pub fn create_full<C, P>(deps: FullDeps<C, P>) -> RpcExtension
|
||||
pub fn create_full<C, P>(
|
||||
deps: FullDeps<C, P>,
|
||||
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
|
||||
where
|
||||
C: ProvideRuntimeApi<Block>
|
||||
+ HeaderBackend<Block>
|
||||
@@ -44,14 +46,13 @@ where
|
||||
C::Api: BlockBuilder<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
{
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
use substrate_frame_rpc_system::{FullSystem, SystemApi};
|
||||
use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPaymentRpc};
|
||||
use substrate_frame_rpc_system::{SystemApiServer, SystemRpc};
|
||||
|
||||
let mut io = jsonrpc_core::IoHandler::default();
|
||||
let mut module = RpcExtension::new(());
|
||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||
|
||||
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
|
||||
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client)));
|
||||
|
||||
io
|
||||
module.merge(SystemRpc::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
|
||||
module.merge(TransactionPaymentRpc::new(client.clone()).into_rpc())?;
|
||||
Ok(module)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
// std
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
// rpc
|
||||
use jsonrpsee::RpcModule;
|
||||
|
||||
use cumulus_client_cli::CollatorOptions;
|
||||
// Local Runtime Types
|
||||
use parachain_template_runtime::{
|
||||
@@ -222,7 +225,7 @@ where
|
||||
Executor: sc_executor::NativeExecutionDispatch + 'static,
|
||||
RB: Fn(
|
||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
) -> Result<RpcModule<()>, sc_service::Error>
|
||||
+ Send
|
||||
+ 'static,
|
||||
BIQ: FnOnce(
|
||||
@@ -301,7 +304,7 @@ where
|
||||
warp_sync: None,
|
||||
})?;
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
let rpc_builder = {
|
||||
let client = client.clone();
|
||||
let transaction_pool = transaction_pool.clone();
|
||||
|
||||
@@ -312,12 +315,12 @@ where
|
||||
deny_unsafe,
|
||||
};
|
||||
|
||||
Ok(crate::rpc::create_full(deps))
|
||||
crate::rpc::create_full(deps).map_err(Into::into)
|
||||
})
|
||||
};
|
||||
|
||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
rpc_extensions_builder,
|
||||
rpc_builder,
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
task_manager: &mut task_manager,
|
||||
@@ -461,7 +464,7 @@ pub async fn start_parachain_node(
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
|_| Ok(Default::default()),
|
||||
|_| Ok(RpcModule::new(())),
|
||||
parachain_build_import_queue,
|
||||
|client,
|
||||
prometheus_registry,
|
||||
|
||||
@@ -26,7 +26,7 @@ statemint-runtime = { path = "statemint" }
|
||||
statemine-runtime = { path = "statemine" }
|
||||
westmint-runtime = { path = "westmint" }
|
||||
canvas-kusama-runtime = { path = "canvas-kusama" }
|
||||
jsonrpc-core = "18.0.0"
|
||||
jsonrpsee = { version = "0.12.0", features = ["server"] }
|
||||
parachains-common = { path = "parachains-common" }
|
||||
|
||||
# Substrate
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use pallet_contracts_rpc::{Contracts, ContractsApi};
|
||||
use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Index as Nonce};
|
||||
use sc_client_api::AuxStore;
|
||||
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
|
||||
@@ -30,7 +29,7 @@ use sp_block_builder::BlockBuilder;
|
||||
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
|
||||
|
||||
/// A type representing all RPC extensions.
|
||||
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
|
||||
pub type RpcExtension = jsonrpsee::RpcModule<()>;
|
||||
|
||||
/// Full client dependencies
|
||||
pub struct FullDeps<C, P> {
|
||||
@@ -43,7 +42,9 @@ pub struct FullDeps<C, P> {
|
||||
}
|
||||
|
||||
/// Instantiate all RPC extensions.
|
||||
pub fn create_full<C, P>(deps: FullDeps<C, P>) -> RpcExtension
|
||||
pub fn create_full<C, P>(
|
||||
deps: FullDeps<C, P>,
|
||||
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
|
||||
where
|
||||
C: ProvideRuntimeApi<Block>
|
||||
+ HeaderBackend<Block>
|
||||
@@ -57,20 +58,22 @@ where
|
||||
C::Api: BlockBuilder<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
{
|
||||
use frame_rpc_system::{FullSystem, SystemApi};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
use frame_rpc_system::{SystemApiServer, SystemRpc};
|
||||
use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPaymentRpc};
|
||||
|
||||
let mut io = jsonrpc_core::IoHandler::default();
|
||||
let mut module = RpcExtension::new(());
|
||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||
|
||||
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
|
||||
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone())));
|
||||
module.merge(SystemRpc::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||
module.merge(TransactionPaymentRpc::new(client.clone()).into_rpc())?;
|
||||
|
||||
io
|
||||
Ok(module)
|
||||
}
|
||||
|
||||
/// Instantiate all RPCs we want at the canvas-kusama chain.
|
||||
pub fn create_canvas_kusama<C, P>(deps: FullDeps<C, P>) -> RpcExtension
|
||||
pub fn create_canvas_kusama<C, P>(
|
||||
deps: FullDeps<C, P>,
|
||||
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
|
||||
where
|
||||
C: ProvideRuntimeApi<Block>
|
||||
+ sc_client_api::BlockBackend<Block>
|
||||
@@ -86,16 +89,18 @@ where
|
||||
C::Api: BlockBuilder<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
{
|
||||
use frame_rpc_system::{FullSystem, SystemApi};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
use frame_rpc_system::{SystemApiServer, SystemRpc};
|
||||
use pallet_contracts_rpc::{ContractsApiServer, ContractsRpc};
|
||||
use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPaymentRpc};
|
||||
use sc_rpc::dev::{Dev, DevApiServer};
|
||||
|
||||
let mut io = jsonrpc_core::IoHandler::default();
|
||||
let mut module = RpcExtension::new(());
|
||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||
|
||||
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
|
||||
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone())));
|
||||
io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));
|
||||
io.extend_with(sc_rpc::dev::DevApi::to_delegate(sc_rpc::dev::Dev::new(client, deny_unsafe)));
|
||||
module.merge(SystemRpc::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||
module.merge(TransactionPaymentRpc::new(client.clone()).into_rpc())?;
|
||||
module.merge(ContractsRpc::new(client.clone()).into_rpc())?;
|
||||
module.merge(Dev::new(client, deny_unsafe).into_rpc())?;
|
||||
|
||||
io
|
||||
Ok(module)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ use cumulus_relay_chain_rpc_interface::RelayChainRPCInterface;
|
||||
use polkadot_service::CollatorPair;
|
||||
use sp_core::Pair;
|
||||
|
||||
use jsonrpsee::RpcModule;
|
||||
|
||||
use crate::rpc;
|
||||
pub use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Header, Index as Nonce};
|
||||
|
||||
@@ -340,7 +342,7 @@ where
|
||||
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||
RB: Fn(
|
||||
Arc<TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>>,
|
||||
) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
|
||||
+ Send
|
||||
+ 'static,
|
||||
BIQ: FnOnce(
|
||||
@@ -421,10 +423,10 @@ where
|
||||
})?;
|
||||
|
||||
let rpc_client = client.clone();
|
||||
let rpc_extensions_builder = Box::new(move |_, _| rpc_ext_builder(rpc_client.clone()));
|
||||
let rpc_builder = Box::new(move |_, _| rpc_ext_builder(rpc_client.clone()));
|
||||
|
||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
rpc_extensions_builder,
|
||||
rpc_builder,
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
task_manager: &mut task_manager,
|
||||
@@ -542,7 +544,7 @@ where
|
||||
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||
RB: Fn(
|
||||
Arc<TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>>,
|
||||
) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
|
||||
+ Send
|
||||
+ 'static,
|
||||
BIQ: FnOnce(
|
||||
@@ -621,7 +623,7 @@ where
|
||||
warp_sync: None,
|
||||
})?;
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
let rpc_builder = {
|
||||
let client = client.clone();
|
||||
let transaction_pool = transaction_pool.clone();
|
||||
|
||||
@@ -632,12 +634,12 @@ where
|
||||
deny_unsafe,
|
||||
};
|
||||
|
||||
Ok(rpc::create_full(deps))
|
||||
rpc::create_full(deps).map_err(Into::into)
|
||||
})
|
||||
};
|
||||
|
||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
rpc_extensions_builder,
|
||||
rpc_builder,
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
task_manager: &mut task_manager,
|
||||
@@ -782,7 +784,7 @@ pub async fn start_rococo_parachain_node(
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
|_| Ok(Default::default()),
|
||||
|_| Ok(RpcModule::new(())),
|
||||
rococo_parachain_build_import_queue,
|
||||
|client,
|
||||
prometheus_registry,
|
||||
@@ -925,7 +927,7 @@ where
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
|_| Ok(Default::default()),
|
||||
|_| Ok(RpcModule::new(())),
|
||||
shell_build_import_queue,
|
||||
|client,
|
||||
prometheus_registry,
|
||||
@@ -1200,7 +1202,7 @@ where
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
|_| Ok(Default::default()),
|
||||
|_| Ok(RpcModule::new(())),
|
||||
statemint_build_import_queue::<_, AuraId>,
|
||||
|client,
|
||||
prometheus_registry,
|
||||
@@ -1365,7 +1367,7 @@ where
|
||||
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||
RB: Fn(
|
||||
Arc<TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>>,
|
||||
) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
|
||||
+ Send
|
||||
+ 'static,
|
||||
BIQ: FnOnce(
|
||||
@@ -1444,7 +1446,7 @@ where
|
||||
warp_sync: None,
|
||||
})?;
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
let rpc_builder = {
|
||||
let client = client.clone();
|
||||
let transaction_pool = transaction_pool.clone();
|
||||
|
||||
@@ -1455,12 +1457,12 @@ where
|
||||
deny_unsafe,
|
||||
};
|
||||
|
||||
Ok(crate::rpc::create_canvas_kusama(deps))
|
||||
crate::rpc::create_canvas_kusama(deps).map_err(Into::into)
|
||||
})
|
||||
};
|
||||
|
||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
rpc_extensions_builder,
|
||||
rpc_builder,
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
task_manager: &mut task_manager,
|
||||
@@ -1603,7 +1605,7 @@ pub async fn start_canvas_kusama_node(
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
|_| Ok(Default::default()),
|
||||
|_| Ok(RpcModule::new(())),
|
||||
canvas_kusama_build_import_queue,
|
||||
|client,
|
||||
prometheus_registry,
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2021"
|
||||
async-trait = "0.1.53"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||
criterion = { version = "0.3.5", features = [ "async_tokio" ] }
|
||||
jsonrpc-core = "18.0.0"
|
||||
jsonrpsee = { version = "0.12.0", features = ["server"] }
|
||||
parking_lot = "0.12.0"
|
||||
rand = "0.8.5"
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
|
||||
@@ -225,9 +225,7 @@ async fn start_node_impl<RB>(
|
||||
TransactionPool,
|
||||
)>
|
||||
where
|
||||
RB: Fn(Arc<Client>) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
+ Send
|
||||
+ 'static,
|
||||
RB: Fn(Arc<Client>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error> + Send + 'static,
|
||||
{
|
||||
if matches!(parachain_config.role, Role::Light) {
|
||||
return Err("Light client not supported!".into())
|
||||
@@ -272,14 +270,14 @@ where
|
||||
warp_sync: None,
|
||||
})?;
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
let rpc_builder = {
|
||||
let client = client.clone();
|
||||
|
||||
Box::new(move |_, _| rpc_ext_builder(client.clone()))
|
||||
};
|
||||
|
||||
let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
rpc_extensions_builder,
|
||||
rpc_builder,
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
task_manager: &mut task_manager,
|
||||
@@ -581,7 +579,7 @@ impl TestNodeBuilder {
|
||||
relay_chain_config,
|
||||
self.para_id,
|
||||
self.wrap_announce_block,
|
||||
|_| Ok(Default::default()),
|
||||
|_| Ok(jsonrpsee::RpcModule::new(())),
|
||||
self.consensus,
|
||||
collator_options,
|
||||
)
|
||||
@@ -675,6 +673,10 @@ pub fn node_config(
|
||||
rpc_cors: None,
|
||||
rpc_methods: Default::default(),
|
||||
rpc_max_payload: None,
|
||||
rpc_max_request_size: None,
|
||||
rpc_max_response_size: None,
|
||||
rpc_id_provider: None,
|
||||
rpc_max_subs_per_conn: None,
|
||||
ws_max_out_buffer_capacity: None,
|
||||
prometheus_config: None,
|
||||
telemetry_endpoints: None,
|
||||
|
||||
@@ -18,7 +18,7 @@ use cumulus_primitives_core::ParaId;
|
||||
use cumulus_test_service::{initial_head_data, run_relay_chain_validator_node, Keyring::*};
|
||||
use futures::join;
|
||||
|
||||
#[substrate_test_utils::test]
|
||||
#[substrate_test_utils::test(flavor = "multi_thread")]
|
||||
#[ignore]
|
||||
async fn test_full_node_catching_up() {
|
||||
let mut builder = sc_cli::LoggerBuilder::new("");
|
||||
|
||||
@@ -30,7 +30,7 @@ use cumulus_test_service::{initial_head_data, run_relay_chain_validator_node, Ke
|
||||
use sc_client_api::{BlockBackend, UsageProvider};
|
||||
use sp_runtime::generic::BlockId;
|
||||
|
||||
#[substrate_test_utils::test]
|
||||
#[substrate_test_utils::test(flavor = "multi_thread")]
|
||||
#[ignore]
|
||||
async fn test_migrate_solo_to_para() {
|
||||
let mut builder = sc_cli::LoggerBuilder::new("");
|
||||
|
||||
@@ -20,7 +20,7 @@ use futures::StreamExt;
|
||||
use sc_client_api::BlockchainEvents;
|
||||
use sp_runtime::generic::BlockId;
|
||||
|
||||
#[substrate_test_utils::test]
|
||||
#[substrate_test_utils::test(flavor = "multi_thread")]
|
||||
#[ignore]
|
||||
async fn test_runtime_upgrade() {
|
||||
let mut builder = sc_cli::LoggerBuilder::new("runtime=debug");
|
||||
|
||||
Reference in New Issue
Block a user