Merge branch 'master' into feature/blkexc-peer-selection

This commit is contained in:
Ben Bierens 2024-12-18 10:27:16 +01:00 committed by GitHub
commit edb05f8959
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 9 deletions

View File

@ -83,7 +83,7 @@ template multinodesuite*(name: string, body: untyped) =
# ... # ...
let jsonRpcProviderUrl = "http://127.0.0.1:8545" let jsonRpcProviderUrl = "http://127.0.0.1:8545"
var running {.inject, used.}: seq[RunningNode] var running {.inject, used.}: seq[RunningNode]
var bootstrap: string var bootstrapNodes: seq[string]
let starttime = now().format("yyyy-MM-dd'_'HH:mm:ss") let starttime = now().format("yyyy-MM-dd'_'HH:mm:ss")
var currentTestName = "" var currentTestName = ""
var nodeConfigs: NodeConfigs var nodeConfigs: NodeConfigs
@ -162,8 +162,8 @@ template multinodesuite*(name: string, body: untyped) =
let updatedLogFile = getLogFile(role, some roleIdx) let updatedLogFile = getLogFile(role, some roleIdx)
config.withLogFile(updatedLogFile) config.withLogFile(updatedLogFile)
if bootstrap.len > 0: for bootstrapNode in bootstrapNodes:
config.addCliOption("--bootstrap-node", bootstrap) config.addCliOption("--bootstrap-node", bootstrapNode)
config.addCliOption("--api-port", $ await nextFreePort(8080 + nodeIdx)) config.addCliOption("--api-port", $ await nextFreePort(8080 + nodeIdx))
config.addCliOption("--data-dir", datadir) config.addCliOption("--data-dir", datadir)
config.addCliOption("--nat", "127.0.0.1") config.addCliOption("--nat", "127.0.0.1")
@ -273,6 +273,13 @@ template multinodesuite*(name: string, body: untyped) =
fail() fail()
quit(1) quit(1)
proc updateBootstrapNodes(node: CodexProcess) =
without ninfo =? node.client.info():
# raise CatchableError instead of Defect (with .get or !) so we
# can gracefully shutdown and prevent zombies
raiseMultiNodeSuiteError "Failed to get node info"
bootstrapNodes.add ninfo["spr"].getStr()
setup: setup:
if var conf =? nodeConfigs.hardhat: if var conf =? nodeConfigs.hardhat:
try: try:
@ -311,12 +318,7 @@ template multinodesuite*(name: string, body: untyped) =
role: Role.Client, role: Role.Client,
node: node node: node
) )
if running.len == 1: CodexProcess(node).updateBootstrapNodes()
without ninfo =? CodexProcess(node).client.info():
# raise CatchableError instead of Defect (with .get or !) so we
# can gracefully shutdown and prevent zombies
raiseMultiNodeSuiteError "Failed to get node info"
bootstrap = ninfo["spr"].getStr()
if var providers =? nodeConfigs.providers: if var providers =? nodeConfigs.providers:
failAndTeardownOnError "failed to start provider nodes": failAndTeardownOnError "failed to start provider nodes":
@ -326,6 +328,7 @@ template multinodesuite*(name: string, body: untyped) =
role: Role.Provider, role: Role.Provider,
node: node node: node
) )
CodexProcess(node).updateBootstrapNodes()
if var validators =? nodeConfigs.validators: if var validators =? nodeConfigs.validators:
failAndTeardownOnError "failed to start validator nodes": failAndTeardownOnError "failed to start validator nodes":