a290a3c537
## Issue Addressed Successor to #2431 ## Proposed Changes * Add a `BlockReplayer` struct to abstract over the intricacies of calling `per_slot_processing` and `per_block_processing` while avoiding unnecessary tree hashing. * Add a variant of the forwards state root iterator that does not require an `end_state`. * Use the `BlockReplayer` when reconstructing states in the database. Use the efficient forwards iterator for frozen states. * Refactor the iterators to remove `Arc<HotColdDB>` (this seems to be neater than making _everything_ an `Arc<HotColdDB>` as I did in #2431). Supplying the state roots allow us to avoid building a tree hash cache at all when reconstructing historic states, which saves around 1 second flat (regardless of `slots-per-restore-point`). This is a small percentage of worst-case state load times with 200K validators and SPRP=2048 (~15s vs ~16s) but a significant speed-up for more frequent restore points: state loads with SPRP=32 should be now consistently <500ms instead of 1.5s (a ~3x speedup). ## Additional Info Required by https://github.com/sigp/lighthouse/pull/2628 |
||
---|---|---|
.. | ||
src | ||
.gitignore | ||
Cargo.toml | ||
Makefile | ||
README.md |
state_transition_vectors
This crate contains test vectors for Lighthouse state transition functions.
This crate serves two purposes:
- Outputting the test vectors to disk via
make
. - Running the vectors against our code via
make test
.
Outputting vectors to disk
Whilst we don't actually need to write the vectors to disk to test them, we provide this functionality so we can generate corpra for the fuzzer and also so they can be of use to other clients.
To create the files in ./vectors
(directory relative to this crate), run:
make
This will produce a directory structure that looks roughly like this:
vectors
└── exit
├── invalid_bad_signature
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_duplicate
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_exit_already_initiated
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_future_exit_epoch
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_not_active_after_exit_epoch
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_not_active_before_activation_epoch
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_too_young_by_a_lot
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_too_young_by_one_epoch
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── invalid_validator_unknown
│ ├── block.ssz
│ ├── error.txt
│ └── pre.ssz
├── valid_genesis_epoch
│ ├── block.ssz
│ ├── post.ssz
│ └── pre.ssz
└── valid_previous_epoch
├── block.ssz
├── post.ssz
└── pre.ssz