Skip to content

refactor(tests): sort refund types for deterministic fixture output#2970

Merged
danceratopz merged 1 commit into
ethereum:forks/amsterdamfrom
gurukamath:deterministic-refund-types-iteration
Jun 10, 2026
Merged

refactor(tests): sort refund types for deterministic fixture output#2970
danceratopz merged 1 commit into
ethereum:forks/amsterdamfrom
gurukamath:deterministic-refund-types-iteration

Conversation

@gurukamath

Copy link
Copy Markdown
Contributor

🗒️ Description

build_refund_tx iterated set(fork.refund_types()), whose order depends on Python's per-process string-hash randomization.

This creates a lot of noise when one is trying to compare two different fill fixtures using hasher compare

✅ Checklist

`build_refund_tx` iterated `set(fork.refund_types())`, whose order
depends on Python's per-process string-hash randomization (no
`PYTHONHASHSEED` is set in this repo). Different `fill` invocations
therefore appended the extra `PUSH0` from the
`AUTHORIZATION_EXISTING_AUTHORITY` branch either before or after the
`STORAGE_CLEAR` SSTOREs, producing two different bytecodes and — via
`contract_address_from_hash` — two different deployment addresses for
the same test, and hence two different pre-state allocations and
state roots.

Sort by enum-member name inside the iteration so the bytecode (and
therefore the contract address) is deterministic across runs.
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.53%. Comparing base (84e39e1) to head (c56d4c5).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2970   +/-   ##
================================================
  Coverage            90.53%   90.53%           
================================================
  Files                  535      535           
  Lines                32897    32897           
  Branches              3021     3021           
================================================
  Hits                 29782    29782           
  Misses                2596     2596           
  Partials               519      519           
Flag Coverage Δ
unittests 90.53% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danceratopz danceratopz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@danceratopz danceratopz added C-refactor Category: refactor A-tests Area: Consensus tests. labels Jun 10, 2026
@danceratopz danceratopz changed the title fix(amsterdam): make refund_types iteration deterministic refactor(tests): sort refund types for deterministic fixture output Jun 10, 2026
@danceratopz

Copy link
Copy Markdown
Member

Went with "refactor" as it's not a fix in client-facing test behavior; it just makes the output deterministically comparable. The test behavior is unchanged.

@danceratopz danceratopz merged commit 505c4a4 into ethereum:forks/amsterdam Jun 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tests Area: Consensus tests. C-refactor Category: refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants