Skip to content

Commit

Permalink
Merge pull request #124 from bnb-chain/develop
Browse files Browse the repository at this point in the history
fix: bsc snapshot issues (#122)
  • Loading branch information
unclezoro authored Aug 28, 2024
2 parents 78a8dcb + 97d1358 commit 9dc2aae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions crates/blockchain-tree/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,18 @@ impl AppendableChain {
let block = block.unseal();

let state = executor.execute((&block, U256::MAX, ancestor_blocks).into())?;
let BlockExecutionOutput { state, receipts, requests, .. } = state;
let BlockExecutionOutput { state, receipts, requests, gas_used: _, snapshot } = state;
externals
.consensus
.validate_block_post_execution(&block, PostExecutionInput::new(&receipts, &requests))?;

let initial_execution_outcome =
ExecutionOutcome::new(state, receipts.into(), block.number, vec![requests.into()]);
let initial_execution_outcome = ExecutionOutcome::new_with_snapshots(
state,
receipts.into(),
block.number,
vec![requests.into()],
vec![snapshot.unwrap_or_default()],
);

// check state root if the block extends the canonical chain __and__ if state root
// validation was requested.
Expand Down
3 changes: 2 additions & 1 deletion crates/bsc/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,10 @@ where
self.parlia.chain_spec().is_bohr_active_at_timestamp(header.timestamp),
)
.ok_or_else(|| BscBlockExecutionError::ApplySnapshotFailed)?;

cache.put(snap.block_hash, snap.clone());
}

cache.put(snap.block_hash, snap.clone());
Ok(snap)
}

Expand Down
1 change: 1 addition & 0 deletions crates/cli/commands/src/stage/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl Command {
tx.clear::<tables::StorageChangeSets>()?;
tx.clear::<tables::Bytecodes>()?;
tx.clear::<tables::Receipts>()?;
tx.clear::<tables::ParliaSnapshot>()?;
tx.put::<tables::StageCheckpoints>(
StageId::Execution.to_string(),
Default::default(),
Expand Down

0 comments on commit 9dc2aae

Please sign in to comment.