Skip to content
Business logic Audit finding Intermediate

The logic in _handleVoteOverride to determine if an account is the transcoder is not consistent with the logic in the BondManager.sol

The vote-counting logic in GovernorCountingOverridable.sol used a simple address comparison to decide if a voter is a transcoder, which does not match the BondingManager's definition of a registered transcoder. This inconsistency could cause a regular delegator to be treated as a transcoder, leading to incorrect deduction of voting power.

ladboy233 Follow

Originally disclosed on Code4rena

Submitted by ladboy233

In the current implementation, when voting, the function _countVote is triggered, this function is overridden in the function GovernorCountingOverridable.sol

    _weight = _handleVoteOverrides(_proposalId, tally, voter, _account, _weight);

This is calling:

   function _handleVoteOverrides(
        uint256 _proposalId,
        ProposalTally storage _tally,
        ProposalVoterState storage _voter,
        address _account,
        uint256 _weight
    ) internal returns (uint256) {

        uint256 timepoint = proposalSnapshot(_proposalId);

        address delegate = votes().delegatedAt(_account, timepoint);

        // @audit
        // is transcoder?
        bool isTranscoder = _account == delegate;

        if (isTranscoder) {
            // deduce weight from any previous delegators for this transcoder to
            // make a vote
            return _weight - _voter.deductions;
        }

The logic to determine if an account is the transcoder is too simple in this line of code:

// @audit
// is transcoder?
bool isTranscoder = _account == delegate;

And does not match the logic that determine if the address is an registered transcorder and an active transcoder in the bondManager.sol.

In BondManager.sol, the function that used to check if a transcoder is registered is in this line of code:

    /**
     * @notice Return whether a transcoder is registered
     * @param _transcoder Transcoder address
     * @return true if transcoder is self-bonded
     */
    function isRegisteredTranscoder(address _transcoder) public view returns (bool) {
        Delegator storage d = delegators[_transcoder];
        return d.delegateAddress == _transcoder && d.bondedAmount > 0;
    }

The function that is used to check if a transcoder is active is in this line of code.

    function isActiveTranscoder(address _transcoder) public view returns (bool) {
        Transcoder storage t = transcoders[_transcoder];
        uint256 currentRound = roundsManager().currentRound();
        return t.activationRound <= currentRound && currentRound < t.deactivationRound;
    }

Missing the check in the delegator’s bond amount (delegators[_transcoder].bondeAmount > 0).

The code incorrectedly counts regular delegator as transcoder and does not update the deduction power correctly.

Recommended Mitigation Steps

Reuse the function isRegisteredTranscoder and isActiveTranscoder to determine if an account is a registered and active transcoder when counting the voting power.

Assessed type

Governance

victorges (Livepeer) confirmed and commented:

There is in fact an issue with the inconsistency with the isRegisteredTranscodeer function. This report didn’t manage to go specifically into that issue, but still pointed a valid problem which is in a sense the root cause there. FTR There is no problem with isActiveTranscoder though, since we don’t give voting power only to active transcoders. That part of this report is invalid.

victorges (Livepeer) mitigated:

https://github.com/livepeer/protocol/pull/626


The original report as published on Code4rena, by ladboy233. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the vote-counting contract determined transcoder status by comparing the voter's address to their delegate, instead of reusing the BondingManager's isRegisteredTranscoder check that also requires a positive self-bond.

What the attacker needed

A governance proposal with votes; a delegator voting

The fix

The vote-counting logic should reuse isRegisteredTranscoder (and possibly isActiveTranscoder) to determine transcoder status; the project mitigated this in a pull request.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In this voting system, a 'transcoder' is a special participant who can vote with the weight of people who delegated to them. The code that counts votes used a shortcut to check if someone is a transcoder, but that shortcut did not match the official definition used elsewhere. As a result, a normal delegator could be mistaken for a transcoder, which messes up how voting power is calculated.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by ladboy233

View all

47 more disclosed reports, best first.

More from Livepeer Onchain Treasury Upgrade

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.