mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-03 03:24:59 -05: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
iinrange(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-1to0) - 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 = 1first, 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