--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:
tersec 2022-07-21 08:58:17 +00:00 committed by GitHub
parent cbb233d8a9
commit 92b14b43eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 18 deletions

View File

@ -18,9 +18,15 @@ requires "nim >= 1.2.0",
"testutils",
"unittest2"
let styleCheckStyle =
if (NimMajor, NimMinor) < (1, 6):
"hint"
else:
"error"
let commonParams = " --verbosity:0 --hints:off --skipUserCfg:on " &
"--warning[ObservableStores]:off --styleCheck:usages --styleCheck:hint " &
getEnv("NIMFLAGS") & " "
"--warning[ObservableStores]:off --styleCheck:usages --styleCheck:" &
styleCheckStyle & " " & getEnv("NIMFLAGS") & " "
proc runTest(path: string, release: bool = true, chronosStrict = true) =
echo "\nBuilding and running: ", path

View File

@ -64,7 +64,7 @@ func rlpEncode*(tx: Transaction): auto =
case tx.txType
of TxLegacy:
if tx.V >= EIP155_CHAIN_ID_OFFSET:
tx.rlpEncodeEIP155
tx.rlpEncodeEip155
else:
tx.rlpEncodeLegacy
of TxEip2930:

View File

@ -13,11 +13,11 @@ test:
of unused: break
of ping: encoded = encodeMessage(message.ping, 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 talkreq: encoded = encodeMessage(message.talkreq, message.reqId)
of talkresp: encoded = encodeMessage(message.talkresp, message.reqId)
of regtopic, ticket, regconfirmation, topicquery:
of talkReq: encoded = encodeMessage(message.talkReq, message.reqId)
of talkResp: encoded = encodeMessage(message.talkResp, message.reqId)
of regTopic, ticket, regConfirmation, topicQuery:
break
# This will hit assert because of issue:

View File

@ -11,7 +11,7 @@
import
unittest2,
nimcrypto/[utils, sysrand, keccak],
nimcrypto/[utils, sysrand],
../../eth/keys, ../../eth/p2p/[auth, rlpxcrypt]
const data = [

View File

@ -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.}
import
std/[options, sequtils],
unittest2,
nimcrypto/utils, stew/shims/net,
stew/shims/net,
../../eth/p2p/discoveryv5/enr, ../../eth/[keys, rlp]
let rng = newRng()

View File

@ -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.}
import
unittest2,
stew/byteutils, nimcrypto/[keccak, hash],
../../eth/trie/[db, binary, binaries, trie_utils, branches]
../../eth/trie/[db, binary, binaries, branches]
suite "examples":

View File

@ -132,7 +132,7 @@ procSuite "Utp protocol over udp tests with loss and delays":
clientProtocol,
clientSocket,
serverProtocol,
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testcase.cfg)
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testCase.cfg)
let smallBytes = 10
let smallBytesToTransfer = rng[].generateBytes(smallBytes)
@ -188,7 +188,7 @@ procSuite "Utp protocol over udp tests with loss and delays":
clientProtocol,
clientSocket,
serverProtocol,
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testcase.cfg)
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testCase.cfg)
let smallBytes = 10
let smallBytesToTransfer = rng[].generateBytes(smallBytes)
@ -233,7 +233,7 @@ procSuite "Utp protocol over udp tests with loss and delays":
clientProtocol,
clientSocket,
serverProtocol,
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testcase.cfg)
serverSocket) = await testScenario(testCase.maxDelay, testCase.dropRate, testCase.cfg)
let numBytes = testCase.bytesToTransfer

View File

@ -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
# * 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 @@
import
std/[algorithm, random, sequtils, options],
chronos, chronicles,
chronos,
testutils/unittests,
./test_utils,
../../eth/utp/utp_router,
@ -1089,7 +1089,7 @@ procSuite "Utp socket unit test":
let writeResult = await writeFut
check:
writeResult.isOK()
writeResult.isOk()
await outgoingSocket.destroyWait()

View File

@ -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
# * 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 @@
import
std/[options, sequtils],
chronos, chronicles,
chronos,
stew/bitops2,
testutils/unittests,
./test_utils,