-
Notifications
You must be signed in to change notification settings - Fork 810
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
Eth1 data underflow #540
Comments
More broadly, I was thinking of writing a clippy lint to detect and ban all plain additions and subtractions, which we could roll out across the |
I'm also keen to give this a go. |
@michaelsproul would this lint make the cut : https://rust-lang.github.io/rust-clippy/master/#integer_arithmetic ? |
Yeah, it kind of does, I started working with it on Thursday (and fixed a bug rust-lang/rust-clippy#4585). I’m now splitting it into one lint for detecting operations that can overflow, and another for detecting operations that have boundary issues (div or mod by 0, shift by >word size). |
…one sigp#540 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
…one sigp#540 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
…one sigp#540 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
I'm working on this issue, will file a PR to close this. 😃 |
Hmm... should we return Err immediately if underflow is occurred in the subtraction instead of proceed the process with It looks a critical error if the underflow ( |
On overflow the spec raises an exception, so you're right, we should error here rather than proceeding with 0 (see spec). It'll mean that no blocks can be processed until a manual intervention, but the attack requires ~50% of proposers to be compromised, which gets us into social fork territory anyway. |
Thank you for the details! 💡 |
* Fix Eth1 data underflow #540 * Refactor: smart transformation from Option to Result * Add tests for BeaconState::get_outstanding_deposit_len()
lighthouse/eth2/state_processing/src/per_block_processing.rs
Lines 380 to 383 in 192380c
If we accept that
state.eth1_data
is user-supplied input, I believe this subtraction is an underflow risk.@michaelsproul, I'm keen to hear your thoughts.
The text was updated successfully, but these errors were encountered: