Workers Auto Approve
Block processing testing
During the latest spec update and code restructure we lost a lot of our block processing testing.
The objective of this issue is:
**implement regression testing that ensures block processing fails when supplied an invalid parameter.**
Block processing lives in the [`state_processing`](https://github.com/sigp/lighthouse/tree/master/eth2/state_processing) crate, specifically in the [`per_block_processing.rs`](https://github.com/sigp/lighthouse/blob/master/eth2/state_processing/src/per_block_processing.rs) file and [`per_block_processing/`](https://github.com/sigp/lighthouse/tree/master/eth2/state_processing/src/per_block_processing) dir.
Tests should be implemented in a new file: `... state_processing/src/per_block_processing/tests.rs`.
The task will primarily consist of:
- Devise some valid block and accompanying state and ensure it passes block validation.
- For each test, modify the valid block (or state?) to trigger some invalidity condition and assert that that condition was triggered by inspecting the error chain (i.e., ensure the returned `Result` is erroneous and the `Error` is correct).
We have a suite of "builders" in [`types/src/test_utils/`](https://github.com/sigp/lighthouse/tree/master/eth2/types/src/test_utils) that are perfect for this task. For example, `TestingBeaconBlockBuilder` and `TestingBeaconStateBuilder` will produce valid blocks and states "from thin air", without needing to build a whole chain.
The best resource for learning how to use these builders is in the "old" (circa last week, before a spec update) benching code, which is presently not compiling (sorry). Particularly the [BlockBenchingBuilder](https://github.com/sigp/lighthouse/blob/master/eth2/state_processing/benches/block_benching_builder.rs). I would probably start by copying the `BlockBenchingBuilder` and modifying it into the `BlockProcessingTestBuilder` (or w/e, name not well thought out).
I'm imagining this sort of flow:
let spec = ChainSpec::foundation();
let builder = BlockProcessingTestBuilder::new(...);
let (mut block, mut state) = builder.build();
state.slot = 133713
block.slot = 424242;
let result = per_block_processing(&mut state, &block, &spec);
_Note: this is pseudo-code. Won't compile, may have errors._
Setup your profile
Tell us a little about you:
No results found for
Type to search skills..
Required [[totalcharacter]] / 240
Are you currently looking for work?
[[ option.string ]]
Setup your profile
Our tools are based on the principles of earn (💰), learn (📖), and meet (💬).
Select the ones you are interested in. You can change it later in your settings.
I'm also an organization manager looking for a great community.
Enable your organization profile
Gitcoin products can help grow community around your brand. Create your tribe, events, and incentivize your community with bounties. Announce new and upcoming events using townsquare. Find top-quality hackers and fund them to work with you on a grant.
These are the organizations you own. If you don't see your organization here please be sure that information is public on your GitHub profile. Gitcoin will sync this information for you.
Select the products you are interested in:
Out of the box you will receive Tribes Lite for your organization. Please provide us with a contact email: