Fix test.

This commit is contained in:
cheatfate 2024-03-11 04:03:17 +02:00
parent a034d5c42d
commit 4948b2c1ec
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
1 changed files with 55 additions and 44 deletions

View File

@ -6,6 +6,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
{.push raises: [].}
import
std/[typetraits, os, options, json, sequtils, uri, algorithm],
@ -116,7 +117,7 @@ func contains*(keylist: openArray[KeystoreInfo], key: ValidatorPubKey): bool =
false
func contains*(keylist: openArray[KeystoreInfo], key: string): bool =
let pubkey = ValidatorPubKey.fromHex(key).tryGet()
let pubkey = ValidatorPubKey.fromHex(key).get()
contains(keylist, pubkey)
proc prepareNetwork =
@ -155,7 +156,11 @@ proc prepareNetwork =
let launchPadDeposits =
mapIt(deposits.value, LaunchPadDeposit.init(cfg, it))
try:
Json.saveFile(depositsFile, launchPadDeposits)
except CatchableError as exc:
raiseAssert exc.msg
notice "Deposit data written", filename = depositsFile
let runtimeConfigWritten = secureWriteFile(runtimeConfigFile, """
@ -183,7 +188,10 @@ BELLATRIX_FORK_EPOCH: 0
except Exception as exc: # TODO Fix confutils exceptions
raiseAssert exc.msg
try:
doCreateTestnet(createTestnetConf, rng[])
except CatchableError as exc:
raiseAssert exc.msg
let tokenFileRes = secureWriteFile(tokenFilePath, correctTokenValue)
if tokenFileRes.isErr:
@ -209,6 +217,7 @@ proc copyHalfValidators(dstDataDir: string, firstHalf: bool) =
path = dstSecretsDir, err = ioErrorMsg(status.error)
quit 1
try:
var validatorIdx = 0
for validator in walkDir(validatorsDir):
if (validatorIdx < simulationDepositsCount div 2) == firstHalf:
@ -259,10 +268,12 @@ proc copyHalfValidators(dstDataDir: string, firstHalf: bool) =
quit 1
inc validatorIdx
except CatchableError as exc:
raiseAssert exc.msg
proc addPreTestRemoteKeystores(validatorsDir: string) =
for item in oldPublicKeys:
let key = ValidatorPubKey.fromHex(item).tryGet()
let key = ValidatorPubKey.fromHex(item).get()
let res = saveKeystore(validatorsDir, key, oldPublicKeysUrl)
if res.isErr():
fatal "Failed to create remote keystore file",