Add nim 2.0 and devel to CI matrix

This commit is contained in:
jangko 2024-02-14 07:46:40 +07:00
parent a58baa4162
commit 0306443c52
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
7 changed files with 21 additions and 14 deletions

View File

@ -8,7 +8,7 @@ jobs:
max-parallel: 20
matrix:
test_lang: [c]
branch: [version-1-6]
branch: [version-1-6, version-2-0, devel]
target:
- os: linux
cpu: amd64

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ build/
*.dylib
*.a
*.exe
nimble.paths

4
config.nims Normal file
View File

@ -0,0 +1,4 @@
# begin Nimble config (version 1)
when fileExists("nimble.paths"):
include "nimble.paths"
# end Nimble config

View File

@ -1,8 +1,8 @@
# Copyright (c) 2018 Status Research & Development GmbH
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0).
import ./proof_of_work, ./private/conversion
import endians, random, math, nimcrypto
import ./proof_of_work
import random, math, nimcrypto
proc mulCarry(a, b: uint64): tuple[carry, unit: uint64] =
## Multiplication in extended precision

View File

@ -1,4 +1,4 @@
# Copyright (c) 2018 Status Research & Development GmbH
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0).
import math, endians,
@ -17,7 +17,7 @@ const
DATASET_BYTES_GROWTH* = 2'u64^23 # dataset growth per epoch
CACHE_BYTES_INIT* = 2'u64^24 # bytes in cache at genesis
CACHE_BYTES_GROWTH* = 2'u64^17 # cache growth per epoch
CACHE_MULTIPLIER = 1024 # Size of the DAG relative to the cache
CACHE_MULTIPLIER* = 1024 # Size of the DAG relative to the cache
EPOCH_LENGTH* = 30000 # blocks per epoch
MIX_BYTES* = 128 # width of mix
HASH_BYTES* = 64 # hash length in bytes
@ -31,7 +31,7 @@ const
proc get_cache_size*(block_number: uint64): uint64 {.noSideEffect.}=
result = CACHE_BYTES_INIT + CACHE_BYTES_GROWTH * (block_number div EPOCH_LENGTH)
result -= HASH_BYTES
while (let dm = divmod(result, HASH_BYTES);
while (let dm = intmath.divmod(result, HASH_BYTES);
dm.rem == 0 and not dm.quot.isPrime):
# In a static lang, checking that the result of a division is prime
# means checking that remainder == 0 and quotient is prime
@ -40,7 +40,7 @@ proc get_cache_size*(block_number: uint64): uint64 {.noSideEffect.}=
proc get_data_size*(block_number: uint64): uint64 {.noSideEffect.}=
result = DATASET_BYTES_INIT + DATASET_BYTES_GROWTH * (block_number div EPOCH_LENGTH)
result -= MIX_BYTES
while (let dm = divmod(result, MIX_BYTES);
while (let dm = intmath.divmod(result, MIX_BYTES);
dm.rem == 0 and not dm.quot.isPrime):
result -= 2 * MIX_BYTES

View File

@ -1,6 +1,8 @@
# Copyright (c) 2018 Status Research & Development GmbH
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0).
{. warning[UnusedImport]:off .}
import ./test_internal_multiprecision_arithmetic,
./test_proof_of_work

View File

@ -3,7 +3,7 @@
include ../src/mining
import unittest, random
import unittest
suite "[Internal] Testing multi-precision arithmetic":
test "Multi-Precision multiplication gives the proper unit (modulo 2^64)":