-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add submit funding proposal #411
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
feat: add submit funding proposal #411
Conversation
0xOneTony
left a comment
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.
Also still thinking about storing only the address instead of the voting module type. Afaik the address of the voting module can change for a specific type so this becomes an issue if we dont have also a function to change that address. I will get back to this.
packages/contracts-bedrock/src/governance/ProposalValidator.sol
Outdated
Show resolved
Hide resolved
0xOneTony
left a comment
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.
There are some names and tests that are the same lets check all of them to make sure we dont repeat code
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
0xOneTony
left a comment
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.
Tests need some further improvement, also added a comment about the for loops on the logic side
|
|
||
| // Expect ProposalSubmitted event | ||
| vm.expectEmit(address(validator)); | ||
| emit ProposalSubmitted(expectedHash, rando, description, ProposalValidator.ProposalType.GovernanceFund); |
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 it would be better if we fuzzed the proposer instead of using a "random" address
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.
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
| vm.prank(owner); | ||
| validator.setProposalTypeData( | ||
| ProposalValidator.ProposalType.GovernanceFund, | ||
| ProposalValidator.ProposalTypeData({ | ||
| requiredApprovals: PROPOSAL_REQUIRED_APPROVALS, | ||
| proposalVotingModule: 3 | ||
| }) | ||
| ); | ||
|
|
||
| criteriaValue = 50; | ||
| optionsDescriptions = new string[](2); | ||
| optionsDescriptions[0] = "Option A"; | ||
| optionsDescriptions[1] = "Option B"; | ||
|
|
||
| optionsRecipients = new address[](2); | ||
| optionsRecipients[0] = makeAddr("recipient1"); | ||
| optionsRecipients[1] = makeAddr("recipient2"); | ||
|
|
||
| optionsAmounts = new uint256[](2); | ||
| optionsAmounts[0] = 1000 ether; | ||
| optionsAmounts[1] = 500 ether; | ||
|
|
||
| description = "Test funding proposal"; |
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.
This setup is repeated in ProposalValidator_SubmitFundingProposal_Test aswell, maybe defining the proposal type data is something that could be added in the Init contract since this will probably be needed to happen in most of the tests?
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.
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.
given that these values will mostly be fuzzed and that the values can vary depending on the proposal that is being made, for example funding proposals require being given amount, while council member election proposal don't, I'm not sure having them in the Init is the way to go. wdyt?
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 with the usage of _setGovernanceFundProposalType its enough, the rest of the hardcoded values should be fuzzed where possible
packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Outdated
Show resolved
Hide resolved
0xOneTony
left a comment
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.
lgtm! 🔥
* feat: add submitFundingProposal function * fix: compiler errors * test: add submitFundingProposal tests * chore: run pre-pr * chore: add comments for submitFundingProposal * docs: improve natspec * feat: add validation for options length in ProposalValidator * feat: get votingModuleAddress from ProposalTypeConfigurator * feat: check for proposal existance on submission * test: add InvalidOptionsLength tests * chore: run pre-pr * fix: remove duplicated tests * perf: optimiza for loops usage * refactor(test): improve tests legibility * test: use fuzzing instead of individual tests for edge cases * test: improve submitFundingProposal assertions * test: fuzz proposer * chore(test): remove unused setup variables * test: use fuzzing for sad submitFundingProposal paths * chore: remove redundant tests * test: use fuzzing for exceeded amount * chore: run pre-pr
* feat: add submitFundingProposal function * fix: compiler errors * test: add submitFundingProposal tests * chore: run pre-pr * chore: add comments for submitFundingProposal * docs: improve natspec * feat: add validation for options length in ProposalValidator * feat: get votingModuleAddress from ProposalTypeConfigurator * feat: check for proposal existance on submission * test: add InvalidOptionsLength tests * chore: run pre-pr * fix: remove duplicated tests * perf: optimiza for loops usage * refactor(test): improve tests legibility * test: use fuzzing instead of individual tests for edge cases * test: improve submitFundingProposal assertions * test: fuzz proposer * chore(test): remove unused setup variables * test: use fuzzing for sad submitFundingProposal paths * chore: remove redundant tests * test: use fuzzing for exceeded amount * chore: run pre-pr
Closes OPT-785
🚨 Spec-Breaking Changes
This implementation includes two significant deviations from the original specification that require discussion and approval:
1. Changed
proposalVotingModuleType:uint8→addressOriginal Spec:
ProposalTypeData.proposalVotingModulewas defined asuint8Implementation: Changed to
addressJustification:
Impact: All structs, interfaces, and function signatures now use
addressinstead ofuint82. Interpreted
criteriaValueas Absolute Token Count (Not Percentage)Original Spec/NatSpec: Described
criteriaValueas "percentage that will be used to calculate the fraction of the votable supply"Implementation: Treats
criteriaValueas absolute token count required for options to passJustification:
optionVotes[i] >= settings.criteriaValue)Impact: Functions expect token amounts (e.g.,
1000 ether) rather than percentage valuesNote: These changes align the implementation with the actual ApprovalVotingModule contract behavior and our independent governance architecture.