mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
Add trie migration rpc to polkadot-parachain (#1424)
* add trie migration rpc to polkadot-parachain * pass backend * fix
This commit is contained in:
Generated
+1
@@ -7698,6 +7698,7 @@ dependencies = [
|
|||||||
"substrate-build-script-utils",
|
"substrate-build-script-utils",
|
||||||
"substrate-frame-rpc-system",
|
"substrate-frame-rpc-system",
|
||||||
"substrate-prometheus-endpoint",
|
"substrate-prometheus-endpoint",
|
||||||
|
"substrate-state-trie-migration-rpc",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
"try-runtime-cli",
|
"try-runtime-cli",
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "m
|
|||||||
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "master" }
|
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
# Polkadot
|
# Polkadot
|
||||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ pub struct FullDeps<C, P> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiate all RPC extensions.
|
/// Instantiate all RPC extensions.
|
||||||
pub fn create_full<C, P>(
|
pub fn create_full<C, P, B>(
|
||||||
deps: FullDeps<C, P>,
|
deps: FullDeps<C, P>,
|
||||||
|
backend: Arc<B>,
|
||||||
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
|
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
|
||||||
where
|
where
|
||||||
C: ProvideRuntimeApi<Block>
|
C: ProvideRuntimeApi<Block>
|
||||||
@@ -57,15 +58,19 @@ where
|
|||||||
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
|
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
|
||||||
C::Api: BlockBuilder<Block>,
|
C::Api: BlockBuilder<Block>,
|
||||||
P: TransactionPool + Sync + Send + 'static,
|
P: TransactionPool + Sync + Send + 'static,
|
||||||
|
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
|
||||||
|
B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,
|
||||||
{
|
{
|
||||||
use frame_rpc_system::{System, SystemApiServer};
|
use frame_rpc_system::{System, SystemApiServer};
|
||||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
||||||
|
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
|
||||||
|
|
||||||
let mut module = RpcExtension::new(());
|
let mut module = RpcExtension::new(());
|
||||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||||
|
|
||||||
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||||
module.merge(TransactionPayment::new(client).into_rpc())?;
|
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
||||||
|
module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?;
|
||||||
|
|
||||||
Ok(module)
|
Ok(module)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,6 +560,7 @@ where
|
|||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
let transaction_pool = transaction_pool.clone();
|
let transaction_pool = transaction_pool.clone();
|
||||||
|
|
||||||
|
let backend_for_rpc = backend.clone();
|
||||||
Box::new(move |deny_unsafe, _| {
|
Box::new(move |deny_unsafe, _| {
|
||||||
let deps = rpc::FullDeps {
|
let deps = rpc::FullDeps {
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
@@ -567,7 +568,7 @@ where
|
|||||||
deny_unsafe,
|
deny_unsafe,
|
||||||
};
|
};
|
||||||
|
|
||||||
rpc::create_full(deps).map_err(Into::into)
|
rpc::create_full(deps, backend_for_rpc.clone()).map_err(Into::into)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user