nimbus-eth1/nimbus/nimbus_desc.nim
andri lim 4d9e288340
Wiring ForkedChainRef to other components (#2423)
* Wiring ForkedChainRef to other components

- Disable majority of hive simulators
- Only enable pyspec_sim for the moment
- The pyspec_sim is using a smaller RPC service wired to ForkedChainRef
- The RPC service will gradually grow

* Addressing PR review

* Fix test_beacon/setup_env

* Enable consensus_sim (#2441)

* Enable consensus_sim

* Remove isFile check

* Enable Engine API jwt auth tests and exchange cap tests

* Enable engine api in build_sim.sh

* Wire ForkedChainRef to Engine API newPayload

* Wire Engine API getBodies to ForkedChainRef

* Wire Engine API api_forkchoice to ForkedChainRef

* Wire more RPC methods to ForkedChainRef

* Implement eth_syncing

* Implement eth_call and eth_getlogs

* TxPool: simplify smartHead

* Fix smartHead usage

* Fix txpool headDiff

* Remove hasBlockHeader and use headerExists

* Addressing review
2024-09-04 09:54:54 +00:00

78 lines
1.8 KiB
Nim

# Nimbus
# Copyright (c) 2024 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
# at your option.
# This file may not be copied, modified, or distributed except according to
# those terms.
import
chronos,
eth/p2p,
metrics/chronos_httpserver,
./rpc/rpc_server,
./core/chain,
./core/tx_pool,
./sync/peers,
./sync/beacon,
# ./sync/snap, # -- todo
./beacon/beacon_engine,
./common,
./config
export
chronos,
p2p,
chronos_httpserver,
rpc_server,
chain,
tx_pool,
peers,
beacon,
#snap,
full,
beacon_engine,
common,
config
type
NimbusState* = enum
Starting, Running, Stopping
NimbusNode* = ref object
httpServer*: NimbusHttpServerRef
engineApiServer*: NimbusHttpServerRef
ethNode*: EthereumNode
state*: NimbusState
ctx*: EthContext
chainRef*: ForkedChainRef
txPool*: TxPoolRef
networkLoop*: Future[void]
peerManager*: PeerManagerRef
# snapSyncRef*: SnapSyncRef # -- todo
beaconSyncRef*: BeaconSyncRef
beaconEngine*: BeaconEngineRef
metricsServer*: MetricsHttpServerRef
{.push gcsafe, raises: [].}
proc stop*(nimbus: NimbusNode, conf: NimbusConf) {.async, gcsafe.} =
trace "Graceful shutdown"
if nimbus.httpServer.isNil.not:
await nimbus.httpServer.stop()
if nimbus.engineApiServer.isNil.not:
await nimbus.engineApiServer.stop()
if conf.maxPeers > 0:
await nimbus.networkLoop.cancelAndWait()
if nimbus.peerManager.isNil.not:
await nimbus.peerManager.stop()
#if nimbus.snapSyncRef.isNil.not:
# nimbus.snapSyncRef.stop()
if nimbus.beaconSyncRef.isNil.not:
nimbus.beaconSyncRef.stop()
if nimbus.metricsServer.isNil.not:
await nimbus.metricsServer.stop()
{.pop.}