mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-02 09:46:26 +00:00
Add --logLevel command-line flag; Fix running the start.sh script from the beacon-chain repo
This commit is contained in:
parent
aaefb6f63c
commit
43ae45fe7e
@ -89,6 +89,10 @@ proc sync*(node: BeaconNode): Future[bool] {.async.} =
|
||||
node.beaconState = persistedState[]
|
||||
var targetSlot = toSlot timeSinceGenesis(node.beaconState)
|
||||
|
||||
let t = now()
|
||||
if t < node.beaconState.genesisTime * 1000:
|
||||
await sleepAsync int(node.beaconState.genesisTime * 1000 - t)
|
||||
|
||||
while node.beaconState.finalized_slot < targetSlot:
|
||||
var (peer, changeLog) = await node.network.getValidatorChangeLog(
|
||||
node.beaconState.validator_registry_delta_chain_tip)
|
||||
@ -144,6 +148,9 @@ proc makeAttestation(node: BeaconNode,
|
||||
doAssert node != nil
|
||||
doAssert validator != nil
|
||||
|
||||
if node.beaconState.slot == node.beaconState.justified_slot:
|
||||
return
|
||||
|
||||
let justifiedBlockRoot = get_block_root(node.beaconState, node.beaconState.justified_slot)
|
||||
|
||||
var attestationData = AttestationData(
|
||||
@ -229,7 +236,7 @@ proc scheduleBlockProposal(node: BeaconNode,
|
||||
# internal `doAssert` starting to fail.
|
||||
doAssert validator != nil
|
||||
|
||||
addTimer(node.beaconState.slotStart(slot)) do (p: pointer):
|
||||
addTimer(node.beaconState.slotStart(slot)) do (x: pointer) {.gcsafe.}:
|
||||
doAssert validator != nil
|
||||
asyncCheck proposeBlock(node, validator, slot.uint64)
|
||||
|
||||
@ -245,7 +252,7 @@ proc scheduleAttestation(node: BeaconNode,
|
||||
# internal `doAssert` starting to fail.
|
||||
doAssert validator != nil
|
||||
|
||||
addTimer(node.beaconState.slotMiddle(slot)) do (p: pointer):
|
||||
addTimer(node.beaconState.slotMiddle(slot)) do (p: pointer) {.gcsafe.}:
|
||||
doAssert validator != nil
|
||||
asyncCheck makeAttestation(node, validator, slot.uint64,
|
||||
shard, committeeLen, indexInCommittee)
|
||||
@ -341,6 +348,8 @@ proc createPidFile(filename: string) =
|
||||
|
||||
when isMainModule:
|
||||
let config = load BeaconNodeConf
|
||||
setLogLevel(config.logLevel)
|
||||
|
||||
case config.cmd
|
||||
of createChain:
|
||||
createStateSnapshot(config.chainStartupData, config.outputStateFile.string)
|
||||
|
2
beacon_chain/beacon_node.nim.cfg
Normal file
2
beacon_chain/beacon_node.nim.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
-d:"chronicles_runtime_filtering=on"
|
||||
|
@ -1,6 +1,7 @@
|
||||
import
|
||||
os, options,
|
||||
confutils/defs, milagro_crypto, json_serialization,
|
||||
confutils/defs, chronicles/options as chroniclesOptions,
|
||||
milagro_crypto, json_serialization,
|
||||
spec/[crypto, datatypes], randao, time
|
||||
|
||||
export
|
||||
@ -22,6 +23,11 @@ type
|
||||
randao*: Randao
|
||||
|
||||
BeaconNodeConf* = object
|
||||
logLevel* {.
|
||||
desc: "Sets the log level",
|
||||
defaultValue: enabledLogLevel
|
||||
.}: LogLevel
|
||||
|
||||
case cmd* {.
|
||||
command
|
||||
defaultValue: noCommand.}: StartUpCommand
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
set -eu
|
||||
|
||||
# Set a default value for the env vars usually supplied by nimbus Makefile
|
||||
: ${SKIP_BUILDS:=""}
|
||||
: ${BUILD_OUTPUTS_DIR:="./build"}
|
||||
|
||||
NUMBER_OF_VALIDATORS=99
|
||||
|
||||
cd $(dirname "$0")
|
||||
@ -14,10 +18,12 @@ SNAPSHOT_FILE="$SIMULATION_DIR/state_snapshot.json"
|
||||
cd $(git rev-parse --show-toplevel)
|
||||
ROOT_DIR=$PWD
|
||||
|
||||
mkdir -p $BUILD_OUTPUTS_DIR
|
||||
|
||||
BEACON_NODE_BIN=$BUILD_OUTPUTS_DIR/beacon_node
|
||||
VALIDATOR_KEYGEN_BIN=$BUILD_OUTPUTS_DIR/validator_keygen
|
||||
|
||||
if [[ ! -z "$SKIP_BUILDS" ]]; then
|
||||
if [[ -z "$SKIP_BUILDS" ]]; then
|
||||
nim c -o:"$VALIDATOR_KEYGEN_BIN" beacon_chain/validator_keygen
|
||||
nim c -o:"$BEACON_NODE_BIN" beacon_chain/beacon_node
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user