2019-06-30 12:58:53 +00:00
|
|
|
# Genesis creation testing
|
|
|
|
|
|
|
|
Tests the initialization of a genesis state based on Eth1 data.
|
|
|
|
|
|
|
|
## Test case format
|
|
|
|
|
2019-07-30 12:09:20 +00:00
|
|
|
### `eth1_block_hash.yaml`
|
|
|
|
|
|
|
|
A `Bytes32` hex encoded, with prefix 0x. The root of the Eth-1 block.
|
|
|
|
|
|
|
|
A `eth1_block_hash.ssz` is available as substitute.
|
|
|
|
|
|
|
|
### `eth1_timestamp.yaml`
|
|
|
|
|
|
|
|
An integer. The timestamp of the block, in seconds.
|
|
|
|
|
|
|
|
### `meta.yaml`
|
|
|
|
|
|
|
|
A yaml file to help read the deposit count:
|
|
|
|
|
2019-07-30 13:06:15 +00:00
|
|
|
```yaml
|
2019-07-30 12:09:20 +00:00
|
|
|
deposits_count: int -- Amount of deposits.
|
|
|
|
```
|
|
|
|
|
2019-07-30 13:06:15 +00:00
|
|
|
### `deposits_<index>.yaml`
|
|
|
|
|
|
|
|
A series of files, with `<index>` in range `[0, deposits_count)`. Deposits need to be processed in order.
|
|
|
|
Each file is a YAML-encoded `Deposit` object.
|
2019-07-30 12:09:20 +00:00
|
|
|
|
2019-07-31 00:02:50 +00:00
|
|
|
Each deposit is also available as `deposits_<index>.ssz`.
|
2019-07-30 12:09:20 +00:00
|
|
|
|
|
|
|
### `state.yaml`
|
|
|
|
|
2019-07-30 13:06:15 +00:00
|
|
|
The expected genesis state. A YAML-encoded `BeaconState` object.
|
2019-07-30 12:09:20 +00:00
|
|
|
|
|
|
|
Also available as `state.ssz`.
|
|
|
|
|
|
|
|
## Processing
|
2019-06-30 12:58:53 +00:00
|
|
|
|
|
|
|
To process this test, build a genesis state with the provided `eth1_block_hash`, `eth1_timestamp` and `deposits`:
|
|
|
|
`initialize_beacon_state_from_eth1(eth1_block_hash, eth1_timestamp, deposits)`,
|
|
|
|
as described in the Beacon Chain specification.
|
|
|
|
|
|
|
|
## Condition
|
|
|
|
|
|
|
|
The resulting state should match the expected `state`.
|