mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-03 15:55:47 +00:00
parent
11771f8444
commit
ee50f06a3e
@ -140,6 +140,7 @@ type
|
|||||||
Full ## Beware, experimental
|
Full ## Beware, experimental
|
||||||
Snap ## Beware, experimental
|
Snap ## Beware, experimental
|
||||||
SnapCtx ## Beware, experimental
|
SnapCtx ## Beware, experimental
|
||||||
|
Stateless ## Beware, experimental
|
||||||
|
|
||||||
NimbusConf* = object of RootObj
|
NimbusConf* = object of RootObj
|
||||||
## Main Nimbus configuration object
|
## Main Nimbus configuration object
|
||||||
@ -172,7 +173,8 @@ type
|
|||||||
"- default -- legacy sync mode\n" &
|
"- default -- legacy sync mode\n" &
|
||||||
"- full -- full blockchain archive\n" &
|
"- full -- full blockchain archive\n" &
|
||||||
"- snap -- experimental snap mode (development only)\n" &
|
"- snap -- experimental snap mode (development only)\n" &
|
||||||
"- snapCtx -- snap considering possible recovery context"
|
"- snapCtx -- snap considering possible recovery context\n" &
|
||||||
|
"- stateless -- experimental stateless mode (development only)"
|
||||||
defaultValue: SyncMode.Default
|
defaultValue: SyncMode.Default
|
||||||
defaultValueDesc: $SyncMode.Default
|
defaultValueDesc: $SyncMode.Default
|
||||||
abbr: "y"
|
abbr: "y"
|
||||||
|
@ -27,7 +27,7 @@ import
|
|||||||
./core/[chain, sealer, clique/clique_desc,
|
./core/[chain, sealer, clique/clique_desc,
|
||||||
clique/clique_sealer, tx_pool, block_import],
|
clique/clique_sealer, tx_pool, block_import],
|
||||||
./rpc/merge/merger,
|
./rpc/merge/merger,
|
||||||
./sync/[legacy, full, protocol, snap,
|
./sync/[legacy, full, protocol, snap, stateless,
|
||||||
protocol/les_protocol, handlers, peers]
|
protocol/les_protocol, handlers, peers]
|
||||||
|
|
||||||
when defined(evmc_enabled):
|
when defined(evmc_enabled):
|
||||||
@ -60,6 +60,7 @@ type
|
|||||||
legaSyncRef: LegacySyncRef
|
legaSyncRef: LegacySyncRef
|
||||||
snapSyncRef: SnapSyncRef
|
snapSyncRef: SnapSyncRef
|
||||||
fullSyncRef: FullSyncRef
|
fullSyncRef: FullSyncRef
|
||||||
|
statelessSyncRef: StatelessSyncRef
|
||||||
merger: MergerRef
|
merger: MergerRef
|
||||||
|
|
||||||
proc importBlocks(conf: NimbusConf, com: CommonRef) =
|
proc importBlocks(conf: NimbusConf, com: CommonRef) =
|
||||||
@ -186,6 +187,9 @@ proc setupP2P(nimbus: NimbusNode, conf: NimbusConf,
|
|||||||
nimbus.snapSyncRef = SnapSyncRef.init(
|
nimbus.snapSyncRef = SnapSyncRef.init(
|
||||||
nimbus.ethNode, nimbus.chainRef, nimbus.ctx.rng, conf.maxPeers,
|
nimbus.ethNode, nimbus.chainRef, nimbus.ctx.rng, conf.maxPeers,
|
||||||
nimbus.dbBackend, tickerOK, noRecovery=noRecovery, exCtrlFile)
|
nimbus.dbBackend, tickerOK, noRecovery=noRecovery, exCtrlFile)
|
||||||
|
of SyncMode.Stateless:
|
||||||
|
# FIXME-Adam: what needs to go here?
|
||||||
|
nimbus.statelessSyncRef = StatelessSyncRef.init()
|
||||||
of SyncMode.Default:
|
of SyncMode.Default:
|
||||||
nimbus.legaSyncRef = LegacySyncRef.new(
|
nimbus.legaSyncRef = LegacySyncRef.new(
|
||||||
nimbus.ethNode, nimbus.chainRef)
|
nimbus.ethNode, nimbus.chainRef)
|
||||||
@ -205,7 +209,7 @@ proc setupP2P(nimbus: NimbusNode, conf: NimbusConf,
|
|||||||
if conf.maxPeers > 0:
|
if conf.maxPeers > 0:
|
||||||
var waitForPeers = true
|
var waitForPeers = true
|
||||||
case conf.syncMode:
|
case conf.syncMode:
|
||||||
of SyncMode.Snap, SyncMode.SnapCtx:
|
of SyncMode.Snap, SyncMode.SnapCtx, SyncMode.Stateless:
|
||||||
waitForPeers = false
|
waitForPeers = false
|
||||||
of SyncMode.Full, SyncMode.Default:
|
of SyncMode.Full, SyncMode.Default:
|
||||||
discard
|
discard
|
||||||
@ -428,6 +432,8 @@ proc start(nimbus: NimbusNode, conf: NimbusConf) =
|
|||||||
cast[pointer](nimbus.legaSyncRef))
|
cast[pointer](nimbus.legaSyncRef))
|
||||||
of SyncMode.Full:
|
of SyncMode.Full:
|
||||||
nimbus.fullSyncRef.start
|
nimbus.fullSyncRef.start
|
||||||
|
of SyncMode.Stateless:
|
||||||
|
nimbus.statelessSyncRef.start
|
||||||
of SyncMode.Snap, SyncMode.SnapCtx:
|
of SyncMode.Snap, SyncMode.SnapCtx:
|
||||||
nimbus.snapSyncRef.start
|
nimbus.snapSyncRef.start
|
||||||
|
|
||||||
@ -455,6 +461,8 @@ proc stop*(nimbus: NimbusNode, conf: NimbusConf) {.async, gcsafe.} =
|
|||||||
await nimbus.networkLoop.cancelAndWait()
|
await nimbus.networkLoop.cancelAndWait()
|
||||||
if nimbus.peerManager.isNil.not:
|
if nimbus.peerManager.isNil.not:
|
||||||
await nimbus.peerManager.stop()
|
await nimbus.peerManager.stop()
|
||||||
|
if nimbus.statelessSyncRef.isNil.not:
|
||||||
|
nimbus.statelessSyncRef.stop()
|
||||||
if nimbus.snapSyncRef.isNil.not:
|
if nimbus.snapSyncRef.isNil.not:
|
||||||
nimbus.snapSyncRef.stop()
|
nimbus.snapSyncRef.stop()
|
||||||
if nimbus.fullSyncRef.isNil.not:
|
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