From ff40c1e1a20b0056d648833b419668dcb579a3b9 Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Mon, 22 Jul 2024 14:22:45 +0200 Subject: [PATCH] Update nph to 0.6.0 for fluffy and nimbus_verified_proxy (#2511) --- .github/workflows/fluffy.yml | 2 +- .github/workflows/nimbus_verified_proxy.yml | 2 +- fluffy/database/content_db.nim | 15 +++++---------- fluffy/network/wire/portal_protocol.nim | 9 +++------ fluffy/scripts/test_portal_testnet.nim | 12 ++++-------- .../tools/beacon_lc_bridge/beacon_lc_bridge.nim | 15 +++++---------- nimbus_verified_proxy/nimbus_verified_proxy.nim | 15 +++++---------- 7 files changed, 24 insertions(+), 46 deletions(-) diff --git a/.github/workflows/fluffy.yml b/.github/workflows/fluffy.yml index 1fe44e4cd..d8fd16ac3 100644 --- a/.github/workflows/fluffy.yml +++ b/.github/workflows/fluffy.yml @@ -320,7 +320,7 @@ jobs: # Updating nph version should be accompanied with running the new # version on the fluffy directory. run: | - VERSION="v0.5.1" + VERSION="v0.6.0" ARCHIVE="nph-linux_x64.tar.gz" curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE} tar -xzf ${ARCHIVE} diff --git a/.github/workflows/nimbus_verified_proxy.yml b/.github/workflows/nimbus_verified_proxy.yml index aa186575f..4cd5c42bd 100644 --- a/.github/workflows/nimbus_verified_proxy.yml +++ b/.github/workflows/nimbus_verified_proxy.yml @@ -238,7 +238,7 @@ jobs: # Updating nph version should be accompanied with running the new # version on the fluffy directory. run: | - VERSION="v0.5.1" + VERSION="v0.6.0" ARCHIVE="nph-linux_x64.tar.gz" curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE} tar -xzf ${ARCHIVE} diff --git a/fluffy/database/content_db.nim b/fluffy/database/content_db.nim index 397dfc579..ea09e5966 100644 --- a/fluffy/database/content_db.nim +++ b/fluffy/database/content_db.nim @@ -251,8 +251,7 @@ proc size*(db: ContentDB): int64 = var size: int64 = 0 discard ( db.sizeStmt.exec do(res: int64): - size = res - ).expectDb() + size = res).expectDb() return size proc unusedSize(db: ContentDB): int64 = @@ -261,8 +260,7 @@ proc unusedSize(db: ContentDB): int64 = var size: int64 = 0 discard ( db.unusedSizeStmt.exec do(res: int64): - size = res - ).expectDb() + size = res).expectDb() return size proc usedSize*(db: ContentDB): int64 = @@ -275,16 +273,14 @@ proc contentSize*(db: ContentDB): int64 = var size: int64 = 0 discard ( db.contentSizeStmt.exec do(res: int64): - size = res - ).expectDb() + size = res).expectDb() return size proc contentCount*(db: ContentDB): int64 = var count: int64 = 0 discard ( db.contentCountStmt.exec do(res: int64): - count = res - ).expectDb() + count = res).expectDb() return count ## Pruning related calls @@ -295,8 +291,7 @@ proc getLargestDistance*(db: ContentDB, localId: UInt256): UInt256 = db.largestDistanceStmt.exec( localId.toBytesBE(), proc(res: array[32, byte]) = - distanceBytes = res - , + distanceBytes = res, ) ).expectDb() diff --git a/fluffy/network/wire/portal_protocol.nim b/fluffy/network/wire/portal_protocol.nim index 31834f152..69915e4d0 100644 --- a/fluffy/network/wire/portal_protocol.nim +++ b/fluffy/network/wire/portal_protocol.nim @@ -1081,8 +1081,7 @@ proc lookup*( closestNodes.lowerBound( n, 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( n, 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( n, proc(x: Node, n: Node): int = - cmp(p.distance(x.id, targetId), dist) - , + cmp(p.distance(x.id, targetId), dist), ), ) diff --git a/fluffy/scripts/test_portal_testnet.nim b/fluffy/scripts/test_portal_testnet.nim index f0ad2e70c..89e7d1b28 100644 --- a/fluffy/scripts/test_portal_testnet.nim +++ b/fluffy/scripts/test_portal_testnet.nim @@ -289,11 +289,9 @@ procSuite "Portal testnet tests": return res except CatchableError as exc: await client.close() - raise exc - , + raise exc, proc(mc: Opt[BlockObject]): bool = - return mc.isSome() - , + return mc.isSome(), "Did not receive expected Block with hash " & hash.data.toHex(), i, ) @@ -315,11 +313,9 @@ procSuite "Portal testnet tests": return res except CatchableError as exc: await client.close() - raise exc - , + raise exc, proc(mc: seq[LogObject]): bool = - return true - , + return true, "", i, ) diff --git a/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim b/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim index 53fd22591..2310c52a2 100644 --- a/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim +++ b/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim @@ -462,32 +462,27 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} = network.addValidator( getBeaconBlocksTopic(forkDigests.phase0), proc(signedBlock: phase0.SignedBeaconBlock): errors.ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.altair), proc(signedBlock: altair.SignedBeaconBlock): errors.ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.bellatrix), proc(signedBlock: bellatrix.SignedBeaconBlock): errors.ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.capella), proc(signedBlock: capella.SignedBeaconBlock): errors.ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.deneb), proc(signedBlock: deneb.SignedBeaconBlock): errors.ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) lightClient.installMessageValidators() diff --git a/nimbus_verified_proxy/nimbus_verified_proxy.nim b/nimbus_verified_proxy/nimbus_verified_proxy.nim index d46ebfd54..2fcffd016 100644 --- a/nimbus_verified_proxy/nimbus_verified_proxy.nim +++ b/nimbus_verified_proxy/nimbus_verified_proxy.nim @@ -161,32 +161,27 @@ proc run*( network.addValidator( getBeaconBlocksTopic(forkDigests.phase0), proc(signedBlock: phase0.SignedBeaconBlock): ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.altair), proc(signedBlock: altair.SignedBeaconBlock): ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.bellatrix), proc(signedBlock: bellatrix.SignedBeaconBlock): ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.capella), proc(signedBlock: capella.SignedBeaconBlock): ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) network.addValidator( getBeaconBlocksTopic(forkDigests.deneb), proc(signedBlock: deneb.SignedBeaconBlock): ValidationResult = - toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)) - , + toValidationResult(optimisticProcessor.processSignedBeaconBlock(signedBlock)), ) lightClient.installMessageValidators()