forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 2
fix: proposal validator pre-pr #483
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
Merged
0xiamflux
merged 4 commits into
sc-feat/permissionless-proposals
from
fix/proposal-validator-prepr
Aug 12, 2025
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
packages/contracts-bedrock/test/mocks/ProposalValidatorForTest.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity 0.8.15; | ||
|
|
||
| // Interfaces | ||
| import { IOptimismGovernor } from "interfaces/governance/IOptimismGovernor.sol"; | ||
|
|
||
| // Contracts | ||
| import { ProposalValidator } from "src/governance/ProposalValidator.sol"; | ||
|
|
||
| /// @title ProposalValidatorForTest | ||
| /// @notice A test contract that exposes the private _hashProposalWithModule function | ||
| contract ProposalValidatorForTest is ProposalValidator { | ||
| constructor( | ||
| address _owner, | ||
| IOptimismGovernor _governor, | ||
| bytes32 _approvedProposerAttestationSchemaUid, | ||
| bytes32 _topDelegatesAttestationSchemaUid | ||
| ) | ||
| ProposalValidator(_owner, _governor, _approvedProposerAttestationSchemaUid, _topDelegatesAttestationSchemaUid) | ||
| { } | ||
|
|
||
| function hashProposalWithModule( | ||
| address _module, | ||
| bytes memory _proposalData, | ||
| bytes32 _descriptionHash | ||
| ) | ||
| public | ||
| view | ||
| returns (uint256) | ||
| { | ||
| return _hashProposalWithModule(_module, _proposalData, _descriptionHash); | ||
| } | ||
|
|
||
| /// @notice Exposes proposal data for testing | ||
| function getProposalData(uint256 _proposalId) | ||
| public | ||
| view | ||
| returns ( | ||
| address proposer_, | ||
| ProposalType proposalType_, | ||
| bool movedToVote_, | ||
| uint256 approvalCount_, | ||
| uint256 votingCycle_ | ||
| ) | ||
| { | ||
| ProposalData storage proposal = _proposals[_proposalId]; | ||
| return ( | ||
| proposal.proposer, proposal.proposalType, proposal.movedToVote, proposal.approvalCount, proposal.votingCycle | ||
| ); | ||
| } | ||
|
|
||
| function setProposalData( | ||
| uint256 _proposalId, | ||
| address _proposer, | ||
| ProposalType _proposalType, | ||
| bool _movedToVote, | ||
| uint256 _approvalCount, | ||
| uint256 _votingCycle | ||
| ) | ||
| public | ||
| { | ||
| _proposals[_proposalId].proposer = _proposer; | ||
| _proposals[_proposalId].proposalType = _proposalType; | ||
| _proposals[_proposalId].movedToVote = _movedToVote; | ||
| _proposals[_proposalId].approvalCount = _approvalCount; | ||
| _proposals[_proposalId].votingCycle = _votingCycle; | ||
| } | ||
|
|
||
| function mockApproveProposal(uint256 _proposalId, address _delegate) public { | ||
| _proposals[_proposalId].delegateApprovals[_delegate] = true; | ||
| } | ||
|
|
||
| /// @notice Check if a delegate has approved a proposal | ||
| function hasDelegateApproved(uint256 _proposalId, address _delegate) public view returns (bool hasApproved_) { | ||
| return _proposals[_proposalId].delegateApprovals[_delegate]; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
HashProposalWithModule is not a function right?
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.
It is, but it's internal.
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.
Ok lets add a comment on why the Uncategorized so its clear what we are testing
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.
Perfect.
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.
Addressed in here.