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

Method apply_pre_execution_changes

crates/execution/flashblocks/src/state_builder.rs:176–205  ·  view source on GitHub ↗

Applies EIP-4788, EIP-2935, and Canyon create2 deployer pre-execution changes to the EVM. Must be called once per block, before executing any transactions. This mirrors the `apply_pre_execution_changes` behavior of [`base_common_evm::BaseBlockExecutor`] to ensure that the cached execution results match what the validator computes.

(
        &mut self,
        parent_hash: B256,
        parent_beacon_block_root: Option<B256>,
    )

Source from the content-addressed store, hash-verified

174 /// `apply_pre_execution_changes` behavior of [`base_common_evm::BaseBlockExecutor`] to ensure
175 /// that the cached execution results match what the validator computes.
176 pub fn apply_pre_execution_changes(
177 &mut self,
178 parent_hash: B256,
179 parent_beacon_block_root: Option<B256>,
180 ) -> Result<(), StateProcessorError>
181 where
182 DB: AlloyDatabase + StateDB,
183 ChainSpec: Clone,
184 {
185 let spec = self.receipt_builder.chain_spec();
186 let mut system_caller = SystemCaller::new(spec.clone());
187 system_caller
188 .apply_blockhashes_contract_call(parent_hash, &mut self.evm)
189 .map_err(|e| ExecutionError::EvmEnv(e.to_string()))?;
190 system_caller
191 .apply_beacon_root_contract_call(parent_beacon_block_root, &mut self.evm)
192 .map_err(|e| ExecutionError::EvmEnv(e.to_string()))?;
193
194 ensure_create2_deployer(spec, self.pending_block.timestamp, self.evm.db_mut())
195 .map_err(|e| ExecutionError::EvmEnv(e.to_string()))?;
196
197 // At the Cobalt (EIP-8130) transition, plant a code stub on the code-less
198 // enshrined system accounts (the 2D nonce manager) so the persistent state
199 // the enshrined path writes to them is not reaped by EIP-161 end-of-block
200 // state clearing.
201 ensure_eip8130_system_accounts(spec, self.pending_block.timestamp, self.evm.db_mut())
202 .map_err(|e| ExecutionError::EvmEnv(e.to_string()))?;
203
204 Ok(())
205 }
206
207 /// Builds transaction result from cached receipt and state data.
208 fn execute_with_cached_data(

Calls 5

ensure_create2_deployerFunction · 0.85
db_mutMethod · 0.80
chain_specMethod · 0.45
cloneMethod · 0.45