Skip to content

MATH_SUB_UNDERFLOW if oracle pushes decreased number of beacon validators #179

Closed
@ongrid

Description

@ongrid

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());

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions