-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible consensus bug with proposer slashings #1065
Comments
The spec has no explicit concurrency, Lighthouse may have optimized it wrong, and the edge case deserves a test. After first slashing, validator.slashed = True, and is-slashable will be False and abort the 2nd slashing. |
Can confirm the bug;
The operations are verified with a parallel iterator, only reading the state. Rust doesn't complain here. And then the slashings are applied, and the two proposer slashings that were valid on the pre-state, but not the specced intermediate state, would be confirmed. Maybe it's a good idea to adjust |
Thanks @JustinDrake, this is a great pickup. I think this comes from back when I was working on serenity-benches, so I'll take responsibility for this. We do this type of parallel execution for several block-operations processing functions because we saw a significant gain from doing BLS verification on multiple cores. Now we're doing batch BLS verification and we never* actually verify signatures during *: we still verify signatures during deposits processing. Perhaps keeping only concurrent signature verification here is sensible. |
I had a look at attestation processing, and it looks like it's safe because it only verifies the indexed attestations in parallel, and does the actual slashing in series, checking the non-empty slashing condition here: lighthouse/eth2/state_processing/src/per_block_processing/verify_attester_slashing.rs Line 97 in 26bdc29
For proposer slashings, I agree we could remove the parallel iterator entirely. And I guess we could defensively remove all parallel iterators from state processing? Oh damn, and I just checked the op pool, which I thought handled this correctly, but it looks like it doesn't :\ It takes great care to avoid including duplicate attester slashings, but just piles in all the proposer slashings that are compatible with a single state: lighthouse/eth2/operation_pool/src/lib.rs Lines 237 to 246 in 15a3af8
|
In this particular instance it may be wise to remove the |
As a meta question for @zedt3ster, why didn't the fuzzing infrastructure catch this bug or the recent consensus bug in Prysm regarding reward calculations? |
@JustinDrake Prysm introduced the bug just a few days before testnet launch with a last-minute v0.11 update. Can't catch something with fuzzing when the fuzzer doesn't run the code. But I'm sure it could have, if it were up to date. |
So our beacon fuzz fuzzers were targeting We're currently revamping the differential fuzzer completely to include new mutation engines and leveraging structural fuzzing. In fact, we just identified an SSZ decoding/processing bug in Prysm. The differential part of the fuzzers is currently "on hold", we'll be sharing a new design this week - this type of bug could definitely be picked up in the future. |
I'm going to fix this |
Remove parallelism for proposer slashing verification. Closes #1065
Remove parallelism from proposer slashing verification. Closes #1065
Remove parallelism from proposer slashing verification. Closes #1065
The
process_proposer_slashings
function has two key steps, namely verifying the proposer slashings in parallel and then callingslash_validator
once perproposer_slashing
. The parallel proposer slashing verification seems to assume proposer slashings can be verified independently but there is some state dependency inassert is_slashable_validator(proposer, get_current_epoch(state))
(see spec here).Specifically, if the same (unslashed) validator is put several times in
process_proposer_slashings
then the second proposer slashing should throw an error. As far as I can tellslash_validator
in Lighthouse will not throw an error if the validator is already slashed andprocess_proposer_slashings
will not throw an error if the same validator is slashed several times.The text was updated successfully, but these errors were encountered: