MCPcopy Create free account
hub / github.com/base/base / witness

Method witness

crates/execution/payload/src/builder.rs:428–469  ·  view source on GitHub ↗

Builds the payload and returns its [`ExecutionWitness`] based on the state after execution.

(
        self,
        state_provider: impl StateProvider,
        ctx: &BasePayloadBuilderCtx<Evm, ChainSpec, Attrs>,
    )

Source from the content-addressed store, hash-verified

426
427 /// Builds the payload and returns its [`ExecutionWitness`] based on the state after execution.
428 pub fn witness<Evm, ChainSpec, N, Attrs>(
429 self,
430 state_provider: impl StateProvider,
431 ctx: &BasePayloadBuilderCtx<Evm, ChainSpec, Attrs>,
432 ) -> Result<ExecutionWitness, PayloadBuilderError>
433 where
434 Evm: ConfigureEvm<
435 Primitives = N,
436 NextBlockEnvCtx: BuildNextEnv<Attrs, N::BlockHeader, ChainSpec>,
437 >,
438 ChainSpec: EthChainSpec + Upgrades,
439 N: PayloadPrimitives,
440 Txs: PayloadTransactions<Transaction: PoolTransaction<Consensus = N::SignedTx>>,
441 Attrs: Attributes<Transaction = N::SignedTx>,
442 {
443 let mut db = State::builder()
444 .with_database(StateProviderDatabase::new(&state_provider))
445 .with_bundle_update()
446 .build();
447 let mut builder = ctx.block_builder(&mut db)?;
448
449 builder.apply_pre_execution_changes()?;
450 ctx.execute_sequencer_transactions(&mut builder)?;
451 builder.into_executor().apply_post_execution_changes()?;
452
453 if ctx.chain_spec.is_isthmus_active_at_timestamp(ctx.attributes().timestamp()) {
454 // force load `L2ToL1MessagePasser.sol` so l2 withdrawals root can be computed even if
455 // no l2 withdrawals in block
456 _ = db.load_cache_account(Predeploys::L2_TO_L1_MESSAGE_PASSER)?;
457 }
458
459 let mode = ExecutionWitnessMode::default();
460 let ExecutionWitnessRecord { hashed_state, codes, keys, lowest_block_number: _ } =
461 ExecutionWitnessRecord::from_executed_state(&db, mode);
462 let state = state_provider.witness(Default::default(), hashed_state, mode)?;
463 Ok(ExecutionWitness {
464 state: state.into_iter().collect(),
465 codes,
466 keys,
467 ..Default::default()
468 })
469 }
470}
471
472/// A type that returns the [`PayloadTransactions`] that should be included in the pool.

Callers 3

execute_payloadMethod · 0.45
execution_witnessMethod · 0.45
payload_witnessMethod · 0.45

Calls 8

block_builderMethod · 0.80
into_iterMethod · 0.80
buildMethod · 0.45
timestampMethod · 0.45
attributesMethod · 0.45

Tested by

no test coverage detected