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(anvil): arb fork mining #9153

Merged
merged 7 commits into from
Oct 21, 2024
Merged

fix(anvil): arb fork mining #9153

merged 7 commits into from
Oct 21, 2024

Conversation

yash-atreya
Copy link
Member

Motivation

Closes #9152

Solution

While mining blocks on arbitrum forks set the env.block.number using storage.best_number as env.block.number actually represents l1BlockNumber and not the arbitrum block number.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, can we add a simple test for this?

Comment on lines 2957 to 2964
pub fn is_arbitrum(chain_id: u64) -> bool {
if let Ok(
NamedChain::Arbitrum |
NamedChain::ArbitrumGoerli |
NamedChain::ArbitrumNova |
NamedChain::ArbitrumTestnet,
) = NamedChain::try_from(chain_id)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could upstream this to alloy-chains as well

@yash-atreya yash-atreya enabled auto-merge (squash) October 21, 2024 13:14
@yash-atreya yash-atreya merged commit 1af44bf into master Oct 21, 2024
21 checks passed
@yash-atreya yash-atreya deleted the yash/anvil-arb-mining branch October 21, 2024 13:55
rplusq pushed a commit to rplusq/foundry that referenced this pull request Nov 29, 2024
* fix(`anvil`): use header.number not best_number

* test

* ignore test_arbitrum_fork_block_number

* fix(`anvil`): miner logic for arb-like chains

* clippy

* test
@grandizzy grandizzy added T-bug Type: bug C-anvil Command: anvil labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(anvil): arbitrum and anvil block mining inconsistency
3 participants