Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Forward storage changes in manual seal #7614

Merged
merged 1 commit into from
Nov 27, 2020
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
10 changes: 5 additions & 5 deletions client/consensus/manual-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ pub async fn run_manual_seal<B, BI, CB, E, C, A, SC, CS>(
C: HeaderBackend<B> + Finalizer<B, CB> + ProvideRuntimeApi<B> + 'static,
CB: ClientBackend<B> + 'static,
E: Environment<B> + 'static,
E::Error: std::fmt::Display,
<E::Proposer as Proposer<B>>::Error: std::fmt::Display,
E::Proposer: Proposer<B, Transaction = TransactionFor<C, B>>,
CS: Stream<Item=EngineCommand<<B as BlockT>::Hash>> + Unpin + 'static,
SC: SelectChain<B> + 'static,
TransactionFor<C, B>: 'static,
{
while let Some(command) = commands_stream.next().await {
match command {
Expand Down Expand Up @@ -230,9 +230,9 @@ pub async fn run_instant_seal<B, BI, CB, E, C, A, SC>(
C: HeaderBackend<B> + Finalizer<B, CB> + ProvideRuntimeApi<B> + 'static,
CB: ClientBackend<B> + 'static,
E: Environment<B> + 'static,
E::Error: std::fmt::Display,
<E::Proposer as Proposer<B>>::Error: std::fmt::Display,
SC: SelectChain<B> + 'static
E::Proposer: Proposer<B, Transaction = TransactionFor<C, B>>,
SC: SelectChain<B> + 'static,
TransactionFor<C, B>: 'static,
{
// instant-seal creates blocks as soon as transactions are imported
// into the transaction pool.
Expand Down
9 changes: 5 additions & 4 deletions client/consensus/manual-seal/src/seal_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ pub async fn seal_block<B, BI, SC, C, E, P>(
+ Send + Sync + 'static,
C: HeaderBackend<B> + ProvideRuntimeApi<B>,
E: Environment<B>,
<E as Environment<B>>::Error: std::fmt::Display,
<E::Proposer as Proposer<B>>::Error: std::fmt::Display,
E::Proposer: Proposer<B, Transaction = TransactionFor<C, B>>,
P: txpool::ChainApi<Block=B>,
SC: SelectChain<B>,
TransactionFor<C, B>: 'static,
{
let future = async {
if pool.validated_pool().status().ready == 0 && !create_empty {
Expand All @@ -111,7 +111,7 @@ pub async fn seal_block<B, BI, SC, C, E, P>(
};

let proposer = env.init(&parent)
.map_err(|err| Error::StringError(format!("{}", err))).await?;
.map_err(|err| Error::StringError(format!("{:?}", err))).await?;
let id = inherent_data_provider.create_inherent_data()?;
let inherents_len = id.len();

Expand All @@ -122,7 +122,7 @@ pub async fn seal_block<B, BI, SC, C, E, P>(
};

let proposal = proposer.propose(id.clone(), digest, Duration::from_secs(MAX_PROPOSAL_DURATION), false.into())
.map_err(|err| Error::StringError(format!("{}", err))).await?;
.map_err(|err| Error::StringError(format!("{:?}", err))).await?;

if proposal.block.extrinsics().len() == inherents_len && !create_empty {
return Err(Error::EmptyTransactionPool)
Expand All @@ -133,6 +133,7 @@ pub async fn seal_block<B, BI, SC, C, E, P>(
params.body = Some(body);
params.finalized = finalize;
params.fork_choice = Some(ForkChoiceStrategy::LongestChain);
params.storage_changes = Some(proposal.storage_changes);

if let Some(digest_provider) = digest_provider {
digest_provider.append_block_import(&parent, &mut params, &id)?;
Expand Down