Skip to content
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
cc95b08
feat: add submitFundingProposal function
0xChin Jun 9, 2025
a72350b
fix: compiler errors
0xChin Jun 9, 2025
0f53bfe
test: add submitFundingProposal tests
0xChin Jun 9, 2025
0750c11
chore: run pre-pr
0xChin Jun 9, 2025
5654e56
chore: add comments for submitFundingProposal
0xChin Jun 10, 2025
6d5a83b
docs: improve natspec
0xChin Jun 11, 2025
f599dc1
feat: add validation for options length in ProposalValidator
0xChin Jun 13, 2025
c40754b
feat: get votingModuleAddress from ProposalTypeConfigurator
0xChin Jun 13, 2025
088748b
feat: check for proposal existance on submission
0xChin Jun 13, 2025
508c3c6
test: add InvalidOptionsLength tests
0xChin Jun 13, 2025
0e5945b
chore: run pre-pr
0xChin Jun 13, 2025
4c58a92
feat: add submitCouncilMemberElectionsProposal function
0xChin Jun 16, 2025
5fd63d9
chore: run pre-pr
0xChin Jun 16, 2025
a3c9a94
fix: remove duplicated tests
0xChin Jun 17, 2025
277d434
Merge branch 'feat/add-submit-funding-proposal' into feat/add-submit-…
0xChin Jun 17, 2025
f2dceb2
test(fuzz): use fuzz testing for happy paths
0xChin Jun 17, 2025
60ff256
feat: add check for criteria value < optionslength
0xChin Jun 17, 2025
fc64dd0
perf: optimiza for loops usage
0xChin Jun 18, 2025
2b18500
test: fuzz invalid attestationUid
0xChin Jun 18, 2025
26dc6bf
test: fuzz invalid proposer
0xChin Jun 18, 2025
7eb39c3
fix: lack of attestation existance validation
0xChin Jun 18, 2025
48de9ec
test: fuzz exceeded max options test
0xChin Jun 18, 2025
8793805
test: fuzz unapproved attester
0xChin Jun 18, 2025
41465f6
test: reduce upper bound for array size
0xChin Jun 18, 2025
fcf8c58
test: remove duplicated test
0xChin Jun 18, 2025
4fba8df
fix: update criteria value validation logic in ProposalValidator
0xChin Jun 18, 2025
c213e5a
refactor(test): use helper functions for duplicated logic
0xChin Jun 20, 2025
1757d78
refactor: declare approvalVotingModule variable
0xChin Jun 20, 2025
344adfc
test: increment the assertions in council memeber election tests
0xChin Jun 20, 2025
fc0135e
refactor(test): improve tests legibility
0xChin Jun 23, 2025
75657d5
test: use fuzzing instead of individual tests for edge cases
0xChin Jun 23, 2025
4d94daf
test: improve submitFundingProposal assertions
0xChin Jun 23, 2025
d81faa9
test: fuzz proposer
0xChin Jun 23, 2025
878556c
chore(test): remove unused setup variables
0xChin Jun 23, 2025
e7b0e63
test: use fuzzing for sad submitFundingProposal paths
0xChin Jun 23, 2025
c77b1a3
chore: remove redundant tests
0xChin Jun 23, 2025
5cca661
test: use fuzzing for exceeded amount
0xChin Jun 23, 2025
9ec1202
chore: run pre-pr
0xChin Jun 23, 2025
2bbe731
Merge branch 'feat/add-submit-funding-proposal' into feat/add-submit-…
0xChin Jun 23, 2025
5ede7dd
refactor: normalize funding proposal voting modules in global variable
0xChin Jun 23, 2025
03dc4d8
test: fuzz proposal types for revert cases
0xChin Jun 23, 2025
e2df8d6
refactor: use minimal values for funding proposal revert cases tests
0xChin Jun 23, 2025
7745ca4
refactor: use more descriptive variables for testing
0xChin Jun 23, 2025
fe86e3f
Merge branch 'sc-feat/permissionless-proposals' into feat/add-submit-…
0xChin Jun 23, 2025
8038d93
chore: run pre-pr
0xChin Jun 23, 2025
91c38a2
refactor: use variables instead of hardcoded values
0xChin Jun 24, 2025
aaa72c0
chore: rename voting module depending on configurator instead of inte…
0xChin Jun 24, 2025
45a6f58
chore: improve tests naming
0xChin Jun 24, 2025
8d631f9
test: expect proposal type configurator calls
0xChin Jun 25, 2025
e7a18ed
feat: add submitUpgradeProposal function
0xChin Jun 26, 2025
4a23c60
refactor: improve variable names consistency
0xChin Jun 26, 2025
1663277
test: add submitUpgradeProposal tests
0xChin Jun 26, 2025
2e469df
chore: run pre-pr
0xChin Jun 26, 2025
a298f56
Merge branch 'sc-feat/permissionless-proposals' into feat/add-upgrade…
0xChin Jun 26, 2025
29902fe
refactpr(test): separate submitUpgradePropowal tests depending on pro…
0xChin Jun 27, 2025
23c53ca
test: improve coverage on InvalidProposalType tests
0xChin Jun 27, 2025
21f1619
chore: improve code legibility
0xChin Jun 27, 2025
800d77f
chore: improve comments
0xChin Jun 29, 2025
a0f9dd8
Merge branch 'sc-feat/permissionless-proposals' into feat/add-upgrade…
0xChin Jun 29, 2025
2f830a5
fix: merge conflicts
0xChin Jun 29, 2025
9634d2d
fix: broken compile for missing variable
0xChin Jun 29, 2025
4106d8d
fix: broken tests out of enum bounds
0xChin Jun 29, 2025
7478e75
fix: pre-pr
0xChin Jun 29, 2025
9084820
fix: correct order for event emission
0xChin Jun 29, 2025
ca1b9f8
refactor(test): declare events in Init contract
0xChin Jun 30, 2025
6f0bacb
refactor: use constants for code legibility
0xChin Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .semgrep/rules/sol-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ rules:
- packages/contracts-bedrock/src/governance/GovernanceToken.sol
- packages/contracts-bedrock/src/governance/VotingModule.sol
- packages/contracts-bedrock/src/governance/ApprovalVotingModule.sol
- packages/contracts-bedrock/src/governance/OptimisticModule.sol

- id: sol-style-return-arg-fmt
languages: [solidity]
Expand All @@ -155,6 +156,7 @@ rules:
exclude:
- packages/contracts-bedrock/test/safe-tools/CompatibilityFallbackHandler_1_3_0.sol
- packages/contracts-bedrock/src/governance/ApprovalVotingModule.sol
- packages/contracts-bedrock/src/governance/OptimisticModule.sol

- id: sol-style-malformed-require
languages: [solidity]
Expand Down Expand Up @@ -255,6 +257,7 @@ rules:
- packages/contracts-bedrock/src/dispute/SuperFaultDisputeGame.sol
- packages/contracts-bedrock/src/governance/VotingModule.sol
- packages/contracts-bedrock/src/governance/ApprovalVotingModule.sol
- packages/contracts-bedrock/src/governance/OptimisticModule.sol
- packages/contracts-bedrock/src/cannon/libraries/MIPS64Instructions.sol
- packages/contracts-bedrock/src/cannon/libraries/CannonErrors.sol
- packages/contracts-bedrock/src/L2/SuperchainETHBridge.sol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.0;

import {VotingModule} from "src/governance/VotingModule.sol";
import {IVotesUpgradeable} from "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol";

interface IOptimismGovernor {
function propose(
Expand All @@ -21,6 +22,17 @@ interface IOptimismGovernor {

function timelock() external view returns (address);

function PROPOSAL_TYPES_CONFIGURATOR() external view returns (address);

function token() external view returns (IVotesUpgradeable);

function getProposalType(uint256 proposalId) external view returns (uint8);

function proposalVotes(uint256 proposalId)
external
view
returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes);

/// @notice Returns the snapshot block number for a proposal, 0 if proposal doesn't exist
/// @param proposalId The ID of the proposal
/// @return The snapshot block number, or 0 if proposal doesn't exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ interface IProposalValidator is ISemver {
error ProposalValidator_AttestationRevoked();
error ProposalValidator_InvalidAttestationSchema();
error ProposalValidator_InvalidCriteriaValue();
error ProposalValidator_InvalidUpgradeProposalType();
error ProposalValidator_InvalidAgainstThreshold();

struct ProposalData {
address proposer;
Expand Down Expand Up @@ -83,10 +85,10 @@ interface IProposalValidator is ISemver {
bytes encodedVotingModuleData
);

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

event Initialized(uint8 version);

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

function approveProposal(bytes32 _proposalHash, bytes32 _attestationUid) external;

function moveToVote(
Expand Down Expand Up @@ -126,6 +128,13 @@ interface IProposalValidator is ISemver {
ProposalType _proposalType
) external returns (bytes32 proposalHash_);

function submitUpgradeProposal(
uint248 _againstThreshold,
string memory _proposalDescription,
bytes32 _attestationUid,
ProposalType _proposalType
) external returns (bytes32 proposalHash_);

function initialize(
address _owner,
IProposalTypesConfigurator _proposalTypesConfigurator,
Expand All @@ -140,10 +149,10 @@ interface IProposalValidator is ISemver {

function renounceOwnership() external;

function canApproveProposal(bytes32 _attestationUid, address _delegate) external view returns (bool canApprove_);

function transferOwnership(address newOwner) external;

function canApproveProposal(bytes32 _attestationUid, address _delegate) external view returns (bool canApprove_);

function distributionThreshold() external view returns (uint256);

function VOTING_TOKEN() external view returns (IGovernanceToken);
Expand Down
258 changes: 258 additions & 0 deletions packages/contracts-bedrock/snapshots/abi/OptimisticModule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_governor",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "COUNTING_MODE",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "PERCENT_DIVISOR",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "PROPOSAL_DATA_ENCODING",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "VOTE_PARAMS_ENCODING",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint8",
"name": "",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "_countVote",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "_formatExecuteParams",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
},
{
"internalType": "bytes[]",
"name": "",
"type": "bytes[]"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_proposalId",
"type": "uint256"
}
],
"name": "_voteSucceeded",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "proposals",
"outputs": [
{
"internalType": "address",
"name": "governor",
"type": "address"
},
{
"components": [
{
"internalType": "uint248",
"name": "againstThreshold",
"type": "uint248"
},
{
"internalType": "bool",
"name": "isRelativeToVotableSupply",
"type": "bool"
}
],
"internalType": "struct ProposalSettings",
"name": "settings",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_proposalId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_proposalData",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "_descriptionHash",
"type": "bytes32"
}
],
"name": "propose",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "AlreadyVoted",
"type": "error"
},
{
"inputs": [],
"name": "ExistingProposal",
"type": "error"
},
{
"inputs": [],
"name": "InvalidParams",
"type": "error"
},
{
"inputs": [],
"name": "NotGovernor",
"type": "error"
},
{
"inputs": [],
"name": "OptimisticModule_NotOptimisticProposalType",
"type": "error"
},
{
"inputs": [],
"name": "OptimisticModule_OptimisticModuleOnlySignal",
"type": "error"
},
{
"inputs": [],
"name": "OptimisticModule_WrongProposalId",
"type": "error"
}
]
Loading