[SharovBot] fix: preserve stored chain config when genesis hash doesn't match known chain#20367
Merged
yperbasis merged 1 commit intorelease/3.4from Apr 7, 2026
Merged
Conversation
…wn chain
When erigon starts with --networkid 1 but a custom genesis (e.g. Hive EEST
tests), the startup code would detect no genesis file, default chainName to
"mainnet", and overwrite the stored chain config (TTD=0) with mainnet config
(TTD=58750000000000000000000). This caused every forkchoice update to genesis
to return INVALID ("Beacon Chain request before TTD"), failing all 61756 EEST
consume-engine tests.
The fix adds a genesis hash comparison: if the stored genesis hash doesn't
match the known chain spec's genesis hash, the stored config is preserved
instead of being overwritten.
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
Collaborator
|
i run eest no this branch: https://github.com/erigontech/erigon/actions/runs/24062909388 |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression where running with a known chainName (e.g. mainnet) but a custom genesis could overwrite the DB’s stored chain config with the known chain’s config, leading to invalid forkchoice updates (e.g. “before TTD”).
Changes:
- Updates
WriteGenesisBlockto keep the stored chain config whenchainNameis known but the stored genesis hash does not match the known chain spec’s genesis hash. - Keeps stored config for unknown
chainName(existing behavior), while also handling the “known name but custom genesis” case.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AskAlexSharov
approved these changes
Apr 7, 2026
AskAlexSharov
pushed a commit
that referenced
this pull request
Apr 8, 2026
…'t match known chain (#20367) **[SharovBot]** - Fix longstanding Hive EEST `consume-engine` regression where all 61,756 tests fail with `Unexpected status on forkchoice updated to genesis: PayloadStatusEnum.INVALID` - Root cause: when erigon starts with `--networkid 1` but a custom genesis (as in Hive EEST tests), it defaults `chainName` to `"mainnet"` and overwrites the stored chain config (TTD=0) with mainnet config (TTD=58750000000000000000000), causing every forkchoice update to genesis to be rejected as "before TTD" - Fix adds a genesis hash comparison in `WriteGenesisBlock`: if the stored genesis hash doesn't match the known chain spec's genesis hash, the stored config is preserved - [x] `go build ./...` passes - [x] `go test ./execution/state/genesiswrite/...` passes - [x] `go test ./execution/engineapi/...` passes - [ ] Hive EEST `consume-engine` tests should pass (or at least not fail universally with TTD error) Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: root <giulio.rebuffo@gmail.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 10, 2026
## Summary Cherry-pick of release/3.4 PRs: - #20368 rpc: use synctest for TestClientCancelHTTP to fix CI flakiness - #20373 integrity: blk/sec fix - #20372 execution/state: use index-based range over log topics to avoid copy - #20367 fix: preserve stored chain config when genesis hash doesn't match known chain - #20374 ParseVersion: optimize - #20369 batchSize: more precise estimate - #20399 hive: pin more things --------- Co-authored-by: erigon-copilot[bot] <265817861+erigon-copilot[bot]@users.noreply.github.com> Co-authored-by: root <giulio.rebuffo@gmail.com> Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Muzry <muzrry@gmail.com> Co-authored-by: muzry.li <muzry.li1@ambergroup.io> Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Co-authored-by: info@weblogix.biz <admin@10gbps.weblogix.it>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[SharovBot]
Summary
consume-engineregression where all 61,756 tests fail withUnexpected status on forkchoice updated to genesis: PayloadStatusEnum.INVALID--networkid 1but a custom genesis (as in Hive EEST tests), it defaultschainNameto"mainnet"and overwrites the stored chain config (TTD=0) with mainnet config (TTD=58750000000000000000000), causing every forkchoice update to genesis to be rejected as "before TTD"WriteGenesisBlock: if the stored genesis hash doesn't match the known chain spec's genesis hash, the stored config is preservedTest plan
go build ./...passesgo test ./execution/state/genesiswrite/...passesgo test ./execution/engineapi/...passesconsume-enginetests should pass (or at least not fail universally with TTD error)Co-authored-by: Giulio rebuffo giulio.rebuffo@gmail.com
🤖 Generated with Claude Code