mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 22:36:01 +00:00
Fixing issues after bump.
This commit is contained in:
parent
72695dd62a
commit
9de65fa293
@ -5,13 +5,13 @@
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
import
|
||||
std/[parseutils, typetraits, sequtils, strutils, deques, sets, options],
|
||||
std/[typetraits, sequtils, strutils, deques, sets, options],
|
||||
stew/[results, base10],
|
||||
chronicles,
|
||||
nimcrypto/utils as ncrutils,
|
||||
../beacon_node_common, ../eth2_network, ../validator_duties,
|
||||
../block_pools/chain_dag, ../exit_pool,
|
||||
../spec/[crypto, digest, validator, network],
|
||||
../beacon_node_common, ../networking/eth2_network,
|
||||
../consensus_object_pools/[blockchain_dag, exit_pool],
|
||||
../spec/[crypto, digest, validator],
|
||||
../ssz/merkleization,
|
||||
./rest_utils
|
||||
|
||||
|
@ -11,7 +11,7 @@ import
|
||||
rest_utils,
|
||||
chronicles,
|
||||
nimcrypto/utils as ncrutils,
|
||||
../beacon_node_common, ../eth1_monitor,
|
||||
../beacon_node_common, ../eth1/eth1_monitor,
|
||||
../spec/[datatypes, digest, presets]
|
||||
|
||||
logScope: topics = "rest_config"
|
||||
|
@ -3,7 +3,6 @@ import
|
||||
presto,
|
||||
chronicles,
|
||||
../version, ../beacon_node_common,
|
||||
../eth2_network, ../peer_pool,
|
||||
../spec/[datatypes, digest, presets],
|
||||
./rest_utils
|
||||
|
||||
|
@ -5,8 +5,8 @@ import
|
||||
eth/p2p/discoveryv5/enr,
|
||||
libp2p/[multiaddress, multicodec],
|
||||
nimcrypto/utils as ncrutils,
|
||||
../version, ../beacon_node_common, ../sync_manager,
|
||||
../eth2_network, ../peer_pool,
|
||||
../version, ../beacon_node_common, ../sync/sync_manager,
|
||||
../networking/[eth2_network, peer_pool],
|
||||
../spec/[datatypes, digest, presets],
|
||||
../spec/eth2_apis/callsigs_types,
|
||||
./rest_utils
|
||||
|
@ -4,10 +4,10 @@ import libp2p/peerid
|
||||
import stew/[base10, byteutils]
|
||||
import nimcrypto/utils as ncrutils
|
||||
import ../spec/[crypto, digest, datatypes]
|
||||
import ../beacon_node_common, ../validator_duties
|
||||
import ../block_pools/[block_pools_types, chain_dag]
|
||||
import ../beacon_node_common
|
||||
import ../consensus_object_pools/[block_pools_types, blockchain_dag]
|
||||
|
||||
export chain_dag, presto
|
||||
export blockchain_dag, presto
|
||||
|
||||
const
|
||||
DecimalSet = {'0' .. '9'}
|
||||
@ -467,10 +467,17 @@ proc getBlockDataFromBlockIdent*(node: BeaconNode,
|
||||
|
||||
template withStateForStateIdent*(node: BeaconNode,
|
||||
blockSlot: BlockSlot, body: untyped): untyped =
|
||||
# TODO this can be optimized for the "head" case since that should be most
|
||||
# common.
|
||||
node.chainDag.withState(node.chainDag.tmpState, blockSlot):
|
||||
body
|
||||
template isState(state: StateData): bool =
|
||||
state.blck.atSlot(state.data.data.slot) == blockSlot
|
||||
|
||||
if isState(node.chainDag.headState):
|
||||
withStateVars(node.chainDag.headState):
|
||||
var cache {.inject.}: StateCache
|
||||
body
|
||||
else:
|
||||
let rpcState = assignClone(node.chainDag.headState)
|
||||
node.chainDag.withState(rpcState[], blockSlot):
|
||||
body
|
||||
|
||||
proc jsonError*(t: typedesc[RestApiResponse], status: HttpCode = Http200,
|
||||
msg: string = "", stacktrace: string = ""): RestApiResponse =
|
||||
|
@ -76,5 +76,5 @@ type
|
||||
|
||||
SyncInfo* = tuple
|
||||
head_slot: Slot
|
||||
sync_distance: int64
|
||||
sync_distance: uint64
|
||||
is_syncing: bool
|
||||
|
@ -1144,11 +1144,9 @@ proc getInfo*[A, B](man: SyncManager[A, B]): SyncInfo =
|
||||
## Returns current synchronization information for RPC call.
|
||||
let wallSlot = man.getLocalWallSlot()
|
||||
let headSlot = man.getLocalHeadSlot()
|
||||
|
||||
# Even with 6 second slots (minimal presets), this overflows about 1.75
|
||||
# trillion years into the chain's existence, if headSlot is 0.
|
||||
let sync_distance = wallSlot - headSlot
|
||||
doAssert sync_distance <= high(int64).uint64
|
||||
|
||||
SyncInfo(head_slot: headSlot, sync_distance: int64(sync_distance),
|
||||
is_syncing: man.inProgress)
|
||||
(
|
||||
head_slot: headSlot,
|
||||
sync_distance: sync_distance,
|
||||
is_syncing: man.inProgress
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user