mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge branch 'develop' into manav/upstream_merge_v1.14.13
This commit is contained in:
commit
8a834a4f0f
6 changed files with 33 additions and 49 deletions
|
|
@ -13,7 +13,7 @@ ancient = "" # Data directory for ancient chain segments (def
|
|||
keystore = "" # Path of the directory where keystores are located
|
||||
"rpc.batchlimit" = 100 # Maximum number of messages in a batch (default=100, use 0 for no limits)
|
||||
"rpc.returndatalimit" = 100000 # Maximum size (in bytes) a result of an rpc request could have (default=100000, use 0 for no limits)
|
||||
syncmode = "full" # Blockchain sync mode (only "full" sync supported)
|
||||
syncmode = "full" # Blockchain sync mode ("full" or "snap")
|
||||
gcmode = "full" # Blockchain garbage collection mode ("full", "archive")
|
||||
snapshot = true # Enables the snapshot-database mode
|
||||
"bor.logs" = false # Enables bor log retrieval
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```state.scheme```: Scheme to use for storing ethereum state ('hash' or 'path') (default: path)
|
||||
|
||||
- ```syncmode```: Blockchain sync mode (only "full" sync supported) (default: full)
|
||||
- ```syncmode```: Blockchain sync mode ("full" or "snap") (default: full)
|
||||
|
||||
- ```verbosity```: Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (default: 3)
|
||||
|
||||
|
|
|
|||
|
|
@ -173,19 +173,14 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
|||
// * the last snap sync is not finished while user specifies a full sync this
|
||||
// time. But we don't have any recent state for full sync.
|
||||
// In these cases however it's safe to reenable snap sync.
|
||||
|
||||
// TODO - uncomment when we (Polygon-PoS, bor) have snap sync/pbss
|
||||
// fullBlock, snapBlock := h.chain.CurrentBlock(), h.chain.CurrentSnapBlock()
|
||||
|
||||
// TODO - uncomment when we (Polygon-PoS, bor) have snap sync/pbss
|
||||
// For more info - https://github.com/ethereum/go-ethereum/pull/28171
|
||||
// if fullBlock.Number.Uint64() == 0 && snapBlock.Number.Uint64() > 0 {
|
||||
// h.snapSync.Store(true)
|
||||
// log.Warn("Switch sync mode from full sync to snap sync", "reason", "snap sync incomplete")
|
||||
// } else if !h.chain.HasState(fullBlock.Root) {
|
||||
// h.snapSync.Store(true)
|
||||
// log.Warn("Switch sync mode from full sync to snap sync", "reason", "head state missing")
|
||||
// }
|
||||
fullBlock, snapBlock := h.chain.CurrentBlock(), h.chain.CurrentSnapBlock()
|
||||
if fullBlock.Number.Uint64() == 0 && snapBlock.Number.Uint64() > 0 {
|
||||
h.snapSync.Store(true)
|
||||
log.Warn("Switch sync mode from full sync to snap sync", "reason", "snap sync incomplete")
|
||||
} else if !h.chain.HasState(fullBlock.Root) {
|
||||
h.snapSync.Store(true)
|
||||
log.Warn("Switch sync mode from full sync to snap sync", "reason", "head state missing")
|
||||
}
|
||||
} else {
|
||||
head := h.chain.CurrentBlock()
|
||||
if head.Number.Uint64() > 0 && h.chain.HasState(head.Root) {
|
||||
|
|
|
|||
50
eth/sync.go
50
eth/sync.go
|
|
@ -190,43 +190,35 @@ func peerToSyncOp(mode downloader.SyncMode, p *eth.Peer) *chainSyncOp {
|
|||
}
|
||||
|
||||
func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) {
|
||||
// TODO - uncomment when we (Polygon-PoS, bor) have snap sync/pbss
|
||||
/*
|
||||
// If we're in snap sync mode, return that directly
|
||||
if cs.handler.snapSync.Load() {
|
||||
block := cs.handler.chain.CurrentSnapBlock()
|
||||
td := cs.handler.chain.GetTd(block.Hash(), block.Number.Uint64())
|
||||
return downloader.SnapSync, td
|
||||
}
|
||||
*/
|
||||
// If we're in snap sync mode, return that directly
|
||||
if cs.handler.snapSync.Load() {
|
||||
block := cs.handler.chain.CurrentSnapBlock()
|
||||
td := cs.handler.chain.GetTd(block.Hash(), block.Number.Uint64())
|
||||
return downloader.SnapSync, td
|
||||
}
|
||||
|
||||
// We are probably in full sync, but we might have rewound to before the
|
||||
// snap sync pivot, check if we should re-enable snap sync.
|
||||
head := cs.handler.chain.CurrentBlock()
|
||||
// TODO - uncomment when we (Polygon-PoS, bor) have snap sync/pbss
|
||||
/*
|
||||
if pivot := rawdb.ReadLastPivotNumber(cs.handler.database); pivot != nil {
|
||||
if head.Number.Uint64() < *pivot {
|
||||
block := cs.handler.chain.CurrentSnapBlock()
|
||||
td := cs.handler.chain.GetTd(block.Hash(), block.Number.Uint64())
|
||||
return downloader.SnapSync, td
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// TODO - uncomment when we (Polygon-PoS, bor) have snap sync/pbss
|
||||
// For more info - https://github.com/ethereum/go-ethereum/pull/28171
|
||||
/*
|
||||
// We are in a full sync, but the associated head state is missing. To complete
|
||||
// the head state, forcefully rerun the snap sync. Note it doesn't mean the
|
||||
// persistent state is corrupted, just mismatch with the head block.
|
||||
if !cs.handler.chain.HasState(head.Root) {
|
||||
if pivot := rawdb.ReadLastPivotNumber(cs.handler.database); pivot != nil {
|
||||
if head.Number.Uint64() < *pivot {
|
||||
block := cs.handler.chain.CurrentSnapBlock()
|
||||
td := cs.handler.chain.GetTd(block.Hash(), block.Number.Uint64())
|
||||
log.Info("Reenabled snap sync as chain is stateless")
|
||||
return downloader.SnapSync, td
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// For more info - https://github.com/ethereum/go-ethereum/pull/28171
|
||||
// We are in a full sync, but the associated head state is missing. To complete
|
||||
// the head state, forcefully rerun the snap sync. Note it doesn't mean the
|
||||
// persistent state is corrupted, just mismatch with the head block.
|
||||
if !cs.handler.chain.HasState(head.Root) {
|
||||
block := cs.handler.chain.CurrentSnapBlock()
|
||||
td := cs.handler.chain.GetTd(block.Hash(), block.Number.Uint64())
|
||||
log.Info("Reenabled snap sync as chain is stateless")
|
||||
return downloader.SnapSync, td
|
||||
}
|
||||
|
||||
// Nope, we're really full syncing
|
||||
td := cs.handler.chain.GetTd(head.Hash(), head.Number.Uint64())
|
||||
|
||||
|
|
|
|||
|
|
@ -1161,10 +1161,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
case "full":
|
||||
n.SyncMode = downloader.FullSync
|
||||
case "snap":
|
||||
// n.SyncMode = downloader.SnapSync // TODO(snap): Uncomment when we have snap sync working
|
||||
n.SyncMode = downloader.FullSync
|
||||
|
||||
log.Warn("Bor doesn't support Snap Sync yet, switching to Full Sync mode")
|
||||
n.SyncMode = downloader.SnapSync
|
||||
default:
|
||||
return nil, fmt.Errorf("sync mode '%s' not found", c.SyncMode)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func (c *Command) Flags(config *Config) *flagset.Flagset {
|
|||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "syncmode",
|
||||
Usage: `Blockchain sync mode (only "full" sync supported)`,
|
||||
Usage: `Blockchain sync mode ("full" or "snap")`,
|
||||
Value: &c.cliConfig.SyncMode,
|
||||
Default: c.cliConfig.SyncMode,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue