mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-28 23:34:59 +00:00
297e9079d4
* Update BLS fixtures to 0.8.3 * Bump fixtures with shuffling with minimal preset * Update shuffling tests * parseTest generic over file format (Json or SSZ) * Initial crosslink parsing commit for debugging Nim crash * Workaround https://github.com/status-im/nim-beacon-chain/issues/369 * Crosslink test works for minimal - https://github.com/status-im/nim-beacon-chain/issues/369 is back on mainnet * Use ref objects to workaround https://github.com/status-im/nim-beacon-chain/issues/369 * Generalize state transition epoch test to all epoch tests * Fix slashing (potential uint64 overflow in previous spec) * Add a state debugging macro to deeply inspect the wrong fields * make reportDiff visible * Improve the debug state macro for containers
31 lines
1.1 KiB
Nim
31 lines
1.1 KiB
Nim
# beacon_chain
|
|
# Copyright (c) 2018-Present 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.
|
|
|
|
import
|
|
# Standard library
|
|
os, unittest,
|
|
# Beacon chain internals
|
|
../../beacon_chain/spec/[datatypes, validator, digest],
|
|
# Test utilities
|
|
../testutil,
|
|
./fixtures_utils
|
|
|
|
type
|
|
Shuffling* = object
|
|
seed*: Eth2Digest
|
|
count*: uint64
|
|
mapping*: seq[ValidatorIndex]
|
|
|
|
const ShufflingDir = JsonTestsDir/const_preset/"phase0"/"shuffling"/"core"/"shuffle"
|
|
|
|
suite "Official - Shuffling tests [Preset: " & preset():
|
|
test "Shuffling a sequence of N validators" & preset():
|
|
for file in walkDirRec(ShufflingDir):
|
|
let t = parseTest(file, Json, Shuffling)
|
|
let implResult = get_shuffled_seq(t.seed, t.count)
|
|
check: implResult == t.mapping
|