Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fork): set block blob_excess_gas_and_price only if excess_blob_gas header is Some #9298

Merged
merged 1 commit into from
Nov 11, 2024
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
5 changes: 3 additions & 2 deletions crates/evm/core/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1922,8 +1922,9 @@ fn update_env_block<T>(env: &mut Env, block: &Block<T>) {
env.block.basefee = U256::from(block.header.base_fee_per_gas.unwrap_or_default());
env.block.gas_limit = U256::from(block.header.gas_limit);
env.block.number = U256::from(block.header.number);
env.block.blob_excess_gas_and_price =
block.header.excess_blob_gas.map(BlobExcessGasAndPrice::new);
if let Some(excess_blob_gas) = block.header.excess_blob_gas {
env.block.blob_excess_gas_and_price = Some(BlobExcessGasAndPrice::new(excess_blob_gas));
}
}

/// Executes the given transaction and commits state changes to the database _and_ the journaled
Expand Down
23 changes: 23 additions & 0 deletions crates/forge/tests/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2616,3 +2616,26 @@ forgetest_async!(can_get_broadcast_txs, |prj, cmd| {

cmd.forge_fuse().args(["test", "--mc", "GetBroadcastTest", "-vvv"]).assert_success();
});

// See <https://github.com/foundry-rs/foundry/issues/9297>
forgetest_init!(test_roll_scroll_fork_with_cancun, |prj, cmd| {
prj.add_test(
"ScrollForkTest.t.sol",
r#"

import {Test} from "forge-std/Test.sol";

contract ScrollForkTest is Test {
function test_roll_scroll_fork_to_tx() public {
vm.createSelectFork("https://scroll-mainnet.chainstacklabs.com/");
bytes32 targetTxHash = 0xf94774a1f69bba76892141190293ffe85dd8d9ac90a0a2e2b114b8c65764014c;
vm.rollFork(targetTxHash);
}
}
"#,
)
.unwrap();

cmd.args(["test", "--mt", "test_roll_scroll_fork_to_tx", "--evm-version", "cancun"])
.assert_success();
});
Loading