eth2-testgen/eth2_testgen/shuffling
Chih Cheng Liang d77b8b289a Refactor python script (#4)
* refactor python script

* update objects and helpers to follow the latest spec

* minimize validators' representation
2018-12-27 11:03:05 +01:00
..
README.md Refactor python script (#4) 2018-12-27 11:03:05 +01:00
constants.py Refactor python script (#4) 2018-12-27 11:03:05 +01:00
core_helpers.py Refactor python script (#4) 2018-12-27 11:03:05 +01:00
enums.py Refactor python script (#4) 2018-12-27 11:03:05 +01:00
tgen_shuffling.py Refactor python script (#4) 2018-12-27 11:03:05 +01:00
utils.py Refactor python script (#4) 2018-12-27 11:03:05 +01:00
yaml_objects.py Refactor python script (#4) 2018-12-27 11:03:05 +01:00

README.md

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]),
        ],
    ]