eth2-testgen/eth2_testgen/shuffling/README.md

1.6 KiB

Shuffling Test Generator

2018 Status Research & Development GmbH
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

This work uses public domain work under CC0 from the Ethereum Foundation
https://github.com/ethereum/eth2.0-specs

This file implements a test vectors generator for the shuffling algorithm described in the Ethereum specs

Reference picture:

and description from Py-EVM

validators:
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
After shuffling:
    [6, 0, 2, 12, 14, 8, 10, 4, 9, 1, 5, 13, 15, 7, 3, 11]
Split by slot:
    [
        [6, 0, 2, 12, 14], [8, 10, 4, 9, 1], [5, 13, 15, 7, 3, 11]
    ]
Split by shard:
    [
        [6, 0], [2, 12, 14], [8, 10], [4, 9, 1], [5, 13, 15] ,[7, 3, 11]
    ]
Fill to output:
    [
        # slot 0
        [
            ShardAndCommittee(shard_id=0, committee=[6, 0]),
            ShardAndCommittee(shard_id=1, committee=[2, 12, 14]),
        ],
        # slot 1
        [
            ShardAndCommittee(shard_id=2, committee=[8, 10]),
            ShardAndCommittee(shard_id=3, committee=[4, 9, 1]),
        ],
        # slot 2
        [
            ShardAndCommittee(shard_id=4, committee=[5, 13, 15]),
            ShardAndCommittee(shard_id=5, committee=[7, 3, 11]),
        ],
    ]