-
Notifications
You must be signed in to change notification settings - Fork 20.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core, accounts, eth, trie: handle genesis state missing #28171
Conversation
if err == nil { | ||
h.enableSyncedFeatures() // Mark initial sync done on any fetcher import | ||
} | ||
return n, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The node will only be marked as initialized after the initial sync cycle. There are some behavioral changes in legacy un-merged chain, but it's fine, just do a tiny full-sync instead of a single block fetch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens with empty networks that are just starting up? They can't do any type of sync because there's nothing yet to sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is specifically the fetcher path. Still in that case, what happens if my node never does a sync cycle because it's always in sync and connected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enableSyncedFeatures
will be called if (1) mining
is enabled or (2) we successfully do a forkchoiceUpdate. Basically block producer will be marked as synced to generate blocks and it will trigger other nodes to sync.
1af3bf2
to
4e619ba
Compare
Btw, for the reviewers, https://github.com/ethereum/go-ethereum/blob/master/eth/handler.go#L248 here |
6c1c377
to
b98b30b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* core, accounts, eth, trie: handle genesis state missing * core, eth, trie: polish * core: manage txpool subscription in mainpool * eth/backend: fix test * cmd, eth: fix test * core/rawdb, trie/triedb/pathdb: address comments * eth, trie: address comments * eth: inline the function * eth: use synced flag * core/txpool: revert changes in txpool * core, eth, trie: rename functions
* core, accounts, eth, trie: handle genesis state missing * core, eth, trie: polish * core: manage txpool subscription in mainpool * eth/backend: fix test * cmd, eth: fix test * core/rawdb, trie/triedb/pathdb: address comments * eth, trie: address comments * eth: inline the function * eth: use synced flag * core/txpool: revert changes in txpool * core, eth, trie: rename functions
* core, accounts, eth, trie: handle genesis state missing * core, eth, trie: polish * core: manage txpool subscription in mainpool * eth/backend: fix test * cmd, eth: fix test * core/rawdb, trie/triedb/pathdb: address comments * eth, trie: address comments * eth: inline the function * eth: use synced flag * core/txpool: revert changes in txpool * core, eth, trie: rename functions
* core, accounts, eth, trie: handle genesis state missing * core, eth, trie: polish * core: manage txpool subscription in mainpool * eth/backend: fix test * cmd, eth: fix test * core/rawdb, trie/triedb/pathdb: address comments * eth, trie: address comments * eth: inline the function * eth: use synced flag * core/txpool: revert changes in txpool * core, eth, trie: rename functions
…reum#28171)" This reverts commit bcc2e34.
…reum#28171)" This reverts commit bcc2e34.
core, accounts, eth, trie: handle genesis state missing (ethereum#28171) Conflicts: core/blockchain.go We made many changes in setHeadBeyondRoot. upstream removed assumption that genesis state is always in the db. Accepted both changes
This pull request addresses scenarios where the associated head state is missing.
In the original design, the chain head would never be stateless because the genesis state was always considered present, and we could always rewind the chain back to the genesis block. However, in path mode, the genesis state may have already been overwritten by the state syncer, making recovery impossible.
As a result, it is important to ensure that even when the chain is in a stateless condition, everything continues to function smoothly until the state synchronization process is fully completed.
The lazy initialization is introduces to txpool if the chain is stateless, it's looks a bit ugly, but no idea how to make it elegant.
A few scenarios need to be tested: