-
Notifications
You must be signed in to change notification settings - Fork 2
fix: budget cap dos #453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: budget cap dos #453
Conversation
| // validate the attestation | ||
| _validateTopDelegateAttestation(_attestationUid, _msgSender()); | ||
| // proposal.votingCycle should never be 0, voting cycles already exist before the ProposalValidator is deployed | ||
| // and should be set by the OP Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment should be in line 578 https://github.com/defi-wonderland/optimism/pull/453/files#diff-e08ec1b0a9b8fcf25969e83b9aa4058a4a4886602ab43175b02dd8e1b50e6a81R578
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Proposal Validation Mismatch in Voting Cycle
The canApproveProposal function uses an inconsistent voting cycle for attestation validation compared to approveProposal. For ProtocolOrGovernorUpgrade proposals, approveProposal correctly uses the proposal's current votingCycle for validation, while canApproveProposal incorrectly always uses proposal.votingCycle - 1. This discrepancy can lead to canApproveProposal returning misleading results for these proposal types.
packages/contracts-bedrock/src/governance/ProposalValidator.sol#L637-L654
optimism/packages/contracts-bedrock/src/governance/ProposalValidator.sol
Lines 637 to 654 in 3348e3f
| /// @return canApprove_ True if the delegate can approve the proposal, false otherwise. | |
| function canApproveProposal( | |
| bytes32 _attestationUid, | |
| address _delegate, | |
| bytes32 _proposalHash | |
| ) | |
| external | |
| view | |
| returns (bool canApprove_) | |
| { | |
| // TODO: this function should be fixed in OPT-957 | |
| ProposalData storage proposal = _proposals[_proposalHash]; | |
| if (proposal.votingCycle == 0) { | |
| return false; | |
| } | |
| canApprove_ = _validateTopDelegateAttestation(_attestationUid, _delegate, proposal.votingCycle - 1); | |
| } |
Was this report helpful? Give feedback by reacting with 👍 or 👎
* fix: budget cap dos * fix: invalid proposal case * fix: test * fix: tests
* fix: budget cap dos * fix: invalid proposal case * fix: test * fix: tests
Closes OPT-949