forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 72
fix(cicd,cmd,consensus/XDPoS,eth): fix fast sync #2272
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c5c0950
feat: try to make full sync work. add log in syncState
wgr523 73e04a4
fix: when error getting snapshot, skip the error
wgr523 ae30326
feat(downloader): add configurable pivot block for fast sync
wgr523 446ba17
chore: add fast sync args into docker entry start.sh
wgr523 6cc2043
style: more log about pivot
wgr523 6aa00e2
feat: add FASTSYNC_PIVOT_ROOT, remove unnecessary verify
wgr523 2206e0f
feat: re-add verify header for block after pivot
wgr523 0e306cb
feat(downloader): sync multiple gap pivots during fast sync
wgr523 c48be7b
feat: move gap sync state after pivot sync state
wgr523 182db43
feat: let processHeader wiat for state sync
wgr523 c23c181
feat: add generateSnapshot in downloader for state sync
wgr523 fd6a008
feat: generate snapshot after state sync
wgr523 5158ac4
skip all header full verify during fast sync
wgr523 d8a9883
chore: add fastsync args to devnet start.sh
wgr523 52351b0
fix: statedb function, and better root choice in fast sync
wgr523 fdfeb9f
feat: when fullVerify=false, skip checkSignersOnCheckpoint
wgr523 16f35fd
fix: gen_config.go
wgr523 06dafce
style: clean code comment
wgr523 0f21ff8
feat: add fastsync args in start.sh
wgr523 1c1f905
Update cmd/utils/flags.go or better check on flags
wgr523 57ca2c9
fix: use xdc_sort; better flags
wgr523 be33591
test: add fast sync pivot gap tests
wgr523 47611b7
chore: require all three fastsync pivot params together in cicd start.sh
wgr523 4010320
feat: in fastsync make multiple headers feasible rather than one-by-one
wgr523 25123fa
fix: if configured pivot <= origin, start at origin. fix comment
wgr523 3bd1aca
fix: fix by PR comment
wgr523 a6da06f
fix: validate fastsync pivot flags strictly
wgr523 379902e
style: better v1 verifyheader style, better start.sh
wgr523 e468601
update log title
benjamin202410 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,32 +253,38 @@ func (x *XDPoS_v1) verifyCascadingFields(chain consensus.ChainReader, header *ty | |
| return x.verifySeal(chain, header, parents, fullVerify) | ||
| } | ||
|
|
||
| /* | ||
| BUG: snapshot returns wrong signers sometimes | ||
| when it happens we get the signers list by requesting smart contract | ||
| */ | ||
| // Retrieve the snapshot needed to verify this header and cache it | ||
| snap, err := x.snapshot(chain, number-1, header.ParentHash, parents, nil) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| signers := snap.GetSigners() | ||
| err = x.checkSignersOnCheckpoint(chain, header, signers) | ||
| if err == nil { | ||
| return x.verifySeal(chain, header, parents, fullVerify) | ||
| } | ||
| if fullVerify { | ||
| /* | ||
| BUG: snapshot returns wrong signers sometimes | ||
| when it happens we get the signers list by requesting smart contract | ||
| */ | ||
| // Retrieve the snapshot needed to verify this header and cache it | ||
| snap, err := x.snapshot(chain, number-1, header.ParentHash, parents, nil) | ||
| if err != nil { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add error log |
||
| log.Error("[verifyCascadingFields] Fail to get snapshot", "number", number, "hash", header.ParentHash, "err", err) | ||
| return err | ||
| } | ||
|
|
||
| signers, err = x.getSignersFromContract(chain, header) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| err = x.checkSignersOnCheckpoint(chain, header, signers) | ||
| if err == nil { | ||
| signers := snap.GetSigners() | ||
| err = x.checkSignersOnCheckpoint(chain, header, signers) | ||
| if err == nil { | ||
| return x.verifySeal(chain, header, parents, fullVerify) | ||
| } | ||
|
wgr523 marked this conversation as resolved.
|
||
| log.Debug("[verifyCascadingFields] checkSignersOnCheckpoint failed, fallback to smart contract check", "number", number, "err", err) | ||
| signers, err = x.getSignersFromContract(chain, header) | ||
| if err != nil { | ||
| log.Error("[verifyCascadingFields] Fail to get signers from smart contract", "number", number, "hash", header.Hash(), "err", err) | ||
| return err | ||
|
wgr523 marked this conversation as resolved.
|
||
| } | ||
| err = x.checkSignersOnCheckpoint(chain, header, signers) | ||
| if err != nil { | ||
| log.Error("[verifyCascadingFields] checkSignersOnCheckpoint failed with signers from smart contract", "number", number, "hash", header.Hash(), "err", err) | ||
| return err | ||
| } | ||
|
wgr523 marked this conversation as resolved.
|
||
| return x.verifySeal(chain, header, parents, fullVerify) | ||
| } | ||
|
|
||
| return err | ||
| return x.verifySeal(chain, header, parents, fullVerify) | ||
| } | ||
|
wgr523 marked this conversation as resolved.
|
||
|
|
||
| func (x *XDPoS_v1) checkSignersOnCheckpoint(chain consensus.ChainReader, header *types.Header, signers []common.Address) error { | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.