2019-06-30 14:58:53 +02:00
# Genesis creation testing
Tests the initialization of a genesis state based on Eth1 data.
## Test case format
2021-03-22 02:50:05 +01:00
### `eth1.yaml`
2019-07-30 14:09:20 +02:00
2021-03-22 02:50:05 +01:00
```yaml
eth1_block_hash: Bytes32 -- A `Bytes32` hex encoded, with prefix 0x. The root of the Eth1 block. E.g. "0x4242424242424242424242424242424242424242424242424242424242424242"
eth1_timestamp: int -- An integer. The timestamp of the block, in seconds.
```
2019-07-30 14:09:20 +02:00
### `meta.yaml`
A yaml file to help read the deposit count:
2019-07-30 15:06:15 +02:00
```yaml
2021-10-03 22:20:53 +08:00
description: string -- Optional. Description of test case, purely for debugging purposes.
deposits_count: int -- Amount of deposits.
execution_payload_header: bool -- `execution_payload_header` field is filled or not. If `true` , `execution_payload_header.ssz_snappy` file exists.
2019-07-30 14:09:20 +02:00
```
2020-10-08 21:02:18 +02:00
### `deposits_<index>.ssz_snappy`
2019-07-30 15:06:15 +02:00
A series of files, with `<index>` in range `[0, deposits_count)` . Deposits need to be processed in order.
2020-10-08 21:02:18 +02:00
Each file is a SSZ-snappy encoded `Deposit` object.
2019-07-30 14:09:20 +02:00
2021-10-03 16:16:59 +03:00
### `execution_payload_header.ssz_snappy`
2021-12-22 15:46:18 +08:00
*Note*: Param added only for Bellatrix and subsequent forks.
2021-10-03 16:16:59 +03:00
The execution payload header that state is initialized with. An SSZ-snappy encoded `BeaconState` object.
2020-10-08 21:02:18 +02:00
### `state.ssz_snappy`
2019-07-30 14:09:20 +02:00
2021-03-13 12:42:51 +08:00
The expected genesis state. An SSZ-snappy encoded `BeaconState` object.
2019-07-30 14:09:20 +02:00
## Processing
2019-06-30 14:58:53 +02: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` .