mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-24 11:11:59 +00:00
parent
11771f8444
commit
ee50f06a3e
@ -140,6 +140,7 @@ type
|
||||
Full ## Beware, experimental
|
||||
Snap ## Beware, experimental
|
||||
SnapCtx ## Beware, experimental
|
||||
Stateless ## Beware, experimental
|
||||
|
||||
NimbusConf* = object of RootObj
|
||||
## Main Nimbus configuration object
|
||||
@ -169,10 +170,11 @@ type
|
||||
syncMode* {.
|
||||
desc: "Specify particular blockchain sync mode."
|
||||
longDesc:
|
||||
"- default -- legacy sync mode\n" &
|
||||
"- full -- full blockchain archive\n" &
|
||||
"- snap -- experimental snap mode (development only)\n" &
|
||||
"- snapCtx -- snap considering possible recovery context"
|
||||
"- default -- legacy sync mode\n" &
|
||||
"- full -- full blockchain archive\n" &
|
||||
"- snap -- experimental snap mode (development only)\n" &
|
||||
"- snapCtx -- snap considering possible recovery context\n" &
|
||||
"- stateless -- experimental stateless mode (development only)"
|
||||
defaultValue: SyncMode.Default
|
||||
defaultValueDesc: $SyncMode.Default
|
||||
abbr: "y"
|
||||
|
@ -27,7 +27,7 @@ import
|
||||
./core/[chain, sealer, clique/clique_desc,
|
||||
clique/clique_sealer, tx_pool, block_import],
|
||||
./rpc/merge/merger,
|
||||
./sync/[legacy, full, protocol, snap,
|
||||
./sync/[legacy, full, protocol, snap, stateless,
|
||||
protocol/les_protocol, handlers, peers]
|
||||
|
||||
when defined(evmc_enabled):
|
||||
@ -60,6 +60,7 @@ type
|
||||
legaSyncRef: LegacySyncRef
|
||||
snapSyncRef: SnapSyncRef
|
||||
fullSyncRef: FullSyncRef
|
||||
statelessSyncRef: StatelessSyncRef
|
||||
merger: MergerRef
|
||||
|
||||
proc importBlocks(conf: NimbusConf, com: CommonRef) =
|
||||
@ -186,6 +187,9 @@ proc setupP2P(nimbus: NimbusNode, conf: NimbusConf,
|
||||
nimbus.snapSyncRef = SnapSyncRef.init(
|
||||
nimbus.ethNode, nimbus.chainRef, nimbus.ctx.rng, conf.maxPeers,
|
||||
nimbus.dbBackend, tickerOK, noRecovery=noRecovery, exCtrlFile)
|
||||
of SyncMode.Stateless:
|
||||
# FIXME-Adam: what needs to go here?
|
||||
nimbus.statelessSyncRef = StatelessSyncRef.init()
|
||||
of SyncMode.Default:
|
||||
nimbus.legaSyncRef = LegacySyncRef.new(
|
||||
nimbus.ethNode, nimbus.chainRef)
|
||||
@ -205,7 +209,7 @@ proc setupP2P(nimbus: NimbusNode, conf: NimbusConf,
|
||||
if conf.maxPeers > 0:
|
||||
var waitForPeers = true
|
||||
case conf.syncMode:
|
||||
of SyncMode.Snap, SyncMode.SnapCtx:
|
||||
of SyncMode.Snap, SyncMode.SnapCtx, SyncMode.Stateless:
|
||||
waitForPeers = false
|
||||
of SyncMode.Full, SyncMode.Default:
|
||||
discard
|
||||
@ -428,6 +432,8 @@ proc start(nimbus: NimbusNode, conf: NimbusConf) =
|
||||
cast[pointer](nimbus.legaSyncRef))
|
||||
of SyncMode.Full:
|
||||
nimbus.fullSyncRef.start
|
||||
of SyncMode.Stateless:
|
||||
nimbus.statelessSyncRef.start
|
||||
of SyncMode.Snap, SyncMode.SnapCtx:
|
||||
nimbus.snapSyncRef.start
|
||||
|
||||
@ -455,6 +461,8 @@ proc stop*(nimbus: NimbusNode, conf: NimbusConf) {.async, gcsafe.} =
|
||||
await nimbus.networkLoop.cancelAndWait()
|
||||
if nimbus.peerManager.isNil.not:
|
||||
await nimbus.peerManager.stop()
|
||||
if nimbus.statelessSyncRef.isNil.not:
|
||||
nimbus.statelessSyncRef.stop()
|
||||
if nimbus.snapSyncRef.isNil.not:
|
||||
nimbus.snapSyncRef.stop()
|
||||
if nimbus.fullSyncRef.isNil.not:
|
||||
|
41
nimbus/sync/stateless.nim
Normal file
41
nimbus/sync/stateless.nim
Normal file
@ -0,0 +1,41 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||
# http://opensource.org/licenses/MIT)
|
||||
# at your option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
import
|
||||
eth/[common, p2p],
|
||||
chronicles,
|
||||
chronos,
|
||||
stew/[interval_set, sorted_set],
|
||||
"."/[sync_desc, sync_sched, protocol]
|
||||
|
||||
logScope:
|
||||
topics = "stateless-sync"
|
||||
|
||||
type
|
||||
StatelessSyncRef* = ref object
|
||||
# FIXME-Adam: what needs to go in here?
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public functions
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
proc init*(T: type StatelessSyncRef): T =
|
||||
new result
|
||||
|
||||
|
||||
proc start*(ctx: StatelessSyncRef) =
|
||||
# FIXME-Adam: What do I need here, if anything?
|
||||
discard
|
||||
|
||||
proc stop*(ctx: StatelessSyncRef) =
|
||||
discard
|
Loading…
x
Reference in New Issue
Block a user