2021-03-09 02:11:31 +00:00
|
|
|
# Forks
|
|
|
|
|
|
|
|
The aim of the fork tests is to ensure that a pre-fork state can be transformed
|
|
|
|
into a valid post-fork state, utilizing the `upgrade` function found in the relevant `fork.md` spec.
|
|
|
|
|
2021-03-09 23:27:06 +00:00
|
|
|
There is only one handler: `fork`. Each fork (after genesis) is handled with the same format,
|
2021-03-09 02:11:31 +00:00
|
|
|
and the particular fork boundary being tested is noted in `meta.yaml`.
|
|
|
|
|
|
|
|
## Test case format
|
|
|
|
|
|
|
|
### `meta.yaml`
|
|
|
|
|
|
|
|
A yaml file to signify which fork boundary is being tested.
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
fork: str -- Fork being transitioned to
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Fork strings
|
|
|
|
|
|
|
|
Key of valid `fork` strings that might be found in `meta.yaml`
|
|
|
|
|
|
|
|
| String ID | Pre-fork | Post-fork | Function |
|
|
|
|
| - | - | - | - |
|
|
|
|
| `altair` | Phase 0 | Altair | `upgrade_to_lightclient_patch` |
|
|
|
|
|
2021-03-10 23:48:53 +00:00
|
|
|
### `pre.ssz_snappy`
|
2021-03-09 02:11:31 +00:00
|
|
|
|
2021-03-10 23:48:53 +00:00
|
|
|
A SSZ-snappy encoded `BeaconState`, the state before running the fork transition.
|
2021-03-09 02:11:31 +00:00
|
|
|
|
2021-03-10 23:48:53 +00:00
|
|
|
### `post.ssz_snappy`
|
2021-03-09 02:11:31 +00:00
|
|
|
|
2021-03-10 23:48:53 +00:00
|
|
|
A SSZ-snappy encoded `BeaconState`, the state after applying the fork transition.
|
2021-03-09 02:11:31 +00:00
|
|
|
|
|
|
|
*Note*: This type is the `BeaconState` after the fork and is *not* the same type as `pre`.
|
|
|
|
|
|
|
|
## Processing
|
|
|
|
|
|
|
|
To process this test, pass `pre` into the upgrade function defined by the `fork` in `meta.yaml`.
|
|
|
|
|
|
|
|
## Condition
|
|
|
|
|
|
|
|
The resulting state should match the expected `post`.
|