user-checkPoL Security Guidelines: Validator

Threat 1: Duplicate or Missed Validator Rewards During Block Reward Distribution

Validators receive block creation rewards on the execution layer, so they must retrieve information from the consensus layer. If incorrect information is verified during this process, block reward distribution errors can occur.

Impact

Low

Duplicate or missed validator rewards can cause losses for validators, but the probability of a successful attack is very low due to the Merkle root verification technique. Therefore, it is rated as Low.

Guideline

  • Implement a mechanism to prevent duplicate processing of the same timestamp

  • Cryptographic verification of the Beacon block root and proposer index/pubkey

    • Use the SSZ.verifyProof3 function to verify the proposer's reward eligibility based on the beacon root of a specific timestamp.

    • A revert occurs if verification fails.

    if (!SSZ.verifyProof(proposerIndexProof, beaconBlockRoot, proposerIndexRoot, proposerIndexGIndex)) {
      InvalidProof.selector.revertWith();
    }

Best Practice

Distributor.solarrow-up-right


Threat 2: Exploitation of the Operator Change Process

If the operator set by a validator is maliciously changed or their authority is hijacked, the BGT delegated to the validator could be managed improperly. This can lead to a loss of trust and reputation among delegators, resulting in a decrease in BGT delegation.

Impact

Low

The damage from a malicious operator is limited to reputational damage and reduced future revenue from BGT delegation, rather than direct loss of delegated assets. Therefore, it is rated as Low.

Guideline

  • Prevent abrupt changes during operator changes through a queue mechanism and time delay4

    • Insert an operator change request into a queue by setting key = pubkey, value = new operator.

    • An operator change is only possible after a 1-day delay (currently implemented in the contract code).

  • Mechanism for forced operator change/cancellation through governance or a trusted third party

    • Verify that msg.sender of cancelOperatorChange is the operator or governance.

    • Impose penalties for actions like intentional and sudden increases or decreases in commission by the operator.

  • During an operator change, establish a lock-up period and gradual transfer of authority4 for existing deposits

    • Initially, grant only reward distribution rights to allow boosters to evaluate the operator β†’ After providing time to unboost (unboost delay = 2000 blocks), grant the authority to change the commission.

  • Prevent the operator address from being set to the zero address

Best Practice

BeaconDeposit.solarrow-up-right


Threat 3: Funds Frozen Until Validator Exits Cap Due to Non-existent Withdrawal Logic

Currently, Berachain does not have a logic for validators to voluntarily withdraw their deposited funds. Therefore, it is impossible to withdraw funds deposited on the chain in case of emergency or need.

Before Bectra, Berachain withdraw logic

Impact

Low

Funds are frozen due to the absence of a voluntary withdrawal logic5, but they can be recovered upon forced exit according to Berachain's ValidatorSetCap6. This has a potential impact on network stability rather than asset loss, so it is rated as Low.

Guideline

  • Add and verify deposit/withdrawal logic, and set adjustable withdrawal limits and lock-up periods through governance

    • Withdrawal Waiting Period

      • Set to be the same as the governance timelock period (2 days).

    • Verification during requestWithdrawal:

      • Whether the caller is a valid validator.

      • Whether the requested amount exceeds the validator's withdrawable deposit (or the excess amount excluding the minimum deposit requirement).

      • Whether it exceeds the active withdrawal request limit (number of times, total amount).

    • Verification during claimWithdrawal:

      • Whether the caller is the rightful recipient of the withdrawal request.

      • Whether the withdrawal request status is READY_FOR_CLAIM.

      • Whether the unlockTime has actually passed.

    • Considerations for Withdrawal Limits and Lock-up Periods

      • Network Stability: Prevents a sudden mass exit of validators that could weaken network security.

      • Liquidity Management: Gives the protocol time to prepare for sudden liquidity outflows and manage funds stably.

      • Decision Prudence: Provides validators with enough time to deliberate before making a withdrawal decision.

      • Market Volatility Response: Can slow down chain reactions of fund withdrawals caused by panic selling during sharp market fluctuations.

  • Implement a step-by-step withdrawal process using a queue system

    • requestWithdrawal (called by validator/user):

      • When a validator requests a withdrawal, immediately deduct the requested amount from the validator's deposit, or switch it to a withdrawal pending state to exclude it from additional staking reward calculations.

    • processWithdrawal (called by system/operator):

      • Identifies withdrawal requests whose unlockTime has arrived and processes the funds to a state where they can be actually withdrawn.

    • claimWithdrawal (called by validator/user):

      • The validator (or designated recipient) finally withdraws the funds, which have become withdrawable through processWithdrawal, to their own wallet.

    • Lifecycle:

      • Request (PENDING): When requestWithdrawal is called, a Withdrawal struct is created, and the unlockTime is calculated and stored.

      • Processing Wait: Remains in the PENDING state while block.timestamp < unlockTime.

      • Ready for Claim (READY_FOR_CLAIM): Becomes READY_FOR_CLAIM when block.timestamp >= unlockTime and the state is changed via processWithdrawal (or similar system logic).

      • Completed (COMPLETED): The state changes when the validator calls claimWithdrawal to receive the funds.

    • Basis for Setting Penalties:

      • Opportunity Cost and System Stability Contribution Reward:

        • Other validators who follow the normal withdrawal procedure contribute to network stability and provide liquidity during that period. An emergency withdrawal breaks this implicit agreement, so a cost is paid for it.

      • Preventing Abuse of Emergency Withdrawals:

        • If there were no penalty, everyone would use the emergency withdrawal, so this encourages its use only when absolutely necessary.

      • Penalty Level:

        • A base penalty + additional penalty is imposed in proportion to the remaining lock-up period.

          • Base_Penalty_Rate: The basic minimum penalty rate (e.g., 5%).

          • Time_Remaining_In_Lock: The time remaining in the normal lock-up period.

          • Total_Lock_Period: The total lock-up period originally set.

          • Additional_Penalty_Factor: A penalty coefficient that is additionally imposed the earlier the lock-up period is broken (e.g., 10%).

triangle-exclamation

Best Practice

Last updated