Companion for Substrate#14612 (#2923)

* Companion for Substrate#14612

https://github.com/paritytech/substrate/pull/14612

* Remove patch

* Cargo.lock

* Fix

* Fix compilation

* Fix Fix

* ...

* :face_palm:

* .................

* update lockfile for {"polkadot", "substrate"}

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Bastian Köcher
2023-08-17 14:39:09 +02:00
committed by GitHub
parent 061eee1382
commit 02691d94d8
20 changed files with 332 additions and 398 deletions
+266 -266
View File
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -406,14 +406,12 @@ mod tests {
// Ensure that we did not include `:code` in the proof. // Ensure that we did not include `:code` in the proof.
let proof = block.storage_proof(); let proof = block.storage_proof();
let db = proof
.to_storage_proof::<BlakeTwo256>(Some(header.state_root()))
.unwrap()
.0
.into_memory_db();
let backend = sp_state_machine::new_in_mem_hash_key::<BlakeTwo256>() let backend = sp_state_machine::create_proof_check_backend::<BlakeTwo256>(
.update_backend(*header.state_root(), db); *header.state_root(),
proof.to_storage_proof::<BlakeTwo256>(None).unwrap().0,
)
.unwrap();
// Should return an error, as it was not included while building the proof. // Should return an error, as it was not included while building the proof.
assert!(backend assert!(backend
@@ -95,8 +95,7 @@ where
RClient: RelayChainInterface, RClient: RelayChainInterface,
CIDP: CreateInherentDataProviders<Block, ()> + 'static, CIDP: CreateInherentDataProviders<Block, ()> + 'static,
BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static, BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static,
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>, Proposer: ProposerInterface<Block>,
Proposer::Transaction: Sync,
CS: CollatorServiceInterface<Block>, CS: CollatorServiceInterface<Block>,
P: Pair, P: Pair,
P::Public: AppPublic + Member, P::Public: AppPublic + Member,
@@ -190,7 +189,7 @@ where
.await .await
.map_err(|e| Box::new(e))?; .map_err(|e| Box::new(e))?;
let sealed_importable = seal::<_, _, P>( let sealed_importable = seal::<_, P>(
proposal.block, proposal.block,
proposal.storage_changes, proposal.storage_changes,
&slot_claim.author_pub, &slot_claim.author_pub,
@@ -322,12 +321,12 @@ where
} }
/// Seal a block with a signature in the header. /// Seal a block with a signature in the header.
pub fn seal<B: BlockT, T, P>( pub fn seal<B: BlockT, P>(
pre_sealed: B, pre_sealed: B,
storage_changes: StorageChanges<T, HashingFor<B>>, storage_changes: StorageChanges<HashingFor<B>>,
author_pub: &P::Public, author_pub: &P::Public,
keystore: &KeystorePtr, keystore: &KeystorePtr,
) -> Result<BlockImportParams<B, T>, Box<dyn Error>> ) -> Result<BlockImportParams<B>, Box<dyn Error>>
where where
P: Pair, P: Pair,
P::Signature: Codec + TryFrom<Vec<u8>>, P::Signature: Codec + TryFrom<Vec<u8>>,
@@ -84,8 +84,7 @@ pub async fn run<Block, P, BI, CIDP, Client, RClient, SO, Proposer, CS>(
CIDP: CreateInherentDataProviders<Block, ()> + 'static, CIDP: CreateInherentDataProviders<Block, ()> + 'static,
BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static, BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static,
SO: SyncOracle + Send + Sync + Clone + 'static, SO: SyncOracle + Send + Sync + Clone + 'static,
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>, Proposer: ProposerInterface<Block>,
Proposer::Transaction: Sync,
CS: CollatorServiceInterface<Block>, CS: CollatorServiceInterface<Block>,
P: Pair, P: Pair,
P::Public: AppPublic + Member, P::Public: AppPublic + Member,
@@ -103,8 +103,7 @@ pub async fn run<Block, P, BI, CIDP, Client, Backend, RClient, SO, Proposer, CS>
CIDP: CreateInherentDataProviders<Block, ()> + 'static, CIDP: CreateInherentDataProviders<Block, ()> + 'static,
BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static, BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static,
SO: SyncOracle + Send + Sync + Clone + 'static, SO: SyncOracle + Send + Sync + Clone + 'static,
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>, Proposer: ProposerInterface<Block>,
Proposer::Transaction: Sync,
CS: CollatorServiceInterface<Block>, CS: CollatorServiceInterface<Block>,
P: Pair, P: Pair,
P::Public: AppPublic + Member, P::Public: AppPublic + Member,
@@ -89,8 +89,8 @@ where
{ {
async fn verify( async fn verify(
&mut self, &mut self,
mut block_params: BlockImportParams<Block, ()>, mut block_params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block, ()>, String> { ) -> Result<BlockImportParams<Block>, String> {
// Skip checks that include execution, if being told so, or when importing only state. // Skip checks that include execution, if being told so, or when importing only state.
// //
// This is done for example when gap syncing and it is expected that the block after the gap // This is done for example when gap syncing and it is expected that the block after the gap
@@ -221,7 +221,7 @@ pub fn fully_verifying_import_queue<P, Client, Block: BlockT, I, CIDP>(
spawner: &impl sp_core::traits::SpawnEssentialNamed, spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>, registry: Option<&substrate_prometheus_endpoint::Registry>,
telemetry: Option<TelemetryHandle>, telemetry: Option<TelemetryHandle>,
) -> BasicQueue<Block, I::Transaction> ) -> BasicQueue<Block>
where where
P: Pair + 'static, P: Pair + 'static,
P::Signature: Codec, P::Signature: Codec,
@@ -231,7 +231,6 @@ where
+ Send + Send
+ Sync + Sync
+ 'static, + 'static,
I::Transaction: Send,
Client: ProvideRuntimeApi<Block> + Send + Sync + 'static, Client: ProvideRuntimeApi<Block> + Send + Sync + 'static,
<Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public>, <Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public>,
CIDP: CreateInherentDataProviders<Block, ()> + 'static, CIDP: CreateInherentDataProviders<Block, ()> + 'static,
@@ -60,7 +60,7 @@ pub fn import_queue<P, Block, I, C, S, CIDP>(
registry, registry,
telemetry, telemetry,
}: ImportQueueParams<'_, I, C, CIDP, S>, }: ImportQueueParams<'_, I, C, CIDP, S>,
) -> Result<DefaultImportQueue<Block, C>, sp_consensus::Error> ) -> Result<DefaultImportQueue<Block>, sp_consensus::Error>
where where
Block: BlockT, Block: BlockT,
C::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public> + ApiExt<Block>, C::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public> + ApiExt<Block>,
@@ -72,7 +72,7 @@ where
+ AuxStore + AuxStore
+ UsageProvider<Block> + UsageProvider<Block>
+ HeaderBackend<Block>, + HeaderBackend<Block>,
I: BlockImport<Block, Error = ConsensusError, Transaction = sp_api::TransactionFor<C, Block>> I: BlockImport<Block, Error = ConsensusError>
+ ParachainBlockImportMarker + ParachainBlockImportMarker
+ Send + Send
+ Sync + Sync
+1 -6
View File
@@ -118,18 +118,13 @@ where
Client: Client:
ProvideRuntimeApi<B> + BlockOf + AuxStore + HeaderBackend<B> + Send + Sync + 'static, ProvideRuntimeApi<B> + BlockOf + AuxStore + HeaderBackend<B> + Send + Sync + 'static,
Client::Api: AuraApi<B, P::Public>, Client::Api: AuraApi<B, P::Public>,
BI: BlockImport<B, Transaction = sp_api::TransactionFor<Client, B>> BI: BlockImport<B> + ParachainBlockImportMarker + Send + Sync + 'static,
+ ParachainBlockImportMarker
+ Send
+ Sync
+ 'static,
SO: SyncOracle + Send + Sync + Clone + 'static, SO: SyncOracle + Send + Sync + Clone + 'static,
BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Send + Sync + 'static, BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Send + Sync + 'static,
PF: Environment<B, Error = Error> + Send + Sync + 'static, PF: Environment<B, Error = Error> + Send + Sync + 'static,
PF::Proposer: Proposer< PF::Proposer: Proposer<
B, B,
Error = Error, Error = Error,
Transaction = sp_api::TransactionFor<Client, B>,
ProofRecording = EnableProofRecording, ProofRecording = EnableProofRecording,
Proof = <EnableProofRecording as ProofRecording>::Proof, Proof = <EnableProofRecording as ProofRecording>::Proof,
>, >,
@@ -51,8 +51,8 @@ pub struct VerifyNothing;
impl<Block: BlockT> Verifier<Block> for VerifyNothing { impl<Block: BlockT> Verifier<Block> for VerifyNothing {
async fn verify( async fn verify(
&mut self, &mut self,
params: BlockImportParams<Block, ()>, params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block, ()>, String> { ) -> Result<BlockImportParams<Block>, String> {
Ok(params) Ok(params)
} }
} }
@@ -64,14 +64,13 @@ pub fn verify_nothing_import_queue<Block: BlockT, I>(
block_import: I, block_import: I,
spawner: &impl sp_core::traits::SpawnEssentialNamed, spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>, registry: Option<&substrate_prometheus_endpoint::Registry>,
) -> BasicQueue<Block, I::Transaction> ) -> BasicQueue<Block>
where where
I: BlockImport<Block, Error = ConsensusError> I: BlockImport<Block, Error = ConsensusError>
+ ParachainBlockImportMarker + ParachainBlockImportMarker
+ Send + Send
+ Sync + Sync
+ 'static, + 'static,
I::Transaction: Send,
{ {
BasicQueue::new(VerifyNothing, Box::new(block_import), None, spawner, registry) BasicQueue::new(VerifyNothing, Box::new(block_import), None, spawner, registry)
} }
+1 -2
View File
@@ -143,7 +143,6 @@ where
BE: Backend<Block>, BE: Backend<Block>,
{ {
type Error = BI::Error; type Error = BI::Error;
type Transaction = BI::Transaction;
async fn check_block( async fn check_block(
&mut self, &mut self,
@@ -154,7 +153,7 @@ where
async fn import_block( async fn import_block(
&mut self, &mut self,
mut params: sc_consensus::BlockImportParams<Block, Self::Transaction>, mut params: sc_consensus::BlockImportParams<Block>,
) -> Result<sc_consensus::ImportResult, Self::Error> { ) -> Result<sc_consensus::ImportResult, Self::Error> {
// Blocks are stored within the backend by using POST hash. // Blocks are stored within the backend by using POST hash.
let hash = params.post_hash(); let hash = params.post_hash();
+3 -8
View File
@@ -50,14 +50,11 @@ impl Error {
/// A type alias for easily referring to the type of a proposal produced by a specific /// A type alias for easily referring to the type of a proposal produced by a specific
/// [`Proposer`]. /// [`Proposer`].
pub type ProposalOf<B, T> = Proposal<B, <T as ProposerInterface<B>>::Transaction, StorageProof>; pub type ProposalOf<B> = Proposal<B, StorageProof>;
/// An interface for proposers. /// An interface for proposers.
#[async_trait] #[async_trait]
pub trait ProposerInterface<Block: BlockT> { pub trait ProposerInterface<Block: BlockT> {
/// The underlying DB transaction type produced with the block proposal.
type Transaction: Default + Send + 'static;
/// Propose a collation using the supplied `InherentData` and the provided /// Propose a collation using the supplied `InherentData` and the provided
/// `ParachainInherentData`. /// `ParachainInherentData`.
/// ///
@@ -79,7 +76,7 @@ pub trait ProposerInterface<Block: BlockT> {
inherent_digests: Digest, inherent_digests: Digest,
max_duration: Duration, max_duration: Duration,
block_size_limit: Option<usize>, block_size_limit: Option<usize>,
) -> Result<Proposal<Block, Self::Transaction, StorageProof>, Error>; ) -> Result<Proposal<Block, StorageProof>, Error>;
} }
/// A simple wrapper around a Substrate proposer for creating collations. /// A simple wrapper around a Substrate proposer for creating collations.
@@ -104,8 +101,6 @@ where
T::Proposer: SubstrateProposer<B, ProofRecording = EnableProofRecording, Proof = StorageProof>, T::Proposer: SubstrateProposer<B, ProofRecording = EnableProofRecording, Proof = StorageProof>,
<T::Proposer as SubstrateProposer<B>>::Error: Send + Sync + 'static, <T::Proposer as SubstrateProposer<B>>::Error: Send + Sync + 'static,
{ {
type Transaction = <<T as Environment<B>>::Proposer as SubstrateProposer<B>>::Transaction;
async fn propose( async fn propose(
&mut self, &mut self,
parent_header: &B::Header, parent_header: &B::Header,
@@ -114,7 +109,7 @@ where
inherent_digests: Digest, inherent_digests: Digest,
max_duration: Duration, max_duration: Duration,
block_size_limit: Option<usize>, block_size_limit: Option<usize>,
) -> Result<Proposal<B, Self::Transaction, StorageProof>, Error> { ) -> Result<Proposal<B, StorageProof>, Error> {
let proposer = self let proposer = self
.inner .inner
.init(parent_header) .init(parent_header)
@@ -53,8 +53,8 @@ where
{ {
async fn verify( async fn verify(
&mut self, &mut self,
mut block_params: BlockImportParams<Block, ()>, mut block_params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block, ()>, String> { ) -> Result<BlockImportParams<Block>, String> {
// Skip checks that include execution, if being told so, or when importing only state. // Skip checks that include execution, if being told so, or when importing only state.
// //
// This is done for example when gap syncing and it is expected that the block after the gap // This is done for example when gap syncing and it is expected that the block after the gap
@@ -112,14 +112,13 @@ pub fn import_queue<Client, Block: BlockT, I, CIDP>(
create_inherent_data_providers: CIDP, create_inherent_data_providers: CIDP,
spawner: &impl sp_core::traits::SpawnEssentialNamed, spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>, registry: Option<&substrate_prometheus_endpoint::Registry>,
) -> ClientResult<BasicQueue<Block, I::Transaction>> ) -> ClientResult<BasicQueue<Block>>
where where
I: BlockImport<Block, Error = ConsensusError> I: BlockImport<Block, Error = ConsensusError>
+ ParachainBlockImportMarker + ParachainBlockImportMarker
+ Send + Send
+ Sync + Sync
+ 'static, + 'static,
I::Transaction: Send,
Client: ProvideRuntimeApi<Block> + Send + Sync + 'static, Client: ProvideRuntimeApi<Block> + Send + Sync + 'static,
<Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block>, <Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block>,
CIDP: CreateInherentDataProviders<Block, ()> + 'static, CIDP: CreateInherentDataProviders<Block, ()> + 'static,
@@ -150,7 +150,6 @@ where
PF: Environment<B> + Send + Sync, PF: Environment<B> + Send + Sync,
PF::Proposer: Proposer< PF::Proposer: Proposer<
B, B,
Transaction = BI::Transaction,
ProofRecording = EnableProofRecording, ProofRecording = EnableProofRecording,
Proof = <EnableProofRecording as ProofRecording>::Proof, Proof = <EnableProofRecording as ProofRecording>::Proof,
>, >,
@@ -239,7 +238,6 @@ where
PF: Environment<Block> + Send + Sync + 'static, PF: Environment<Block> + Send + Sync + 'static,
PF::Proposer: Proposer< PF::Proposer: Proposer<
Block, Block,
Transaction = BI::Transaction,
ProofRecording = EnableProofRecording, ProofRecording = EnableProofRecording,
Proof = <EnableProofRecording as ProofRecording>::Proof, Proof = <EnableProofRecording as ProofRecording>::Proof,
>, >,
@@ -269,8 +269,7 @@ fn run_with_externalities<B: BlockT, R, F: FnOnce() -> R>(
execute: F, execute: F,
) -> R { ) -> R {
let mut overlay = sp_state_machine::OverlayedChanges::default(); let mut overlay = sp_state_machine::OverlayedChanges::default();
let mut cache = Default::default(); let mut ext = Ext::<B>::new(&mut overlay, backend);
let mut ext = Ext::<B>::new(&mut overlay, &mut cache, backend);
set_and_run_with_externalities(&mut ext, || execute()) set_and_run_with_externalities(&mut ext, || execute())
} }
@@ -68,7 +68,7 @@ pub fn new_partial(
ParachainClient, ParachainClient,
ParachainBackend, ParachainBackend,
(), (),
sc_consensus::DefaultImportQueue<Block, ParachainClient>, sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, ParachainClient>, sc_transaction_pool::FullPool<Block, ParachainClient>,
(ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>), (ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>),
>, >,
@@ -341,7 +341,7 @@ fn build_import_queue(
config: &Configuration, config: &Configuration,
telemetry: Option<TelemetryHandle>, telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager, task_manager: &TaskManager,
) -> Result<sc_consensus::DefaultImportQueue<Block, ParachainClient>, sc_service::Error> { ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error> {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
cumulus_client_consensus_aura::import_queue::< cumulus_client_consensus_aura::import_queue::<
+28 -73
View File
@@ -50,10 +50,7 @@ use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerH
use sp_api::{ApiExt, ConstructRuntimeApi}; use sp_api::{ApiExt, ConstructRuntimeApi};
use sp_consensus_aura::AuraApi; use sp_consensus_aura::AuraApi;
use sp_keystore::KeystorePtr; use sp_keystore::KeystorePtr;
use sp_runtime::{ use sp_runtime::{app_crypto::AppCrypto, traits::Header as HeaderT};
app_crypto::AppCrypto,
traits::{BlakeTwo256, Header as HeaderT},
};
use std::{marker::PhantomData, sync::Arc, time::Duration}; use std::{marker::PhantomData, sync::Arc, time::Duration};
use substrate_prometheus_endpoint::Registry; use substrate_prometheus_endpoint::Registry;
@@ -233,7 +230,7 @@ pub fn new_partial<RuntimeApi, BIQ>(
ParachainClient<RuntimeApi>, ParachainClient<RuntimeApi>,
ParachainBackend, ParachainBackend,
(), (),
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>, sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>, sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>,
(ParachainBlockImport<RuntimeApi>, Option<Telemetry>, Option<TelemetryWorkerHandle>), (ParachainBlockImport<RuntimeApi>, Option<Telemetry>, Option<TelemetryWorkerHandle>),
>, >,
@@ -244,22 +241,16 @@ where
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block>, + sp_block_builder::BlockBuilder<Block>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
BIQ: FnOnce( BIQ: FnOnce(
Arc<ParachainClient<RuntimeApi>>, Arc<ParachainClient<RuntimeApi>>,
ParachainBlockImport<RuntimeApi>, ParachainBlockImport<RuntimeApi>,
&Configuration, &Configuration,
Option<TelemetryHandle>, Option<TelemetryHandle>,
&TaskManager, &TaskManager,
) -> Result< ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>,
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
sc_service::Error,
>,
{ {
let telemetry = config let telemetry = config
.telemetry_endpoints .telemetry_endpoints
@@ -349,13 +340,10 @@ where
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block> + sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block>, + cumulus_primitives_core::CollectCollationInfo<Block>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error> RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
+ 'static, + 'static,
BIQ: FnOnce( BIQ: FnOnce(
@@ -364,10 +352,7 @@ where
&Configuration, &Configuration,
Option<TelemetryHandle>, Option<TelemetryHandle>,
&TaskManager, &TaskManager,
) -> Result< ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>,
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
sc_service::Error,
>,
BIC: FnOnce( BIC: FnOnce(
Arc<ParachainClient<RuntimeApi>>, Arc<ParachainClient<RuntimeApi>>,
ParachainBlockImport<RuntimeApi>, ParachainBlockImport<RuntimeApi>,
@@ -540,15 +525,12 @@ where
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block> + sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block> + cumulus_primitives_core::CollectCollationInfo<Block>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance> + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>, + frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>, RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>,
BIQ: FnOnce( BIQ: FnOnce(
Arc<ParachainClient<RuntimeApi>>, Arc<ParachainClient<RuntimeApi>>,
@@ -556,10 +538,7 @@ where
&Configuration, &Configuration,
Option<TelemetryHandle>, Option<TelemetryHandle>,
&TaskManager, &TaskManager,
) -> Result< ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>,
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
sc_service::Error,
>,
BIC: FnOnce( BIC: FnOnce(
Arc<ParachainClient<RuntimeApi>>, Arc<ParachainClient<RuntimeApi>>,
ParachainBlockImport<RuntimeApi>, ParachainBlockImport<RuntimeApi>,
@@ -731,10 +710,7 @@ pub fn rococo_parachain_build_import_queue(
config: &Configuration, config: &Configuration,
telemetry: Option<TelemetryHandle>, telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager, task_manager: &TaskManager,
) -> Result< ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error> {
sc_consensus::DefaultImportQueue<Block, ParachainClient<rococo_parachain_runtime::RuntimeApi>>,
sc_service::Error,
> {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
cumulus_client_consensus_aura::import_queue::< cumulus_client_consensus_aura::import_queue::<
@@ -862,18 +838,15 @@ pub fn shell_build_import_queue<RuntimeApi>(
config: &Configuration, config: &Configuration,
_: Option<TelemetryHandle>, _: Option<TelemetryHandle>,
task_manager: &TaskManager, task_manager: &TaskManager,
) -> Result<sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>, sc_service::Error> ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>
where where
RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static, RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block>, + sp_block_builder::BlockBuilder<Block>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
{ {
cumulus_client_consensus_relay_chain::import_queue( cumulus_client_consensus_relay_chain::import_queue(
client, client,
@@ -898,13 +871,10 @@ where
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block> + sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block>, + cumulus_primitives_core::CollectCollationInfo<Block>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
{ {
start_shell_node_impl::<RuntimeApi, _, _, _>( start_shell_node_impl::<RuntimeApi, _, _, _>(
parachain_config, parachain_config,
@@ -1052,8 +1022,8 @@ where
{ {
async fn verify( async fn verify(
&mut self, &mut self,
block_import: BlockImportParams<Block, ()>, block_import: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block, ()>, String> { ) -> Result<BlockImportParams<Block>, String> {
if self if self
.client .client
.runtime_api() .runtime_api()
@@ -1074,19 +1044,16 @@ pub fn aura_build_import_queue<RuntimeApi, AuraId: AppCrypto>(
config: &Configuration, config: &Configuration,
telemetry_handle: Option<TelemetryHandle>, telemetry_handle: Option<TelemetryHandle>,
task_manager: &TaskManager, task_manager: &TaskManager,
) -> Result<sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>, sc_service::Error> ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>
where where
RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static, RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block> + sp_block_builder::BlockBuilder<Block>
+ sp_consensus_aura::AuraApi<Block, <<AuraId as AppCrypto>::Pair as Pair>::Public>, + sp_consensus_aura::AuraApi<Block, <<AuraId as AppCrypto>::Pair as Pair>::Public>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
<<AuraId as AppCrypto>::Pair as Pair>::Signature: <<AuraId as AppCrypto>::Pair as Pair>::Signature:
TryFrom<Vec<u8>> + std::hash::Hash + sp_runtime::traits::Member + Codec, TryFrom<Vec<u8>> + std::hash::Hash + sp_runtime::traits::Member + Codec,
{ {
@@ -1146,16 +1113,13 @@ where
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block> + sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block> + cumulus_primitives_core::CollectCollationInfo<Block>
+ sp_consensus_aura::AuraApi<Block, <<AuraId as AppCrypto>::Pair as Pair>::Public> + sp_consensus_aura::AuraApi<Block, <<AuraId as AppCrypto>::Pair as Pair>::Public>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance> + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>, + frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
<<AuraId as AppCrypto>::Pair as Pair>::Signature: <<AuraId as AppCrypto>::Pair as Pair>::Signature:
TryFrom<Vec<u8>> + std::hash::Hash + sp_runtime::traits::Member + Codec, TryFrom<Vec<u8>> + std::hash::Hash + sp_runtime::traits::Member + Codec,
{ {
@@ -1314,15 +1278,12 @@ where
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block> + sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block> + sp_session::SessionKeys<Block>
+ sp_api::ApiExt< + sp_api::ApiExt<Block>
Block, + sp_offchain::OffchainWorkerApi<Block>
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block> + sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block> + cumulus_primitives_core::CollectCollationInfo<Block>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance> + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>, + frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>, RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>,
BIQ: FnOnce( BIQ: FnOnce(
Arc<ParachainClient<RuntimeApi>>, Arc<ParachainClient<RuntimeApi>>,
@@ -1330,10 +1291,7 @@ where
&Configuration, &Configuration,
Option<TelemetryHandle>, Option<TelemetryHandle>,
&TaskManager, &TaskManager,
) -> Result< ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>,
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
sc_service::Error,
>,
BIC: FnOnce( BIC: FnOnce(
Arc<ParachainClient<RuntimeApi>>, Arc<ParachainClient<RuntimeApi>>,
ParachainBlockImport<RuntimeApi>, ParachainBlockImport<RuntimeApi>,
@@ -1504,10 +1462,7 @@ pub fn contracts_rococo_build_import_queue(
config: &Configuration, config: &Configuration,
telemetry: Option<TelemetryHandle>, telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager, task_manager: &TaskManager,
) -> Result< ) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error> {
sc_consensus::DefaultImportQueue<Block, ParachainClient<contracts_rococo_runtime::RuntimeApi>>,
sc_service::Error,
> {
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
cumulus_client_consensus_aura::import_queue::< cumulus_client_consensus_aura::import_queue::<
@@ -10,6 +10,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
# Substrate # Substrate
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-state-machine = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
# Polkadot # Polkadot
@@ -24,6 +25,7 @@ std = [
"codec/std", "codec/std",
"sp-runtime/std", "sp-runtime/std",
"sp-state-machine/std", "sp-state-machine/std",
"sp-trie/std",
"sp-std/std", "sp-std/std",
"cumulus-primitives-core/std", "cumulus-primitives-core/std",
] ]
+3 -2
View File
@@ -19,8 +19,8 @@ use cumulus_primitives_core::{
}; };
use polkadot_primitives::UpgradeGoAhead; use polkadot_primitives::UpgradeGoAhead;
use sp_runtime::traits::HashingFor; use sp_runtime::traits::HashingFor;
use sp_state_machine::MemoryDB;
use sp_std::collections::btree_map::BTreeMap; use sp_std::collections::btree_map::BTreeMap;
use sp_trie::PrefixedMemoryDB;
/// Builds a sproof (portmanteau of 'spoof' and 'proof') of the relay chain state. /// Builds a sproof (portmanteau of 'spoof' and 'proof') of the relay chain state.
#[derive(Clone)] #[derive(Clone)]
@@ -105,7 +105,8 @@ impl RelayStateSproofBuilder {
pub fn into_state_root_and_proof( pub fn into_state_root_and_proof(
self, self,
) -> (polkadot_primitives::Hash, sp_state_machine::StorageProof) { ) -> (polkadot_primitives::Hash, sp_state_machine::StorageProof) {
let (db, root) = MemoryDB::<HashingFor<polkadot_primitives::Block>>::default_with_root(); let (db, root) =
PrefixedMemoryDB::<HashingFor<polkadot_primitives::Block>>::default_with_root();
let state_version = Default::default(); // for test using default. let state_version = Default::default(); // for test using default.
let mut backend = sp_state_machine::TrieBackendBuilder::new(db, root).build(); let mut backend = sp_state_machine::TrieBackendBuilder::new(db, root).build();
-1
View File
@@ -46,7 +46,6 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", default-features
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
+2 -3
View File
@@ -72,9 +72,8 @@ use sp_arithmetic::traits::SaturatedConversion;
use sp_blockchain::HeaderBackend; use sp_blockchain::HeaderBackend;
use sp_core::{Pair, H256}; use sp_core::{Pair, H256};
use sp_keyring::Sr25519Keyring; use sp_keyring::Sr25519Keyring;
use sp_runtime::{codec::Encode, generic, traits::BlakeTwo256}; use sp_runtime::{codec::Encode, generic};
use sp_state_machine::BasicExternalities; use sp_state_machine::BasicExternalities;
use sp_trie::PrefixedMemoryDB;
use std::sync::Arc; use std::sync::Arc;
use substrate_test_client::{ use substrate_test_client::{
BlockchainEventsExt, RpcHandlersExt, RpcTransactionError, RpcTransactionOutput, BlockchainEventsExt, RpcHandlersExt, RpcTransactionError, RpcTransactionOutput,
@@ -183,7 +182,7 @@ pub fn new_partial(
Client, Client,
Backend, Backend,
(), (),
sc_consensus::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>, sc_consensus::import_queue::BasicQueue<Block>,
sc_transaction_pool::FullPool<Block, Client>, sc_transaction_pool::FullPool<Block, Client>,
ParachainBlockImport, ParachainBlockImport,
>, >,