Skip to content
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

MATH_SUB_UNDERFLOW if oracle pushes decreased number of beacon validators #179

Closed
ongrid opened this issue Nov 24, 2020 · 0 comments · Fixed by #196
Closed

MATH_SUB_UNDERFLOW if oracle pushes decreased number of beacon validators #179

ongrid opened this issue Nov 24, 2020 · 0 comments · Fixed by #196
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ongrid
Copy link
Contributor

ongrid commented Nov 24, 2020

If oracle pushes decreased number of beacon validators, the tx reverts with MATH_SUB_UNDERFLOW reason.
Example: https://goerli.etherscan.io/tx/0x8082f551d32aae0560391f08ae8f8a143c21d89a7fdfc371255f918b2d9e97fd

Need to add require check with human-readable revert code to make troubleshooting easier.

   /**
    * @notice Updates the number of Lido-controlled keys in the beacon validators set and their total balance.
    * @dev periodically called by the Oracle contract
    * @param _beaconValidators number of Lido's keys in the beacon state
    * @param _beaconBalance simmarized balance of Lido-controlled keys in wei
    */
    function pushBeacon(uint256 _beaconValidators, uint256 _beaconBalance) external {
        require(msg.sender == getOracle(), "APP_AUTH_FAILED");

        uint256 depositedValidators = DEPOSITED_VALIDATORS_VALUE_POSITION.getStorageUint256();
        require(_beaconValidators <= depositedValidators, "REPORTED_MORE_DEPOSITED");

        uint256 appearedValidators = _beaconValidators.sub(BEACON_VALIDATORS_VALUE_POSITION.getStorageUint256());
@ongrid ongrid added the bug Something isn't working label Nov 24, 2020
@ongrid ongrid added this to the RC3 milestone Nov 24, 2020
@ongrid ongrid modified the milestones: RC3, RC2 Nov 26, 2020
ongrid pushed a commit that referenced this issue Nov 26, 2020
Fixes unobvious revert reason of `MATH_SUB_UNDERFLOW` when
oracle pushes decreased number of beacon validators.
ongrid added a commit that referenced this issue Nov 26, 2020
Fixes unobvious revert reason with `MATH_SUB_UNDERFLOW` when
oracle pushes decreased number of beacon validators.
ongrid added a commit that referenced this issue Nov 26, 2020
Fixes unobvious revert reason with `MATH_SUB_UNDERFLOW` when
oracle pushes decreased number of beacon validators.
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
Fixes unobvious revert reason with `MATH_SUB_UNDERFLOW` when
oracle pushes decreased number of beacon validators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants