feat: improve randomize_state field coverage for fork transition testing
feat: improve randomize_state field coverage for fork transition testing
Description
- This PR improves the
randomize_statefunction to populate beacon state fields with realistic non-default values during testing. - Currently, when clients forget to copy fields during upgrades, tests don't catch these bugs because 0 == 0 assertions still pass, as demonstrated in the issue description with the Teku client. By using realistic test values, missing field copies now cause test failures
-
randomize_statefield population now extended to all forks
Relations
Fixes #4535
Co-authored by Claude
@jtraglia, do you think it is necessary to populate the fields for previous forks?
@jtraglia, do you think it is necessary to populate the fields for previous forks?
Yes, it would be valuable to do this. Please complete the TODO items you've stated in the functions.
Sorry I just haven't had enough time to properly review your PR. Given that this change will affect lots tests for several forks, it will require a more extensive review. In the mean time, I've started the CI checks for this.
I would like for @leolara to review it too. He's in charge of testing here.
Hi @leolara, what are your thoughts?
@richardgreg the reftests are failing in this branch: https://github.com/ethereum/consensus-specs/actions/runs/18327061427/job/52193981595
@richardgreg let me know if I should try to run the tests again
@richardgreg let me know if I should try to run the tests again
@leolara sure. You can go ahead and do it. My branch is up-to-date and it generates the reftests locally. I'm hoping that will fix any conflict arising in the CI
Trying here: https://github.com/ethereum/consensus-specs/actions/runs/18891974203
@richardgreg the reference tests are failing in this branch, please check the logs there https://github.com/ethereum/consensus-specs/actions/runs/18891974203 and see if you can fix it
https://github.com/ethereum/consensus-specs/actions/runs/18891974203
Right, Leo. I'm investigating it
@leolara In this latest push, Altair now inherits Phase 0's fields. The bug was likely due to BLS signature verification failing. Altair not inheriting Phase 0 fields including randao_mixes most likely contributed to that. It's hard to confirm ref tests pass locally because of the amount of time it takes 😅
So I went quite all in this issue without much external input. From what you've seen so far, what are your thoughts on the fields chosen to be randomized for each fork?