Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
532 changes: 266 additions & 266 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions client/collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,12 @@ mod tests {

// Ensure that we did not include `:code` in the 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>()
.update_backend(*header.state_root(), db);
let backend = sp_state_machine::create_proof_check_backend::<BlakeTwo256>(
*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.
assert!(backend
Expand Down
11 changes: 5 additions & 6 deletions client/consensus/aura/src/collator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ where
RClient: RelayChainInterface,
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static,
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>,
Proposer::Transaction: Sync,
Proposer: ProposerInterface<Block>,
CS: CollatorServiceInterface<Block>,
P: Pair,
P::Public: AppPublic + Member,
Expand Down Expand Up @@ -190,7 +189,7 @@ where
.await
.map_err(|e| Box::new(e))?;

let sealed_importable = seal::<_, _, P>(
let sealed_importable = seal::<_, P>(
proposal.block,
proposal.storage_changes,
&slot_claim.author_pub,
Expand Down Expand Up @@ -322,12 +321,12 @@ where
}

/// 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,
storage_changes: StorageChanges<T, HashingFor<B>>,
storage_changes: StorageChanges<HashingFor<B>>,
author_pub: &P::Public,
keystore: &KeystorePtr,
) -> Result<BlockImportParams<B, T>, Box<dyn Error>>
) -> Result<BlockImportParams<B>, Box<dyn Error>>
where
P: Pair,
P::Signature: Codec + TryFrom<Vec<u8>>,
Expand Down
3 changes: 1 addition & 2 deletions client/consensus/aura/src/collators/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ pub async fn run<Block, P, BI, CIDP, Client, RClient, SO, Proposer, CS>(
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static,
SO: SyncOracle + Send + Sync + Clone + 'static,
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>,
Proposer::Transaction: Sync,
Proposer: ProposerInterface<Block>,
CS: CollatorServiceInterface<Block>,
P: Pair,
P::Public: AppPublic + Member,
Expand Down
3 changes: 1 addition & 2 deletions client/consensus/aura/src/collators/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ pub async fn run<Block, P, BI, CIDP, Client, Backend, RClient, SO, Proposer, CS>
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
BI: BlockImport<Block> + ParachainBlockImportMarker + Send + Sync + 'static,
SO: SyncOracle + Send + Sync + Clone + 'static,
Proposer: ProposerInterface<Block, Transaction = BI::Transaction>,
Proposer::Transaction: Sync,
Proposer: ProposerInterface<Block>,
CS: CollatorServiceInterface<Block>,
P: Pair,
P::Public: AppPublic + Member,
Expand Down
7 changes: 3 additions & 4 deletions client/consensus/aura/src/equivocation_import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ where
{
async fn verify(
&mut self,
mut block_params: BlockImportParams<Block, ()>,
) -> Result<BlockImportParams<Block, ()>, String> {
mut block_params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block>, String> {
// 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
Expand Down Expand Up @@ -221,7 +221,7 @@ pub fn fully_verifying_import_queue<P, Client, Block: BlockT, I, CIDP>(
spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>,
telemetry: Option<TelemetryHandle>,
) -> BasicQueue<Block, I::Transaction>
) -> BasicQueue<Block>
where
P: Pair + 'static,
P::Signature: Codec,
Expand All @@ -231,7 +231,6 @@ where
+ Send
+ Sync
+ 'static,
I::Transaction: Send,
Client: ProvideRuntimeApi<Block> + Send + Sync + 'static,
<Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public>,
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
Expand Down
4 changes: 2 additions & 2 deletions client/consensus/aura/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn import_queue<P, Block, I, C, S, CIDP>(
registry,
telemetry,
}: ImportQueueParams<'_, I, C, CIDP, S>,
) -> Result<DefaultImportQueue<Block, C>, sp_consensus::Error>
) -> Result<DefaultImportQueue<Block>, sp_consensus::Error>
where
Block: BlockT,
C::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public> + ApiExt<Block>,
Expand All @@ -72,7 +72,7 @@ where
+ AuxStore
+ UsageProvider<Block>
+ HeaderBackend<Block>,
I: BlockImport<Block, Error = ConsensusError, Transaction = sp_api::TransactionFor<C, Block>>
I: BlockImport<Block, Error = ConsensusError>
+ ParachainBlockImportMarker
+ Send
+ Sync
Expand Down
7 changes: 1 addition & 6 deletions client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,13 @@ where
Client:
ProvideRuntimeApi<B> + BlockOf + AuxStore + HeaderBackend<B> + Send + Sync + 'static,
Client::Api: AuraApi<B, P::Public>,
BI: BlockImport<B, Transaction = sp_api::TransactionFor<Client, B>>
+ ParachainBlockImportMarker
+ Send
+ Sync
+ 'static,
BI: BlockImport<B> + ParachainBlockImportMarker + Send + Sync + 'static,
SO: SyncOracle + Send + Sync + Clone + 'static,
BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Send + Sync + 'static,
PF: Environment<B, Error = Error> + Send + Sync + 'static,
PF::Proposer: Proposer<
B,
Error = Error,
Transaction = sp_api::TransactionFor<Client, B>,
ProofRecording = EnableProofRecording,
Proof = <EnableProofRecording as ProofRecording>::Proof,
>,
Expand Down
7 changes: 3 additions & 4 deletions client/consensus/common/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub struct VerifyNothing;
impl<Block: BlockT> Verifier<Block> for VerifyNothing {
async fn verify(
&mut self,
params: BlockImportParams<Block, ()>,
) -> Result<BlockImportParams<Block, ()>, String> {
params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block>, String> {
Ok(params)
}
}
Expand All @@ -64,14 +64,13 @@ pub fn verify_nothing_import_queue<Block: BlockT, I>(
block_import: I,
spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>,
) -> BasicQueue<Block, I::Transaction>
) -> BasicQueue<Block>
where
I: BlockImport<Block, Error = ConsensusError>
+ ParachainBlockImportMarker
+ Send
+ Sync
+ 'static,
I::Transaction: Send,
{
BasicQueue::new(VerifyNothing, Box::new(block_import), None, spawner, registry)
}
3 changes: 1 addition & 2 deletions client/consensus/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ where
BE: Backend<Block>,
{
type Error = BI::Error;
type Transaction = BI::Transaction;

async fn check_block(
&mut self,
Expand All @@ -154,7 +153,7 @@ where

async fn import_block(
&mut self,
mut params: sc_consensus::BlockImportParams<Block, Self::Transaction>,
mut params: sc_consensus::BlockImportParams<Block>,
) -> Result<sc_consensus::ImportResult, Self::Error> {
// Blocks are stored within the backend by using POST hash.
let hash = params.post_hash();
Expand Down
11 changes: 3 additions & 8 deletions client/consensus/proposer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,11 @@ impl Error {

/// A type alias for easily referring to the type of a proposal produced by a specific
/// [`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.
#[async_trait]
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
/// `ParachainInherentData`.
///
Expand All @@ -79,7 +76,7 @@ pub trait ProposerInterface<Block: BlockT> {
inherent_digests: Digest,
max_duration: Duration,
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.
Expand All @@ -104,8 +101,6 @@ where
T::Proposer: SubstrateProposer<B, ProofRecording = EnableProofRecording, Proof = StorageProof>,
<T::Proposer as SubstrateProposer<B>>::Error: Send + Sync + 'static,
{
type Transaction = <<T as Environment<B>>::Proposer as SubstrateProposer<B>>::Transaction;

async fn propose(
&mut self,
parent_header: &B::Header,
Expand All @@ -114,7 +109,7 @@ where
inherent_digests: Digest,
max_duration: Duration,
block_size_limit: Option<usize>,
) -> Result<Proposal<B, Self::Transaction, StorageProof>, Error> {
) -> Result<Proposal<B, StorageProof>, Error> {
let proposer = self
.inner
.init(parent_header)
Expand Down
7 changes: 3 additions & 4 deletions client/consensus/relay-chain/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ where
{
async fn verify(
&mut self,
mut block_params: BlockImportParams<Block, ()>,
) -> Result<BlockImportParams<Block, ()>, String> {
mut block_params: BlockImportParams<Block>,
) -> Result<BlockImportParams<Block>, String> {
// 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
Expand Down Expand Up @@ -112,14 +112,13 @@ pub fn import_queue<Client, Block: BlockT, I, CIDP>(
create_inherent_data_providers: CIDP,
spawner: &impl sp_core::traits::SpawnEssentialNamed,
registry: Option<&substrate_prometheus_endpoint::Registry>,
) -> ClientResult<BasicQueue<Block, I::Transaction>>
) -> ClientResult<BasicQueue<Block>>
where
I: BlockImport<Block, Error = ConsensusError>
+ ParachainBlockImportMarker
+ Send
+ Sync
+ 'static,
I::Transaction: Send,
Client: ProvideRuntimeApi<Block> + Send + Sync + 'static,
<Client as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block>,
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
Expand Down
2 changes: 0 additions & 2 deletions client/consensus/relay-chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ where
PF: Environment<B> + Send + Sync,
PF::Proposer: Proposer<
B,
Transaction = BI::Transaction,
ProofRecording = EnableProofRecording,
Proof = <EnableProofRecording as ProofRecording>::Proof,
>,
Expand Down Expand Up @@ -239,7 +238,6 @@ where
PF: Environment<Block> + Send + Sync + 'static,
PF::Proposer: Proposer<
Block,
Transaction = BI::Transaction,
ProofRecording = EnableProofRecording,
Proof = <EnableProofRecording as ProofRecording>::Proof,
>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ fn run_with_externalities<B: BlockT, R, F: FnOnce() -> R>(
execute: F,
) -> R {
let mut overlay = sp_state_machine::OverlayedChanges::default();
let mut cache = Default::default();
let mut ext = Ext::<B>::new(&mut overlay, &mut cache, backend);
let mut ext = Ext::<B>::new(&mut overlay, backend);

set_and_run_with_externalities(&mut ext, || execute())
}
Expand Down
4 changes: 2 additions & 2 deletions parachain-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn new_partial(
ParachainClient,
ParachainBackend,
(),
sc_consensus::DefaultImportQueue<Block, ParachainClient>,
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, ParachainClient>,
(ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>),
>,
Expand Down Expand Up @@ -341,7 +341,7 @@ fn build_import_queue(
config: &Configuration,
telemetry: Option<TelemetryHandle>,
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)?;

cumulus_client_consensus_aura::import_queue::<
Expand Down
Loading