You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
But the owner of tokenId is not Voter contract.
So BribeRewarder.sol#deposit() is always reverted.
We can see this fact from Voter.sol#vote() function.
function vote(uint256tokenId, address[] calldatapools, uint256[] calldatadeltaAmounts) external {
if (pools.length!= deltaAmounts.length) revertIVoter__InvalidLength();
// check voting startedif (!_votingStarted()) revertIVoter_VotingPeriodNotStarted();
if (_votingEnded()) revertIVoter_VotingPeriodEnded();
// check ownership of tokenId161@>if (_mlumStaking.ownerOf(tokenId) !=msg.sender) {
revertIVoter__NotOwner();
}
...
for (uint256 i =0; i < pools.length; ++i) {
address pool = pools[i];
...
_notifyBribes(_currentVotingPeriodId, pool, tokenId, deltaAmount); // msg.sender, deltaAmount);
}
_totalVotes += totalUserVotes;
_hasVotedInPeriod[currentPeriodId][tokenId] =true;
emitVoted(tokenId, currentPeriodId, pools, deltaAmounts);
}
We can see on L161, owner of tokenId is caller of Voter.sol#vote() function.
Impact
Voting is always reverted when it has bribes to notify.
sherlock-admin4
changed the title
Petite Rouge Huskie - Voting is always reverted when it has bribes to notify.
dany.armstrong90 - Voting is always reverted when it has bribes to notify.
Jul 29, 2024
dany.armstrong90
High
Voting
is always reverted when it hasbribes
to notify.Summary
BribeRewarder.sol#_modify()
checks thatmsg.sender
is owner of tokenId.So when it is called from
Voter
, this call is always reverted.Vulnerability Detail
BribeRewarder.sol#deposit()
function which is called fromVoter
contract is as follows.Here,
BribeRewarder.sol#_modify()
function is as follows.On L264, it checks that
msg.sender
(voter contract
) is owner of tokenId.Voter.sol#ownerOf()
which is called here is as follows.But the owner of tokenId is not
Voter
contract.So
BribeRewarder.sol#deposit()
is always reverted.We can see this fact from
Voter.sol#vote()
function.We can see on L161, owner of tokenId is caller of
Voter.sol#vote()
function.Impact
Voting
is always reverted when it hasbribes
to notify.Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/rewarders/BribeRewarder.sol#L264
Tool used
Manual Review
Recommendation
BribeRewarder.sol#_modify()
function has to be modified as follows.Duplicate of #39
The text was updated successfully, but these errors were encountered: