From 6cfaaf5b459ca4df248796e5da0f814d18e95613 Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 12 Jul 2022 15:56:01 +0700 Subject: [PATCH] bump json-rpc, secp256k1, blscurve, and accompanying fixes --- config.nims | 7 +++++++ nimbus/sealer.nim | 26 ++------------------------ tests/test_clique/pool.nim | 2 +- tests/test_merge.nim | 11 +++++------ vendor/nim-blscurve | 2 +- vendor/nim-json-rpc | 2 +- vendor/nim-secp256k1 | 2 +- 7 files changed, 18 insertions(+), 34 deletions(-) diff --git a/config.nims b/config.nims index 495eda013..ae0432a16 100644 --- a/config.nims +++ b/config.nims @@ -119,3 +119,10 @@ switch("warning", "ObservableStores:off") # Too many false positives for "Warning: method has lock level , but another method has 0 [LockLevel]" switch("warning", "LockLevel:off") +# nimbus-eth1 doesn't use 'news' nor ws client, only websock server. set the backend package to websock. +switch("define", "json_rpc_websocket_package:websock") + +if defined(windows) and defined(i386): + # avoid undefined reference to 'sqrx_mont_384x' when compiling in 32 bit mode + # without actually using __BLST_PORTABLE__ or __BLST_NO_ASM__ + switch("define", "BLS_FORCE_BACKEND:miracl") diff --git a/nimbus/sealer.nim b/nimbus/sealer.nim index 033c59243..b5105a2f7 100644 --- a/nimbus/sealer.nim +++ b/nimbus/sealer.nim @@ -12,7 +12,6 @@ import std/[times, tables, typetraits, options], pkg/[chronos, stew/results, - stew/byteutils, chronicles, eth/common, eth/keys, @@ -53,9 +52,6 @@ type signer: EthAddress txPool: TxPoolRef -template asEthHash(hash: Web3BlockHash): Hash256 = - Hash256(data: distinctBase(hash)) - proc validateSealer*(conf: NimbusConf, ctx: EthContext, chain: Chain): Result[void, string] = if conf.engineSigner == ZERO_ADDRESS: return err("signer address should not zero, use --engine-signer to set signer address") @@ -121,7 +117,7 @@ proc prepareBlock(engine: SealingEngineRef, ok(blk) proc generateBlock(engine: SealingEngineRef, - parentBlockHeader: BlockHeader, + parentHeader: BlockHeader, outBlock: var EthBlock, timestamp = getTime(), prevRandao = Hash256()): Result[void, string] = @@ -129,7 +125,7 @@ proc generateBlock(engine: SealingEngineRef, # - no DAO hard fork # - no local and remote uncles inclusion - let res = prepareBlock(engine, parentBlockHeader, timestamp, prevRandao) + let res = prepareBlock(engine, parentHeader, timestamp, prevRandao) if res.isErr: return err("error prepare header") @@ -146,24 +142,6 @@ proc generateBlock(engine: SealingEngineRef, ok() -proc generateBlock(engine: SealingEngineRef, - parentHash: Hash256, - outBlock: var EthBlock, - timestamp = getTime(), - prevRandao = Hash256()): Result[void, string] = - var parentBlockHeader: BlockHeader - if engine.chain.db.getBlockHeader(parentHash, parentBlockHeader): - generateBlock(engine, parentBlockHeader, outBlock, timestamp, prevRandao) - else: - # TODO: - # This hack shouldn't be necessary if the database can find - # the genesis block hash in `getBlockHeader`. - let maybeGenesisBlock = engine.chain.currentBlock() - if parentHash == maybeGenesisBlock.blockHash: - generateBlock(engine, maybeGenesisBlock, outBlock, timestamp, prevRandao) - else: - return err "parent block not found" - proc generateBlock(engine: SealingEngineRef, outBlock: var EthBlock, timestamp = getTime(), diff --git a/tests/test_clique/pool.nim b/tests/test_clique/pool.nim index 28e9bccda..5a7028bdb 100644 --- a/tests/test_clique/pool.nim +++ b/tests/test_clique/pool.nim @@ -22,7 +22,7 @@ import ./voter_samples as vs, eth/[common, keys, p2p, rlp, trie/db], ethash, - secp256k1_abi, + secp256k1/abi, stew/objects export diff --git a/tests/test_merge.nim b/tests/test_merge.nim index 2e4d86ce5..7b9ae5973 100644 --- a/tests/test_merge.nim +++ b/tests/test_merge.nim @@ -8,14 +8,14 @@ # those terms. import - std/[json, os, sets, strformat, strutils, typetraits], - unittest2, nimcrypto, eth/common as eth_common, - json_rpc/[rpcserver, rpcclient], web3/[conversions, engine_api_types], + std/[json, os, sets, strutils, typetraits], + unittest2, eth/common as eth_common, + json_rpc/[rpcserver, rpcclient], web3/[engine_api_types], eth/[trie/db, p2p/private/p2p_types], ../nimbus/sync/protocol, - ../nimbus/rpc/[common, p2p, hexstrings, rpc_types, rpc_utils, engine_api], + ../nimbus/rpc/[p2p, engine_api], ../nimbus/db/[db_chain], - ../nimbus/[chain_config, config, context, genesis, sealer], + ../nimbus/[config, context, genesis, sealer], ../nimbus/utils/[tx_pool], ../nimbus/p2p/chain, ../nimbus/merge/mergetypes, @@ -138,7 +138,6 @@ proc `==`(a, b: Quantity): bool = uint64(a) == uint64(b) proc testEngineApiSupport() = - var db = newBaseChainDB(newMemoryDB()) var api = EngineAPI.new() let id1 = toId(1) diff --git a/vendor/nim-blscurve b/vendor/nim-blscurve index 91253d684..5bd4a0859 160000 --- a/vendor/nim-blscurve +++ b/vendor/nim-blscurve @@ -1 +1 @@ -Subproject commit 91253d684d0a2aebe08c2e98677c85387113b854 +Subproject commit 5bd4a085923d6c3be8ee095d06d1ec8473ebb6aa diff --git a/vendor/nim-json-rpc b/vendor/nim-json-rpc index 335f292a5..d618b555e 160000 --- a/vendor/nim-json-rpc +++ b/vendor/nim-json-rpc @@ -1 +1 @@ -Subproject commit 335f292a5816910aebf215e3a88db8a665133e0e +Subproject commit d618b555e791a4b1112a2fb1ca1c5c52960f0ae7 diff --git a/vendor/nim-secp256k1 b/vendor/nim-secp256k1 index d790c4220..5340cf188 160000 --- a/vendor/nim-secp256k1 +++ b/vendor/nim-secp256k1 @@ -1 +1 @@ -Subproject commit d790c42206fab4b8008eaa91181ca8c8c68a0105 +Subproject commit 5340cf188168d6afcafc8023770d880f067c0b2f