support only Nim 1.6+ (#606)

This commit is contained in:
tersec 2023-05-09 20:19:44 +00:00 committed by GitHub
parent 607539d821
commit 7564b21ade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 42 deletions

View File

@ -22,7 +22,7 @@ jobs:
cpu: amd64 cpu: amd64
#- os: windows #- os: windows
#cpu: i386 #cpu: i386
branch: [version-1-2, version-1-4, version-1-6, devel] branch: [version-1-6, devel]
include: include:
- target: - target:
os: linux os: linux
@ -43,7 +43,7 @@ jobs:
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})' name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
runs-on: ${{ matrix.builder }} runs-on: ${{ matrix.builder }}
continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }} continue-on-error: ${{ matrix.branch == 'devel' }}
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- name: Checkout - name: Checkout

View File

@ -4,7 +4,7 @@ description = "Ethereum Common library"
license = "MIT" license = "MIT"
skipDirs = @["tests"] skipDirs = @["tests"]
requires "nim >= 1.2.0", requires "nim >= 1.6.0",
"nimcrypto", "nimcrypto",
"stint", "stint",
"secp256k1", "secp256k1",
@ -18,17 +18,11 @@ requires "nim >= 1.2.0",
"testutils", "testutils",
"unittest2" "unittest2"
let styleCheckStyle =
if (NimMajor, NimMinor) < (1, 6):
"hint"
else:
"error"
let commonParams = let commonParams =
" --skipUserCfg:on" & " --skipUserCfg:on" &
" --verbosity:0 --hints:off" & " --verbosity:0 --hints:off" &
" --warning[ObservableStores]:off" & " --warning[ObservableStores]:off" &
" --styleCheck:usages --styleCheck:" & styleCheckStyle & " --styleCheck:usages --styleCheck:error" &
" " & getEnv("NIMFLAGS") & " " & getEnv("NIMFLAGS") &
" -d:chronosStrictException" & " -d:chronosStrictException" &
" -d:chronicles_log_level=TRACE" " -d:chronicles_log_level=TRACE"

View File

@ -1,12 +1,9 @@
# Copyright (c) 2022 Status Research & Development GmbH # Copyright (c) 2022-2023 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).
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
when (NimMajor, NimMinor) < (1, 4):
{.push raises: [Defect].}
else:
{.push raises: [].} {.push raises: [].}
## keccak256 is used across ethereum as the "default" hash function and this ## keccak256 is used across ethereum as the "default" hash function and this

View File

@ -1,15 +1,12 @@
# Copyright (c) 2022 Status Research & Development GmbH # Copyright (c) 2022-2023 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).
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
when (NimMajor, NimMinor) < (1, 4):
{.push raises: [Defect].}
else:
{.push raises: [].} {.push raises: [].}
## Core ethereum types and smalll helpers - keep focused as it gets imported ## Core ethereum types and small helpers - keep focused as it gets imported
## from many places ## from many places
import import

View File

@ -1,5 +1,5 @@
# beacon_chain # beacon_chain
# Copyright (c) 2018-2020 Status Research & Development GmbH # Copyright (c) 2018-2023 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,10 +8,6 @@
## Simple Key-Value store database interface that allows creating multiple ## Simple Key-Value store database interface that allows creating multiple
## tables within each store ## tables within each store
when (NimMajor, NimMinor) < (1, 4):
{.push raises: [Defect].}
{.pragma: callback, gcsafe, raises: [Defect].}
else:
{.push raises: [].} {.push raises: [].}
{.pragma: callback, gcsafe, raises: [].} {.pragma: callback, gcsafe, raises: [].}

View File

@ -1,9 +1,5 @@
## Implementation of KvStore based on sqlite3 ## Implementation of KvStore based on sqlite3
when (NimMajor, NimMinor) < (1, 4):
{.push raises: [Defect].}
{.pragma: callback, gcsafe, raises: [Defect].}
else:
{.push raises: [Defect].} {.push raises: [Defect].}
{.pragma: callback, gcsafe, raises: [].} {.pragma: callback, gcsafe, raises: [].}

View File

@ -32,9 +32,6 @@ proc expectHash(r: Rlp): seq[byte] =
raise newException(RlpTypeMismatch, raise newException(RlpTypeMismatch,
"RLP expected to be a Keccak hash value, but has an incorrect length") "RLP expected to be a Keccak hash value, but has an incorrect length")
when (NimMajor, NimMinor, NimPatch) < (1, 4, 0):
type AssertionDefect = AssertionError
type MissingNodeError* = ref object of AssertionDefect type MissingNodeError* = ref object of AssertionDefect
path*: NibblesSeq path*: NibblesSeq
nodeHashBytes*: seq[byte] nodeHashBytes*: seq[byte]

View File

@ -35,10 +35,6 @@ proc test_blockBodyTranscode() =
for n in 0 ..< min(trBlkSeq.len, trBlkSeq.len): for n in 0 ..< min(trBlkSeq.len, trBlkSeq.len):
check (n, trBlkSeq[n]) == (n, blkSeq[n]) check (n, trBlkSeq[n]) == (n, blkSeq[n])
when (NimMajor, NimMinor, NimPatch) < (1, 4, 0):
type AssertionDefect = AssertionError
suite "test api usage": suite "test api usage":
test "empty bytes are not a proper RLP": test "empty bytes are not a proper RLP":
var rlp = rlpFromBytes seq[byte](@[]) var rlp = rlpFromBytes seq[byte](@[])