From dbc1ae86e2931620b10f36a5c79b72fa259930f8 Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Wed, 24 Jan 2024 16:28:03 +0100 Subject: [PATCH] Vendor bumps + related fixes + warning fixes (#1985) - Vendor bump of stew, nim-eth, chronos, nimbus-eth2 and libp2p - Bump related fixes + fixes of deprecation warnings - Several other warnings fixed. --- fluffy/network/beacon/beacon_light_client.nim | 4 +- fluffy/network/state/state_network.nim | 3 -- fluffy/nim.cfg | 8 +++- fluffy/rpc/rpc_eth_api.nim | 4 +- fluffy/rpc/rpc_portal_api.nim | 1 - .../test_state_content.nim | 7 ++-- fluffy/tests/test_discovery_rpc.nim | 2 +- fluffy/tests/test_helpers.nim | 4 +- fluffy/tests/test_portal_wire_protocol.nim | 2 +- .../beacon_lc_bridge/beacon_lc_bridge.nim | 39 ++++++++++++++----- fluffy/tools/utp_testing/utp_test_app.nim | 3 +- hive_integration/nodocker/rpc/test_env.nim | 5 +-- nimbus.nimble | 11 +++++- nimbus/config.nim | 8 ++-- nimbus/graphql/ethapi.nim | 1 - nimbus/nimbus.nim | 1 - nimbus_verified_proxy/nim.cfg | 8 +++- .../nimbus_verified_proxy.nim | 2 +- vendor/nim-chronos | 2 +- vendor/nim-eth | 2 +- vendor/nim-libp2p | 2 +- vendor/nim-stew | 2 +- vendor/nimbus-eth2 | 2 +- 23 files changed, 76 insertions(+), 47 deletions(-) diff --git a/fluffy/network/beacon/beacon_light_client.nim b/fluffy/network/beacon/beacon_light_client.nim index 7b857d10b..0cbcbd9d8 100644 --- a/fluffy/network/beacon/beacon_light_client.nim +++ b/fluffy/network/beacon/beacon_light_client.nim @@ -1,5 +1,5 @@ # Nimbus - Portal Network -# Copyright (c) 2022-2023 Status Research & Development GmbH +# Copyright (c) 2022-2024 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -99,7 +99,7 @@ proc new*( proc lightClientVerifier(obj: SomeForkedLightClientObject): Future[Result[void, VerifierError]] = - let resfut = newFuture[Result[void, VerifierError]]("lightClientVerifier") + let resfut = Future[Result[void, VerifierError]].Raising([CancelledError]).init("lightClientVerifier") lightClient.processor[].addObject(MsgSource.gossip, obj, resfut) resfut diff --git a/fluffy/network/state/state_network.nim b/fluffy/network/state/state_network.nim index f56c115c7..e4c0b1f69 100644 --- a/fluffy/network/state/state_network.nim +++ b/fluffy/network/state/state_network.nim @@ -6,10 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - std/[sequtils, sugar], stew/results, chronos, chronicles, - eth/[rlp, common], - eth/trie/hexary_proof_verification, eth/p2p/discoveryv5/[protocol, enr], ../../database/content_db, ../wire/[portal_protocol, portal_stream, portal_protocol_config], diff --git a/fluffy/nim.cfg b/fluffy/nim.cfg index 3ef099b26..1d6e47d2f 100644 --- a/fluffy/nim.cfg +++ b/fluffy/nim.cfg @@ -1,3 +1,10 @@ +# fluffy +# Copyright (c) 2022-2024 Status Research & Development GmbH +# Licensed and distributed under either of +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). +# at your option. This file may not be copied, modified, or distributed except according to those terms. + -d:"chronicles_runtime_filtering=on" -d:"chronicles_disable_thread_id" @@ -5,7 +12,6 @@ -d:"chronicles_line_numbers:0" @end --d:chronosStrictException -d:PREFER_BLST_SHA256=false --styleCheck:usages diff --git a/fluffy/rpc/rpc_eth_api.nim b/fluffy/rpc/rpc_eth_api.nim index 231bd5ad4..d504a1617 100644 --- a/fluffy/rpc/rpc_eth_api.nim +++ b/fluffy/rpc/rpc_eth_api.nim @@ -1,5 +1,5 @@ # Fluffy -# Copyright (c) 2021-2023 Status Research & Development GmbH +# Copyright (c) 2021-2024 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -9,7 +9,7 @@ import std/[times, sequtils, strutils, typetraits], - json_rpc/[rpcproxy, rpcserver], stew/byteutils, + json_rpc/[rpcproxy, rpcserver], web3/[conversions], # sigh, for FixedBytes marshalling eth/[common/eth_types, rlp], beacon_chain/spec/forks, diff --git a/fluffy/rpc/rpc_portal_api.nim b/fluffy/rpc/rpc_portal_api.nim index 3c4a01a48..7fd2d47d9 100644 --- a/fluffy/rpc/rpc_portal_api.nim +++ b/fluffy/rpc/rpc_portal_api.nim @@ -12,7 +12,6 @@ import json_rpc/[rpcproxy, rpcserver], json_serialization/std/tables, stew/byteutils, - eth/p2p/discoveryv5/nodes_verification, ../network/wire/portal_protocol, ./rpc_types diff --git a/fluffy/tests/state_network_tests/test_state_content.nim b/fluffy/tests/state_network_tests/test_state_content.nim index 09a6403be..eef4df017 100644 --- a/fluffy/tests/state_network_tests/test_state_content.nim +++ b/fluffy/tests/state_network_tests/test_state_content.nim @@ -6,7 +6,6 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - std/[os, json, sequtils], testutils/unittests, stew/[byteutils, io2], eth/keys, @@ -24,7 +23,7 @@ suite "State Content Keys": encoded = SSZ.encode(nibbles) check encoded.toHex() == evenNibles # echo ">>>", encoded.toHex() - + const oddNibbles = "0105000000123456789abc0d" test "Encode/decode odd nibbles": const @@ -85,7 +84,7 @@ suite "State Content Keys": const address = Address.fromHex("000d836201318ec6899a67540690382780743280") codeHash = CodeHash.fromHex("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") - + let contractCodeKey = ContractCodeKey(address: address, codeHash: codeHash) contentKey = ContentKey(contentType: contractCode, contractCodeKey: contractCodeKey) @@ -166,7 +165,7 @@ suite "State Content Values": contractWitnessProof = Witness(@[WitnessNode(@[byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07])]) stateWitnessKeyPackedNibbles = @[NibblePair 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF1] stateWitnessProof = Witness(@[WitnessNode(@[byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09])]) - + contractTrieNodeOffer = ContractTrieNodeOffer( blockHash: BlockHash.fromHex(blockHash), proof: StorageWitness( diff --git a/fluffy/tests/test_discovery_rpc.nim b/fluffy/tests/test_discovery_rpc.nim index 22a39b19a..e5b0a6947 100644 --- a/fluffy/tests/test_discovery_rpc.nim +++ b/fluffy/tests/test_discovery_rpc.nim @@ -8,7 +8,7 @@ {.used.} import - chronos, testutils/unittests, stew/shims/net, + chronos, testutils/unittests, json_rpc/[rpcproxy, rpcserver], json_rpc/clients/httpclient, stint,eth/p2p/discoveryv5/enr, eth/keys, eth/p2p/discoveryv5/protocol as discv5_protocol, diff --git a/fluffy/tests/test_helpers.nim b/fluffy/tests/test_helpers.nim index 72d7dea61..9d545e664 100644 --- a/fluffy/tests/test_helpers.nim +++ b/fluffy/tests/test_helpers.nim @@ -1,5 +1,5 @@ # Nimbus - Portal Network -# Copyright (c) 2021-2023 Status Research & Development GmbH +# Copyright (c) 2021-2024 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -8,7 +8,7 @@ {.push raises: [].} import - stew/shims/net, + std/net, eth/[common, keys, rlp, trie, trie/db], eth/p2p/discoveryv5/[enr, node, routing_table], eth/p2p/discoveryv5/protocol as discv5_protocol, diff --git a/fluffy/tests/test_portal_wire_protocol.nim b/fluffy/tests/test_portal_wire_protocol.nim index 222bc9e31..62c93e7d2 100644 --- a/fluffy/tests/test_portal_wire_protocol.nim +++ b/fluffy/tests/test_portal_wire_protocol.nim @@ -9,7 +9,7 @@ import std/[algorithm, sequtils], - chronos, testutils/unittests, stew/shims/net, + chronos, testutils/unittests, stew/results, eth/keys, eth/p2p/discoveryv5/routing_table, nimcrypto/[hash, sha2], eth/p2p/discoveryv5/protocol as discv5_protocol, diff --git a/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim b/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim index 4d19463a3..d2783fb5f 100644 --- a/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim +++ b/fluffy/tools/beacon_lc_bridge/beacon_lc_bridge.nim @@ -314,7 +314,7 @@ proc asPortalBlockData*( proc getBlockReceipts( client: RpcClient, transactions: seq[TypedTransaction], blockHash: Hash256): - Future[Result[seq[Receipt], string]] {.async.} = + Future[Result[seq[Receipt], string]] {.async: (raises: [CancelledError]).} = ## Note: This makes use of `eth_getBlockReceipts` JSON-RPC endpoint which is ## only supported by Alchemy. var receipts: seq[Receipt] @@ -324,11 +324,8 @@ proc getBlockReceipts( try: await client.eth_getBlockReceipts(w3Hash blockHash) except CatchableError as e: - await client.close() return err("JSON-RPC eth_getBlockReceipts failed: " & e.msg) - await client.close() - for receiptObject in receiptObjects: let receipt = asReceipt(receiptObject).valueOr: return err(error) @@ -426,7 +423,7 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} = Opt.some(client) optimisticHandler = proc(signedBlock: ForkedMsgTrustedSignedBeaconBlock): - Future[void] {.async.} = + Future[void] {.async: (raises: [CancelledError]).} = # TODO: Should not be gossiping optimistic blocks, but instead store them # in a cache and only gossip them after they are confirmed due to an LC # finalized header. @@ -459,8 +456,11 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} = contentKey = encodedContentKey.toHex() except CatchableError as e: error "JSON-RPC error", error = $e.msg - - await portalRpcClient.close() + # TODO: clean-up when json-rpc gets async raises annotations + try: + await portalRpcClient.close() + except CatchableError: + discard # For bodies to get verified, the header needs to be available on # the network. Wait a little to get the headers propagated through @@ -480,17 +480,32 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} = except CatchableError as e: error "JSON-RPC error", error = $e.msg - await portalRpcClient.close() + # TODO: clean-up when json-rpc gets async raises annotations + try: + await portalRpcClient.close() + except CatchableError: + discard if web3Client.isSome(): + let client = web3Client.get() # get receipts let receipts = - (await web3Client.get().getBlockReceipts( + (await client.getBlockReceipts( executionPayload.transactions, hash)).valueOr: # (await web3Client.get().getBlockReceipts( # executionPayload.transactions)).valueOr: error "Error getting block receipts", error + # TODO: clean-up when json-rpc gets async raises annotations + try: + await client.close() + except CatchableError: + discard return + # TODO: clean-up when json-rpc gets async raises annotations + try: + await client.close() + except CatchableError: + discard let portalReceipts = PortalReceipts.fromReceipts(receipts) if validateReceipts(portalReceipts, payload.receiptsRoot).isErr(): @@ -511,7 +526,11 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} = except CatchableError as e: error "JSON-RPC error for portal_historyGossip", error = $e.msg - await portalRpcClient.close() + # TODO: clean-up when json-rpc gets async raises annotations + try: + await portalRpcClient.close() + except CatchableError: + discard return diff --git a/fluffy/tools/utp_testing/utp_test_app.nim b/fluffy/tools/utp_testing/utp_test_app.nim index 9192917a4..0a35c90c9 100644 --- a/fluffy/tools/utp_testing/utp_test_app.nim +++ b/fluffy/tools/utp_testing/utp_test_app.nim @@ -7,11 +7,10 @@ {.push raises: [].} import - std/[hashes, tables], + std/[hashes, tables, net], chronos, chronicles, confutils, confutils/std/net as confNet, stew/[byteutils, endians2], - stew/shims/net, json_rpc/servers/httpserver, eth/p2p/discoveryv5/protocol, eth/p2p/discoveryv5/enr, diff --git a/hive_integration/nodocker/rpc/test_env.nim b/hive_integration/nodocker/rpc/test_env.nim index 3d4b0e91e..9efc9560c 100644 --- a/hive_integration/nodocker/rpc/test_env.nim +++ b/hive_integration/nodocker/rpc/test_env.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2021 Status Research & Development GmbH +# Copyright (c) 2021-2024 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -8,9 +8,8 @@ # those terms. import - std/[os], + std/[os, net], eth/p2p as ethp2p, - stew/shims/net as stewNet, stew/results, chronos, json_rpc/[rpcserver, rpcclient], ../../../nimbus/sync/protocol, diff --git a/nimbus.nimble b/nimbus.nimble index cad9b9838..4d160a3ae 100644 --- a/nimbus.nimble +++ b/nimbus.nimble @@ -1,3 +1,10 @@ +# nimbus +# Copyright (c) 2018-2024 Status Research & Development GmbH +# Licensed and distributed under either of +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). +# at your option. This file may not be copied, modified, or distributed except according to those terms. + mode = ScriptMode.Verbose packageName = "nimbus" @@ -83,10 +90,10 @@ task fluffy_test, "Run fluffy tests": test "fluffy/tests", "all_fluffy_tests", "-d:chronicles_log_level=ERROR -d:nimbus_db_backend=sqlite -d:mergeBlockNumber:38130" task utp_test_app, "Build uTP test app": - buildBinary "utp_test_app", "fluffy/tools/utp_testing/", "-d:chronicles_log_level=TRACE -d:chronosStrictException" + buildBinary "utp_test_app", "fluffy/tools/utp_testing/", "-d:chronicles_log_level=TRACE" task utp_test, "Run uTP integration tests": - test "fluffy/tools/utp_testing", "utp_test", "-d:chronicles_log_level=ERROR -d:chronosStrictException" + test "fluffy/tools/utp_testing", "utp_test", "-d:chronicles_log_level=ERROR" task test_portal_testnet, "Build test_portal_testnet": buildBinary "test_portal_testnet", "fluffy/scripts/", "-d:chronicles_log_level=DEBUG -d:unittest2DisableParamFiltering" diff --git a/nimbus/config.nim b/nimbus/config.nim index 02817167d..5fa567201 100644 --- a/nimbus/config.nim +++ b/nimbus/config.nim @@ -1,4 +1,4 @@ -# Copyright (c) 2018-2023 Status Research & Development GmbH +# Copyright (c) 2018-2024 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -14,7 +14,8 @@ import strutils, times, os, - uri + uri, + net ], pkg/[ chronicles, @@ -23,14 +24,13 @@ import stew/byteutils, confutils/std/net ], - stew/shims/net as stewNet, eth/[common, net/nat, p2p/bootnodes, p2p/enode, p2p/discoveryv5/enr], "."/[db/select_backend, constants, vm_compile_info, version ], common/chain_config -export stewNet +export net const # TODO: fix this agent-string format to match other diff --git a/nimbus/graphql/ethapi.nim b/nimbus/graphql/ethapi.nim index 7aa4bbd86..dc6170a54 100644 --- a/nimbus/graphql/ethapi.nim +++ b/nimbus/graphql/ethapi.nim @@ -11,7 +11,6 @@ import std/[strutils], stew/[results, byteutils], stint, eth/common/eth_types_rlp, chronos, - stew/shims/net, graphql, graphql/graphql as context, graphql/common/types, graphql/httpserver, graphql/instruments/query_complexity, diff --git a/nimbus/nimbus.nim b/nimbus/nimbus.nim index 1182bb65a..dfbe8f86b 100644 --- a/nimbus/nimbus.nim +++ b/nimbus/nimbus.nim @@ -19,7 +19,6 @@ import json_rpc/rpcserver, metrics, metrics/[chronos_httpserver, chronicles_support], - stew/shims/net as stewNet, websock/websock as ws, kzg4844/kzg_ex as kzg, ./core/eip4844, diff --git a/nimbus_verified_proxy/nim.cfg b/nimbus_verified_proxy/nim.cfg index a78b9b558..46d72112c 100644 --- a/nimbus_verified_proxy/nim.cfg +++ b/nimbus_verified_proxy/nim.cfg @@ -1,3 +1,10 @@ +# nimbus_verified_proxy +# Copyright (c) 2022-2024 Status Research & Development GmbH +# Licensed and distributed under either of +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). +# at your option. This file may not be copied, modified, or distributed except according to those terms. + -d:"chronicles_runtime_filtering=on" -d:"chronicles_disable_thread_id" @@ -5,7 +12,6 @@ -d:"chronicles_line_numbers:0" @end --d:chronosStrictException -d:PREFER_BLST_SHA256=false # Use only `secp256k1` public key cryptography as an identity in LibP2P. diff --git a/nimbus_verified_proxy/nimbus_verified_proxy.nim b/nimbus_verified_proxy/nimbus_verified_proxy.nim index eba698011..c62e51d20 100644 --- a/nimbus_verified_proxy/nimbus_verified_proxy.nim +++ b/nimbus_verified_proxy/nimbus_verified_proxy.nim @@ -104,7 +104,7 @@ proc run(config: VerifiedProxyConf) {.raises: [CatchableError].} = verifiedProxy = VerifiedRpcProxy.new(rpcProxy, blockCache, chainId) optimisticHandler = proc(signedBlock: ForkedMsgTrustedSignedBeaconBlock): - Future[void] {.async.} = + Future[void] {.async: (raises: [CancelledError]).} = notice "New LC optimistic block", opt = signedBlock.toBlockId(), wallSlot = getBeaconTime().slotOrZero diff --git a/vendor/nim-chronos b/vendor/nim-chronos index 3ca2c5e6b..09a0b1171 160000 --- a/vendor/nim-chronos +++ b/vendor/nim-chronos @@ -1 +1 @@ -Subproject commit 3ca2c5e6b510c15ce88c94ed25731b30f7ad46b5 +Subproject commit 09a0b117194ed41ee6cebf628404698006d238b4 diff --git a/vendor/nim-eth b/vendor/nim-eth index 2c6049b12..21f3014f5 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit 2c6049b1266a7739f4dca86da4e8c65b75797195 +Subproject commit 21f3014f548618919007910c4aacd47ce2373a46 diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index e3c967ad1..2725be64b 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit e3c967ad1939fb33b8e13759037d193734acd202 +Subproject commit 2725be64bacb46997c0959560d833ff946c8cb3b diff --git a/vendor/nim-stew b/vendor/nim-stew index 2c2544aec..3aa92ab84 160000 --- a/vendor/nim-stew +++ b/vendor/nim-stew @@ -1 +1 @@ -Subproject commit 2c2544aec13536304438be045bfdd22452741466 +Subproject commit 3aa92ab843ee2dbf2198e2d517ceeeb29dcda3d9 diff --git a/vendor/nimbus-eth2 b/vendor/nimbus-eth2 index 5404178a4..d3e10cc7c 160000 --- a/vendor/nimbus-eth2 +++ b/vendor/nimbus-eth2 @@ -1 +1 @@ -Subproject commit 5404178a4004c4bc13c75853a02b1a74f2ca302c +Subproject commit d3e10cc7c6ea002b6918e1cd7cdb8db6ac25489f