Skip to content

Conversation

fubhy
Copy link
Contributor

@fubhy fubhy commented Aug 25, 2025

Motivation

Anvil block production should be deterministic to allow for more convenient integration testing on top of anvil.

Solution

Avoid using a random value for prevandao.

PR Checklist

  • Added Tests

Fixes #9570

@zerosnacks zerosnacks added the T-likely-breaking Type: requires changes that can be breaking label Aug 25, 2025
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

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

This makes sense to me

Adding label to mark this as a breaking change as users may expect to have been able to use prevrandao as a randomness beacon and this will no longer be true

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.

ah I see, randao is then derived from the chain

this makes sense to me, this way the hash is still changing and shouldn't cause any issue, because previously this was just fully random

@onbjerg onbjerg added the C-anvil Command: anvil label Aug 25, 2025
@zerosnacks zerosnacks self-requested a review August 25, 2025 12:59
@zerosnacks zerosnacks merged commit 071934a into foundry-rs:master Aug 25, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Aug 25, 2025
MerkleBoy pushed a commit to MerkleBoy/foundry that referenced this pull request Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-anvil Command: anvil T-likely-breaking Type: requires changes that can be breaking

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(anvil): anvil_dumpState is non-deterministic again

5 participants