mirror of https://github.com/status-im/nim-eth.git
--styleCheck:error (#520)
* --styleCheck:error * testcase -> testCase * more testcase -> testCase * remove unused imports * MessageKind enum name consistency in tests * rest of fuzz_decode_message * rlpEncodeEIP155 -> rlpEncodeEip155
This commit is contained in:
parent
cbb233d8a9
commit
92b14b43eb
10
eth.nimble
10
eth.nimble
|
@ -18,9 +18,15 @@ requires "nim >= 1.2.0",
|
||||||
"testutils",
|
"testutils",
|
||||||
"unittest2"
|
"unittest2"
|
||||||
|
|
||||||
|
let styleCheckStyle =
|
||||||
|
if (NimMajor, NimMinor) < (1, 6):
|
||||||
|
"hint"
|
||||||
|
else:
|
||||||
|
"error"
|
||||||
|
|
||||||
let commonParams = " --verbosity:0 --hints:off --skipUserCfg:on " &
|
let commonParams = " --verbosity:0 --hints:off --skipUserCfg:on " &
|
||||||
"--warning[ObservableStores]:off --styleCheck:usages --styleCheck:hint " &
|
"--warning[ObservableStores]:off --styleCheck:usages --styleCheck:" &
|
||||||
getEnv("NIMFLAGS") & " "
|
styleCheckStyle & " " & getEnv("NIMFLAGS") & " "
|
||||||
|
|
||||||
proc runTest(path: string, release: bool = true, chronosStrict = true) =
|
proc runTest(path: string, release: bool = true, chronosStrict = true) =
|
||||||
echo "\nBuilding and running: ", path
|
echo "\nBuilding and running: ", path
|
||||||
|
|
|
@ -64,7 +64,7 @@ func rlpEncode*(tx: Transaction): auto =
|
||||||
case tx.txType
|
case tx.txType
|
||||||
of TxLegacy:
|
of TxLegacy:
|
||||||
if tx.V >= EIP155_CHAIN_ID_OFFSET:
|
if tx.V >= EIP155_CHAIN_ID_OFFSET:
|
||||||
tx.rlpEncodeEIP155
|
tx.rlpEncodeEip155
|
||||||
else:
|
else:
|
||||||
tx.rlpEncodeLegacy
|
tx.rlpEncodeLegacy
|
||||||
of TxEip2930:
|
of TxEip2930:
|
||||||
|
|
|
@ -13,11 +13,11 @@ test:
|
||||||
of unused: break
|
of unused: break
|
||||||
of ping: encoded = encodeMessage(message.ping, message.reqId)
|
of ping: encoded = encodeMessage(message.ping, message.reqId)
|
||||||
of pong: encoded = encodeMessage(message.pong, message.reqId)
|
of pong: encoded = encodeMessage(message.pong, message.reqId)
|
||||||
of findnode: encoded = encodeMessage(message.findNode, message.reqId)
|
of findNode: encoded = encodeMessage(message.findNode, message.reqId)
|
||||||
of nodes: encoded = encodeMessage(message.nodes, message.reqId)
|
of nodes: encoded = encodeMessage(message.nodes, message.reqId)
|
||||||
of talkreq: encoded = encodeMessage(message.talkreq, message.reqId)
|
of talkReq: encoded = encodeMessage(message.talkReq, message.reqId)
|
||||||
of talkresp: encoded = encodeMessage(message.talkresp, message.reqId)
|
of talkResp: encoded = encodeMessage(message.talkResp, message.reqId)
|
||||||
of regtopic, ticket, regconfirmation, topicquery:
|
of regTopic, ticket, regConfirmation, topicQuery:
|
||||||
break
|
break
|
||||||
|
|
||||||
# This will hit assert because of issue:
|
# This will hit assert because of issue:
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
unittest2,
|
unittest2,
|
||||||
nimcrypto/[utils, sysrand, keccak],
|
nimcrypto/[utils, sysrand],
|
||||||
../../eth/keys, ../../eth/p2p/[auth, rlpxcrypt]
|
../../eth/keys, ../../eth/p2p/[auth, rlpxcrypt]
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
|
# Copyright (c) 2019-2022 Status Research & Development GmbH
|
||||||
|
# Licensed and distributed under either of
|
||||||
|
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
|
||||||
|
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[options, sequtils],
|
std/[options, sequtils],
|
||||||
unittest2,
|
unittest2,
|
||||||
nimcrypto/utils, stew/shims/net,
|
stew/shims/net,
|
||||||
../../eth/p2p/discoveryv5/enr, ../../eth/[keys, rlp]
|
../../eth/p2p/discoveryv5/enr, ../../eth/[keys, rlp]
|
||||||
|
|
||||||
let rng = newRng()
|
let rng = newRng()
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
|
# Copyright (c) 2019-2022 Status Research & Development GmbH
|
||||||
|
# Licensed and distributed under either of
|
||||||
|
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
|
||||||
|
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
unittest2,
|
unittest2,
|
||||||
stew/byteutils, nimcrypto/[keccak, hash],
|
stew/byteutils, nimcrypto/[keccak, hash],
|
||||||
../../eth/trie/[db, binary, binaries, trie_utils, branches]
|
../../eth/trie/[db, binary, binaries, branches]
|
||||||
|
|
||||||
suite "examples":
|
suite "examples":
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ procSuite "Utp protocol over udp tests with loss and delays":
|
||||||
clientProtocol,
|
clientProtocol,
|
||||||
clientSocket,
|
clientSocket,
|
||||||
serverProtocol,
|
serverProtocol,
|
||||||
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testcase.cfg)
|
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testCase.cfg)
|
||||||
|
|
||||||
let smallBytes = 10
|
let smallBytes = 10
|
||||||
let smallBytesToTransfer = rng[].generateBytes(smallBytes)
|
let smallBytesToTransfer = rng[].generateBytes(smallBytes)
|
||||||
|
@ -188,7 +188,7 @@ procSuite "Utp protocol over udp tests with loss and delays":
|
||||||
clientProtocol,
|
clientProtocol,
|
||||||
clientSocket,
|
clientSocket,
|
||||||
serverProtocol,
|
serverProtocol,
|
||||||
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testcase.cfg)
|
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testCase.cfg)
|
||||||
|
|
||||||
let smallBytes = 10
|
let smallBytes = 10
|
||||||
let smallBytesToTransfer = rng[].generateBytes(smallBytes)
|
let smallBytesToTransfer = rng[].generateBytes(smallBytes)
|
||||||
|
@ -233,7 +233,7 @@ procSuite "Utp protocol over udp tests with loss and delays":
|
||||||
clientProtocol,
|
clientProtocol,
|
||||||
clientSocket,
|
clientSocket,
|
||||||
serverProtocol,
|
serverProtocol,
|
||||||
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testcase.cfg)
|
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testCase.cfg)
|
||||||
|
|
||||||
|
|
||||||
let numBytes = testCase.bytesToTransfer
|
let numBytes = testCase.bytesToTransfer
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2020-2021 Status Research & Development GmbH
|
# Copyright (c) 2020-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * 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).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[algorithm, random, sequtils, options],
|
std/[algorithm, random, sequtils, options],
|
||||||
chronos, chronicles,
|
chronos,
|
||||||
testutils/unittests,
|
testutils/unittests,
|
||||||
./test_utils,
|
./test_utils,
|
||||||
../../eth/utp/utp_router,
|
../../eth/utp/utp_router,
|
||||||
|
@ -1089,7 +1089,7 @@ procSuite "Utp socket unit test":
|
||||||
let writeResult = await writeFut
|
let writeResult = await writeFut
|
||||||
|
|
||||||
check:
|
check:
|
||||||
writeResult.isOK()
|
writeResult.isOk()
|
||||||
|
|
||||||
await outgoingSocket.destroyWait()
|
await outgoingSocket.destroyWait()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2021 Status Research & Development GmbH
|
# Copyright (c) 2021-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * 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).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[options, sequtils],
|
std/[options, sequtils],
|
||||||
chronos, chronicles,
|
chronos,
|
||||||
stew/bitops2,
|
stew/bitops2,
|
||||||
testutils/unittests,
|
testutils/unittests,
|
||||||
./test_utils,
|
./test_utils,
|
||||||
|
|
Loading…
Reference in New Issue