fix standalone compilation of `trusted_node_sync.nim` (#5861)

#5544 contained a regression that broke standalone compilation of
`trusted_node_sync` as a main module. Fix it, and add to CI.
This commit is contained in:
Etan Kissling 2024-02-07 20:26:29 +01:00 committed by GitHub
parent 94ba0a9bd1
commit ed8743b986
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -221,6 +221,11 @@ jobs:
run: |
make -j nimbus_beacon_node LOG_LEVEL=TRACE NIMFLAGS="-d:has_deposit_root_checks=1"
- name: Build files with isMainModule
run: |
source env.sh
nim c beacon_chain/trusted_node_sync
lint:
name: "Lint"
runs-on: ubuntu-latest

View File

@ -540,16 +540,18 @@ proc doTrustedNodeSync*(
when isMainModule:
import
std/[os],
std/os,
networking/network_metadata
let
cfg = getRuntimeConfig(some os.paramStr(1))
databaseDir = os.paramStr(2)
syncTarget = TrustedNodeSyncTarget(
kind: TrustedNodeSyncKind.StateId,
stateId: os.paramStr(5))
backfill = os.paramCount() > 5 and os.paramStr(6) == "true"
db = BeaconChainDB.new(databaseDir, cfg, inMemory = false)
waitFor db.doTrustedNodeSync(
getRuntimeConfig(some os.paramStr(1)), os.paramStr(2), os.paramStr(3),
cfg, databaseDir, os.paramStr(3),
os.paramStr(4), syncTarget, backfill, false, true)
db.close()