mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-13 20:24:22 +00:00
Shuffling Tests
Tests for the swap-or-not shuffling in ETH 2.0.
For implementers, possible test runners implementing testing can include:
- just test permute-index, run it for each index
i
inrange(count)
, and check against expectedoutput[i]
(default spec implementation) - test un-permute-index (the reverse lookup. Implemented by running the shuffling rounds in reverse: from
round_count-1
to0
) - test the optimized complete shuffle, where all indices are shuffled at once, test output in one go.
- test complete shuffle in reverse (reverse rounds, same as 2)
Tips for initial shuffling write:
- run with
round_count = 1
first, do the same with pyspec. - start with permute index
- optimized shuffling implementations:
- vitalik, Python: https://github.com/ethereum/eth2.0-specs/pull/576#issue-250741806
- protolambda, Go: https://github.com/protolambda/eth2-shuffle