Skip to content

Commit

Permalink
fix(levm): check if current_excess_blob_gas is None before unwrappi…
Browse files Browse the repository at this point in the history
…ng in ef-test comparison (#2015)

**Motivation**

Currently, running the comparison against REVM fails because we unwrap
`current_excess_blob_gas` even when there's no `blob_gas`

**Description**

Check if `current_excess_blob_gas` is None before unwrapping.

Co-authored-by: Javier Rodríguez Chatruc <49622509+jrchatruc@users.noreply.github.com>
  • Loading branch information
lima-limon-inc and jrchatruc authored Feb 19, 2025
1 parent 0b0173b commit 47d90d5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/ef_tests/state/runner/revm_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ pub fn prepare_revm_for_tx<'state>(
.chain_config()
.map_err(|err| EFTestRunnerError::VMInitializationFailed(err.to_string()))?;

let blob_excess_gas_and_price = if test.env.current_excess_blob_gas.is_none() {
None
} else {
Some(BlobExcessGasAndPrice {
blob_gasprice: 0,
excess_blob_gas: test.env.current_excess_blob_gas.unwrap().as_u64(),
})
};
let block_env = RevmBlockEnv {
number: RevmU256::from_limbs(test.env.current_number.0),
coinbase: RevmAddress(test.env.current_coinbase.0.into()),
Expand All @@ -126,10 +134,7 @@ pub fn prepare_revm_for_tx<'state>(
basefee: RevmU256::from_limbs(test.env.current_base_fee.unwrap_or_default().0),
difficulty: RevmU256::from_limbs(test.env.current_difficulty.0),
prevrandao: test.env.current_random.map(|v| v.0.into()),
blob_excess_gas_and_price: Some(BlobExcessGasAndPrice {
blob_gasprice: 0,
excess_blob_gas: test.env.current_excess_blob_gas.unwrap().as_u64(),
}),
blob_excess_gas_and_price,
};
let tx = &test
.transactions
Expand Down

0 comments on commit 47d90d5

Please sign in to comment.