Skip to content

staking storage contract, getNodeOperatorFeesInfo function fails #334

Description

@botnumberseven

When I call the function below on otp mainnet, it fails and returns
ContractPanicError: ('Panic error 0x11: Arithmetic operation results in underflow or overflow.', '0x4e487b710000000000000000000000000000000000000000000000000000000000000011')

I think it's because node.operatorFeeCumulativeEarnedRewards is zero (we have none of them in v8), while node.operatorFeeCumulativePaidOutRewards is non-zero (fee were transferred from v6 and i restaked 1 TRAC from them). So the result is negative and it makes the contract sad.

function getNodeOperatorFeesInfo(uint72 identityId) external view returns (uint96, uint96, uint96) {
    StakingLib.NodeData memory node = nodes[identityId];
    return (
        node.operatorFeeBalance,
        node.operatorFeeCumulativeEarnedRewards - node.operatorFeeCumulativePaidOutRewards,
        node.operatorFeeCumulativePaidOutRewards
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions