reduce compiler warnings

This commit is contained in:
jangko 2023-06-12 11:29:03 +07:00
parent 0128c82c52
commit 8700d8b1e1
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
14 changed files with 20 additions and 21 deletions

View File

@ -28,8 +28,6 @@ from web3/ethtypes import Quantity
#from ../../../premix/downloader import request
#from ../../../premix/parser import prefixHex, parseBlockHeader, parseReceipt, parseTransaction
from eth/common import BlockHeader
# Trying to do things the new web3 way:
from ../../../nimbus_verified_proxy/validate_proof import getAccountFromProof
@ -43,7 +41,7 @@ var fetchCounter*: int
func toHash*(s: string): Hash256 {.raises: [ValueError].} =
hexToPaddedByteArray[32](s).toHash
func toHash*(h: BlockHash): Hash256 {.raises: [ValueError].} =
func toHash*(h: BlockHash): Hash256 {.raises: [].} =
distinctBase(h).toHash
func toWeb3BlockHash*(h: Hash256): BlockHash =

View File

@ -7,7 +7,7 @@
# This file may not be copied, modified, or distributed except according to
# those terms.
import hexstrings, eth/[common, rlp, keys, trie/db], stew/byteutils,
import hexstrings, eth/[common, keys, trie/db], stew/byteutils,
../db/db_chain, strutils, algorithm, options, times, json,
../constants, stint, rpc_types,
../utils/utils, ../transaction,

View File

@ -18,7 +18,6 @@ import
chronicles,
chronos,
eth/[common, p2p, p2p/private/p2p_types],
stew/byteutils,
./trace_config,
./eth/eth_types,
../types,

View File

@ -194,7 +194,7 @@ proc hashNode(t: var TreeBuilder, depth: int, storageMode: bool): NodeKey
proc treeNode(t: var TreeBuilder, depth: int = 0, storageMode = false): NodeKey
proc buildTree*(t: var TreeBuilder): KeccakHash
{.raises: [ContractCodeError, IOError, ParsingError, Exception].} =
{.raises: [ParsingError, Exception].} =
let version = t.safeReadByte().int
if version != BlockWitnessVersion.int:
raise newException(ParsingError, "Wrong block witness version")
@ -216,7 +216,7 @@ proc buildTree*(t: var TreeBuilder): KeccakHash
# chunks, modify this buildForest into chunked witness tree builder
proc buildForest*(
t: var TreeBuilder): seq[KeccakHash]
{.raises: [ContractCodeError, IOError, ParsingError, Exception].} =
{.raises: [ParsingError, Exception].} =
let version = t.safeReadByte().int
if version != BlockWitnessVersion.int:
raise newException(ParsingError, "Wrong block witness version")

View File

@ -1,6 +1,6 @@
import
strutils,
json_serialization/std/[sets, net], serialization/errors,
json_serialization/std/[sets, net],
json_rpc/[client, jsonmarshal],
web3/conversions,
eth/common,

View File

@ -9,7 +9,7 @@
# according to those terms.
import
std/[json, os, tables, strutils, options, times],
std/[json, os, tables, strutils, options],
unittest2,
eth/rlp, eth/trie/trie_defs, eth/common/eth_types_rlp,
stew/byteutils,
@ -224,7 +224,7 @@ proc importBlock(tester: var Tester, com: CommonRef,
proc applyFixtureBlockToChain(tester: var Tester, tb: var TestBlock,
com: CommonRef, checkSeal, validation: bool) =
decompose(tb.blockRLP, tb.header, tb.body)
decompose(tb.blockRLP, tb.header, tb.body)
tester.importBlock(com, tb, checkSeal, validation)
func shouldCheckSeal(tester: Tester): bool =
@ -268,8 +268,8 @@ proc runTester(tester: var Tester, com: CommonRef, testStatusIMPL: var TestStatu
debugEcho "error message: ", res.error
debugEcho "consensusType: ", com.consensus
except:
debugEcho "FATAL ERROR(WE HAVE BUG): ", getCurrentExceptionMsg()
except CatchableError as ex:
debugEcho "FATAL ERROR(WE HAVE BUG): ", ex.msg
else:
var noError = true

View File

@ -6,7 +6,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
std/[strutils, tables, json, os, sets, options, times],
std/[strutils, tables, json, os, sets, options],
./test_helpers, ./test_allowed_to_fail,
../nimbus/core/executor, test_config,
../nimbus/transaction,

View File

@ -9,7 +9,7 @@
import
std/[os, json],
stew/byteutils, unittest2,
stew/byteutils,
eth/[p2p, rlp],
graphql, ../nimbus/graphql/ethapi, graphql/test_common,
../nimbus/sync/protocol,

View File

@ -97,7 +97,7 @@ proc setupEnv(com: CommonRef, signer, ks2: EthAddress, ctx: EthContext): TestEnv
let
receiptRoot = com.db.persistReceipts(vmState.receipts)
date = initDateTime(30, mMar, 2017, 00, 00, 00, 00, utc())
date = dateTime(2017, mMar, 30)
timeStamp = date.toTime
difficulty = com.calcDifficulty(timeStamp, parent)

View File

@ -5,8 +5,10 @@
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import unittest2, eth/trie/[hexary, db],
../nimbus/db/state_db, stew/[byteutils, endians2], eth/common
import
unittest2,
../nimbus/db/state_db,
stew/[byteutils, endians2]
include ../nimbus/db/accounts_cache

View File

@ -131,7 +131,7 @@ proc pp*(tx: Transaction): string =
result &= ",gasLimit=" & tx.gasLimit.toKMG
if tx.to.isSome:
result &= ",to=" & tx.to.get.toXX
if tx.value != 0:
if tx.value.isZero.not:
result &= ",value=" & tx.value.toKMG
if 0 < tx.payload.len:
result &= ",payload=" & tx.payload.toXX

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 2ef34c7339c5d8e59f212d7af72a06e0d3e8327c
Subproject commit 0035f4fa6692e85756aa192b4df84c21d3cacacb

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit 7a835d71683cd60f111b8de4ff047068e4fbda0e
Subproject commit 1f9fa11d0e63c16aa4ec30e1f7328ae61254d7d0

2
vendor/nimbus-eth2 vendored

@ -1 +1 @@
Subproject commit d358aa67cbacc22e77773f4af9fa2aa641f57efc
Subproject commit 22208836b18aaafaafd7c6308ea15b08ff64e323