Update nph to 0.6.0 for fluffy and nimbus_verified_proxy (#2511)

This commit is contained in:
Kim De Mey 2024-07-22 14:22:45 +02:00 committed by GitHub
parent 5dfbebd4c0
commit ff40c1e1a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 24 additions and 46 deletions

View File

@ -320,7 +320,7 @@ jobs:
# Updating nph version should be accompanied with running the new # Updating nph version should be accompanied with running the new
# version on the fluffy directory. # version on the fluffy directory.
run: | run: |
VERSION="v0.5.1" VERSION="v0.6.0"
ARCHIVE="nph-linux_x64.tar.gz" ARCHIVE="nph-linux_x64.tar.gz"
curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE} curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE}
tar -xzf ${ARCHIVE} tar -xzf ${ARCHIVE}

View File

@ -238,7 +238,7 @@ jobs:
# Updating nph version should be accompanied with running the new # Updating nph version should be accompanied with running the new
# version on the fluffy directory. # version on the fluffy directory.
run: | run: |
VERSION="v0.5.1" VERSION="v0.6.0"
ARCHIVE="nph-linux_x64.tar.gz" ARCHIVE="nph-linux_x64.tar.gz"
curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE} curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE}
tar -xzf ${ARCHIVE} tar -xzf ${ARCHIVE}

View File

@ -251,8 +251,7 @@ proc size*(db: ContentDB): int64 =
var size: int64 = 0 var size: int64 = 0
discard ( discard (
db.sizeStmt.exec do(res: int64): db.sizeStmt.exec do(res: int64):
size = res size = res).expectDb()
).expectDb()
return size return size
proc unusedSize(db: ContentDB): int64 = proc unusedSize(db: ContentDB): int64 =
@ -261,8 +260,7 @@ proc unusedSize(db: ContentDB): int64 =
var size: int64 = 0 var size: int64 = 0
discard ( discard (
db.unusedSizeStmt.exec do(res: int64): db.unusedSizeStmt.exec do(res: int64):
size = res size = res).expectDb()
).expectDb()
return size return size
proc usedSize*(db: ContentDB): int64 = proc usedSize*(db: ContentDB): int64 =
@ -275,16 +273,14 @@ proc contentSize*(db: ContentDB): int64 =
var size: int64 = 0 var size: int64 = 0
discard ( discard (
db.contentSizeStmt.exec do(res: int64): db.contentSizeStmt.exec do(res: int64):
size = res size = res).expectDb()
).expectDb()
return size return size
proc contentCount*(db: ContentDB): int64 = proc contentCount*(db: ContentDB): int64 =
var count: int64 = 0 var count: int64 = 0
discard ( discard (
db.contentCountStmt.exec do(res: int64): db.contentCountStmt.exec do(res: int64):
count = res count = res).expectDb()
).expectDb()
return count return count
## Pruning related calls ## Pruning related calls
@ -295,8 +291,7 @@ proc getLargestDistance*(db: ContentDB, localId: UInt256): UInt256 =
db.largestDistanceStmt.exec( db.largestDistanceStmt.exec(
localId.toBytesBE(), localId.toBytesBE(),
proc(res: array[32, byte]) = proc(res: array[32, byte]) =
distanceBytes = res distanceBytes = res,
,
) )
).expectDb() ).expectDb()

View File

@ -1081,8 +1081,7 @@ proc lookup*(
closestNodes.lowerBound( closestNodes.lowerBound(
n, n,
proc(x: Node, n: Node): int = proc(x: Node, n: Node): int =
cmp(p.distance(x.id, target), p.distance(n.id, target)) cmp(p.distance(x.id, target), p.distance(n.id, target)),
,
), ),
) )
@ -1201,8 +1200,7 @@ proc contentLookup*(
closestNodes.lowerBound( closestNodes.lowerBound(
n, n,
proc(x: Node, n: Node): int = proc(x: Node, n: Node): int =
cmp(p.distance(x.id, targetId), p.distance(n.id, targetId)) cmp(p.distance(x.id, targetId), p.distance(n.id, targetId)),
,
), ),
) )
@ -1335,8 +1333,7 @@ proc traceContentLookup*(
closestNodes.lowerBound( closestNodes.lowerBound(
n, n,
proc(x: Node, n: Node): int = proc(x: Node, n: Node): int =
cmp(p.distance(x.id, targetId), dist) cmp(p.distance(x.id, targetId), dist),
,
), ),
) )

View File

@ -289,11 +289,9 @@ procSuite "Portal testnet tests":
return res return res
except CatchableError as exc: except CatchableError as exc:
await client.close() await client.close()
raise exc raise exc,
,
proc(mc: Opt[BlockObject]): bool = proc(mc: Opt[BlockObject]): bool =
return mc.isSome() return mc.isSome(),
,
"Did not receive expected Block with hash " & hash.data.toHex(), "Did not receive expected Block with hash " & hash.data.toHex(),
i, i,
) )
@ -315,11 +313,9 @@ procSuite "Portal testnet tests":
return res return res
except CatchableError as exc: except CatchableError as exc:
await client.close() await client.close()
raise exc raise exc,
,
proc(mc: seq[LogObject]): bool = proc(mc: seq[LogObject]): bool =
return true return true,
,
"", "",
i, i,
) )

View File

@ -462,32 +462,27 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} =
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.phase0), getBeaconBlocksTopic(forkDigests.phase0),
proc(signedBlock: phase0.SignedBeaconBlock): errors.ValidationResult = proc(signedBlock: phase0.SignedBeaconBlock): errors.ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.altair), getBeaconBlocksTopic(forkDigests.altair),
proc(signedBlock: altair.SignedBeaconBlock): errors.ValidationResult = proc(signedBlock: altair.SignedBeaconBlock): errors.ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.bellatrix), getBeaconBlocksTopic(forkDigests.bellatrix),
proc(signedBlock: bellatrix.SignedBeaconBlock): errors.ValidationResult = proc(signedBlock: bellatrix.SignedBeaconBlock): errors.ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.capella), getBeaconBlocksTopic(forkDigests.capella),
proc(signedBlock: capella.SignedBeaconBlock): errors.ValidationResult = proc(signedBlock: capella.SignedBeaconBlock): errors.ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.deneb), getBeaconBlocksTopic(forkDigests.deneb),
proc(signedBlock: deneb.SignedBeaconBlock): errors.ValidationResult = proc(signedBlock: deneb.SignedBeaconBlock): errors.ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
lightClient.installMessageValidators() lightClient.installMessageValidators()

View File

@ -161,32 +161,27 @@ proc run*(
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.phase0), getBeaconBlocksTopic(forkDigests.phase0),
proc(signedBlock: phase0.SignedBeaconBlock): ValidationResult = proc(signedBlock: phase0.SignedBeaconBlock): ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.altair), getBeaconBlocksTopic(forkDigests.altair),
proc(signedBlock: altair.SignedBeaconBlock): ValidationResult = proc(signedBlock: altair.SignedBeaconBlock): ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.bellatrix), getBeaconBlocksTopic(forkDigests.bellatrix),
proc(signedBlock: bellatrix.SignedBeaconBlock): ValidationResult = proc(signedBlock: bellatrix.SignedBeaconBlock): ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.capella), getBeaconBlocksTopic(forkDigests.capella),
proc(signedBlock: capella.SignedBeaconBlock): ValidationResult = proc(signedBlock: capella.SignedBeaconBlock): ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
network.addValidator( network.addValidator(
getBeaconBlocksTopic(forkDigests.deneb), getBeaconBlocksTopic(forkDigests.deneb),
proc(signedBlock: deneb.SignedBeaconBlock): ValidationResult = proc(signedBlock: deneb.SignedBeaconBlock): ValidationResult =
toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)),
,
) )
lightClient.installMessageValidators() lightClient.installMessageValidators()