Skip to content

Commit

Permalink
reduce compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Jun 12, 2023
1 parent 0128c82 commit 8700d8b
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 21 deletions.
4 changes: 1 addition & 3 deletions nimbus/evm/async/data_sources/json_rpc_data_source.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion nimbus/rpc/rpc_utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion nimbus/sync/protocol/eth67.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import
chronicles,
chronos,
eth/[common, p2p, p2p/private/p2p_types],
stew/byteutils,
./trace_config,
./eth/eth_types,
../types,
Expand Down
4 changes: 2 additions & 2 deletions stateless/tree_from_witness.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/rpcclient/eth_api.nim
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_blockchain_json.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_generalstate_json.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_graphql.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rpc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 4 additions & 2 deletions tests/test_state_db.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_txpool/helpers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vendor/nim-web3
2 changes: 1 addition & 1 deletion vendor/nimbus-eth2
Submodule nimbus-eth2 updated 107 files

0 comments on commit 8700d8b

Please sign in to comment.