-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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, eth: split eth package, implement snap protocol #21482
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
bf0737b
core, eth: split eth package, implement snap protocol
karalabe dd2702e
eth/protocols/snap: fix code prefix rebase issue
karalabe ddd0355
eth/protocols/snap: fix bloom omission that caused large heal
karalabe 2cb2456
trie: fix non-consensus trie node encoding for snap healer
karalabe 0de21cf
eth/protocols/eth: discard instead of terminate broadcasts
karalabe bbab4db
core, eth, tests: minor review fixups
karalabe 6e2f62f
eth/protocols/eth: added td length check (#38)
MariusVanDerWijden 50c7673
eth: rewrite handlers to operate on packets, not callbacks
karalabe a5259e5
eth/downloader: I love you too, linter..
karalabe 59bb559
graphql: drop protocolVersion field, doesn't make sense
karalabe 7ac8cb5
eth/protocols/eth/handler: enforce lookup limits (#36)
holiman 0e94a23
eth/downloader: fix log panic, drop eth/63 tesst
karalabe 1aae587
tests/fuzzers: add trie rangeproof fuzzer (#37)
holiman 30bc602
trie: fix the missing trie/db returns from empty range proofs
karalabe fc98b4b
trie, eth/protocols/snap: notarize proof usage
holiman 74c49e6
eth/protocols/snap, trie: use needed proof nodes only in bounds
karalabe f769329
eth/downloader: fix tests to use eth/65
karalabe a18ab30
eth, trie: polish some messages + lintfix
holiman 9828b95
flags: enable --snapshot on snapsync
holiman 5f0932a
les: fix les to use eth64 instead of 63
holiman b606651
cmd/utils: enable snap dns discovery
holiman f68c4fe
eth: fix typo
holiman 700f41f
Merge branch 'master' into snapshot-sync-b
holiman 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 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 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 |
---|---|---|
|
@@ -187,7 +187,7 @@ var ( | |
defaultSyncMode = eth.DefaultConfig.SyncMode | ||
SyncModeFlag = TextMarshalerFlag{ | ||
Name: "syncmode", | ||
Usage: `Blockchain sync mode ("fast", "full", or "light")`, | ||
Usage: `Blockchain sync mode ("fast", "full", "snap" or "light")`, | ||
Value: &defaultSyncMode, | ||
} | ||
GCModeFlag = cli.StringFlag{ | ||
|
@@ -1555,8 +1555,14 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { | |
cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100 | ||
} | ||
if !ctx.GlobalIsSet(SnapshotFlag.Name) { | ||
cfg.TrieCleanCache += cfg.SnapshotCache | ||
cfg.SnapshotCache = 0 // Disabled | ||
// If snap-sync is requested, this flag is also required | ||
if cfg.SyncMode == downloader.SnapSync { | ||
log.Info("Snap sync requested, enabling --snapshot") | ||
ctx.Set(SnapshotFlag.Name, "true") | ||
} else { | ||
cfg.TrieCleanCache += cfg.SnapshotCache | ||
cfg.SnapshotCache = 0 // Disabled | ||
} | ||
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. if !ctx.GlobalIsSet(SnapshotFlag.Name) && cfg.SyncMode != downloader.SnapSync {
cfg.TrieCleanCache += cfg.SnapshotCache
cfg.SnapshotCache = 0 // Disabled
} |
||
} | ||
if ctx.GlobalIsSet(DocRootFlag.Name) { | ||
cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name) | ||
|
@@ -1585,16 +1591,15 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { | |
cfg.RPCTxFeeCap = ctx.GlobalFloat64(RPCGlobalTxFeeCapFlag.Name) | ||
} | ||
if ctx.GlobalIsSet(NoDiscoverFlag.Name) { | ||
cfg.DiscoveryURLs = []string{} | ||
cfg.EthDiscoveryURLs, cfg.SnapDiscoveryURLs = []string{}, []string{} | ||
} else if ctx.GlobalIsSet(DNSDiscoveryFlag.Name) { | ||
urls := ctx.GlobalString(DNSDiscoveryFlag.Name) | ||
if urls == "" { | ||
cfg.DiscoveryURLs = []string{} | ||
cfg.EthDiscoveryURLs = []string{} | ||
} else { | ||
cfg.DiscoveryURLs = SplitAndTrim(urls) | ||
cfg.EthDiscoveryURLs = SplitAndTrim(urls) | ||
} | ||
} | ||
|
||
// Override any default configs for hard coded networks. | ||
switch { | ||
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name): | ||
|
@@ -1676,16 +1681,20 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { | |
// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if | ||
// no URLs are set. | ||
func SetDNSDiscoveryDefaults(cfg *eth.Config, genesis common.Hash) { | ||
if cfg.DiscoveryURLs != nil { | ||
if cfg.EthDiscoveryURLs != nil { | ||
return // already set through flags/config | ||
} | ||
|
||
protocol := "all" | ||
if cfg.SyncMode == downloader.LightSync { | ||
protocol = "les" | ||
} | ||
if url := params.KnownDNSNetwork(genesis, protocol); url != "" { | ||
cfg.DiscoveryURLs = []string{url} | ||
cfg.EthDiscoveryURLs = []string{url} | ||
} | ||
if cfg.SyncMode == downloader.SnapSync { | ||
if url := params.KnownDNSNetwork(genesis, "snap"); url != "" { | ||
cfg.SnapDiscoveryURLs = []string{url} | ||
} | ||
} | ||
} | ||
|
||
|
This file contains 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 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 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 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 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 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 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 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 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.
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.
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.
This line is a noop.