Skip to content

hardfork: fix fork-slot computation for Mesa preforks (fixes #18980)#18987

Open
dkijania wants to merge 2 commits into
release/mesafrom
dkijania/fix-18980-fork-slot
Open

hardfork: fix fork-slot computation for Mesa preforks (fixes #18980)#18987
dkijania wants to merge 2 commits into
release/mesafrom
dkijania/fix-18980-fork-slot

Conversation

@dkijania

Copy link
Copy Markdown
Member

Summary

Fixes #18980. scripts/hardfork/create_runtime_config.sh recomputed proof.fork.global_slot_since_genesis from the wall-clock genesis window divided by a hard-coded 180 s/slot. That is the Berkeley slot time; Mesa runs at 90 s/slot, so a mesa → mesa fork under-counted the slot span by exactly 2× — e.g. it produced 456780 instead of the real 458220.

Fix

Take the fork slot verbatim from the fork config's proof.fork.global_slot_since_genesis — the same authoritative source the script already reads state_hash and blockchain_length from — and drop the wall-clock-to-slots recompute entirely. This removes the slot-time constant that differed between Berkeley (180 s) and Mesa (90 s).

-   global_slot_since_genesis: $genesis_slot      # = prefork_slot + window/180  (wrong for Mesa)
+   global_slot_since_genesis: .proof.fork.global_slot_since_genesis  # authoritative

Test coverage

New buildkite/scripts/tests/hardfork/create-runtime-config-tests.sh (wired into the existing AutoHardforkTest job, which already gates on create_runtime_config.sh). It reproduces the failing-run window (prefork slot 455340, 3-day / 259200 s window, fork config slot 458220) and asserts:

  • the output slot is the fork config's 458220not the 456780 a 180 s/slot recompute would give;
  • the slot is independent of SECONDS_PER_SLOT (180 vs 90), so a reintroduced wall-clock recompute is caught;
  • state_hash / blockchain_length pass through, the genesis timestamp is patched, and ledger hashes come from the hashes file.

Scope

Fixes the fork-slot axis only (per the issue). Independent of the Berkeley→Mesa vesting-conversion defect (#18981) and the automode self-boot crash.

🤖 Generated with Claude Code

…time

create_runtime_config.sh recomputed proof.fork.global_slot_since_genesis
from the wall-clock genesis window divided by a hard-coded 180 s/slot. That
is the Berkeley slot time; Mesa runs at 90 s/slot, so a mesa -> mesa fork
under-counted the slot span by 2x (e.g. 456780 instead of the real 458220).

Take the fork slot verbatim from the fork config's
proof.fork.global_slot_since_genesis -- the same authoritative source the
script already reads state_hash and blockchain_length from -- and drop the
wall-clock-to-slots recompute entirely. This removes the slot-time constant
that differed between Berkeley and Mesa.

Adds buildkite/scripts/tests/hardfork/create-runtime-config-tests.sh, wired
into AutoHardforkTest, which reproduces the #18980 window (prefork slot
455340, 3-day window) and asserts the output slot is the fork config's
458220 -- independent of SECONDS_PER_SLOT, so a reintroduced recompute is
caught.

Fixes #18980.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dkijania

Copy link
Copy Markdown
Member Author

!ci-build-me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

1 participant