Skip to content

[SharovBot] fix: preserve stored chain config when genesis hash doesn't match known chain#20367

Merged
yperbasis merged 1 commit intorelease/3.4from
fix/hive-eest-genesis-config-override
Apr 7, 2026
Merged

[SharovBot] fix: preserve stored chain config when genesis hash doesn't match known chain#20367
yperbasis merged 1 commit intorelease/3.4from
fix/hive-eest-genesis-config-override

Conversation

@erigon-copilot
Copy link
Copy Markdown
Contributor

@erigon-copilot erigon-copilot bot commented Apr 7, 2026

[SharovBot]

Summary

  • 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

Test plan

  • go build ./... passes
  • go test ./execution/state/genesiswrite/... passes
  • 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

…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>
@AskAlexSharov
Copy link
Copy Markdown
Collaborator

i run eest no this branch: https://github.com/erigontech/erigon/actions/runs/24062909388

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 WriteGenesisBlock to keep the stored chain config when chainName is 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.

Comment thread execution/state/genesiswrite/genesis_write.go
Comment thread execution/state/genesiswrite/genesis_write.go
@yperbasis yperbasis merged commit 22f6732 into release/3.4 Apr 7, 2026
28 checks passed
@yperbasis yperbasis deleted the fix/hive-eest-genesis-config-override branch April 7, 2026 09:16
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants