-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add submit upgrade proposal #429
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 upgrade proposal #429
Conversation
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.
Looks good so far! a few small comments, there are also some conflicts that need to be addressed
| proposalDescription = "Protocol Upgrade Proposal"; | ||
| } | ||
|
|
||
| function testFuzz_submitUpgradeProposal_succeeds( |
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 the logic of this function gets too complex for a unit tests, lets have 2 different tests 1 for maintenance upgrade and 1 for protocol or governor upgrade
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.
| function testFuzz_submitUpgradeProposal_invalidProposalType_reverts(uint8 proposalTypeValue) public { | ||
| // Bound to proposal types that are NOT upgrade proposals (2, 3, 4) | ||
| // Valid upgrade proposal types are ProtocolOrGovernorUpgrade (0) and MaintenanceUpgrade (1) | ||
| proposalTypeValue = uint8(bound(proposalTypeValue, 2, 4)); |
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.
to cover more cases I would change this to assume != 0 && != 1
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.
fix: broken tests out of enum bounds had to change it bc tests were breaking when going out of bounds. will limit to test all the proposal types that are not the valid ones
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.
can you explain a bit more why they fail? if we keep it 2-4 then we dont tests the case where type is >4 which is also an invalid proposal type
| _validateAttestation(_attestationUid, _proposalType); | ||
|
|
||
| // Validate againstThreshold is non-zero and within bounds for percentage-based thresholds | ||
| if (_againstThreshold == 0 || _againstThreshold > 10000) { |
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.
would be good to explain a bit what the 10000 represents in 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 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.
why is this not fixed in the current PR?
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/src/governance/ProposalValidator.sol
Outdated
Show resolved
Hide resolved
Co-authored-by: 0xOneTony <[email protected]> Signed-off-by: Chiin <[email protected]>
| contract ProposalValidator_SubmitUpgradeProposal_Test is ProposalValidator_Init { | ||
| string proposalDescription; | ||
|
|
||
| event ProposalVotingModuleData(bytes32 indexed proposalHash, bytes encodedVotingModuleData); |
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.
We should declare this in the init with the other events
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.
| function testFuzz_submitUpgradeProposal_invalidProposalType_reverts(uint8 proposalTypeValue) public { | ||
| // Bound to proposal types that are NOT upgrade proposals (2, 3, 4) | ||
| // Valid upgrade proposal types are ProtocolOrGovernorUpgrade (0) and MaintenanceUpgrade (1) | ||
| proposalTypeValue = uint8(bound(proposalTypeValue, 2, 4)); |
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.
can you explain a bit more why they fail? if we keep it 2-4 then we dont tests the case where type is >4 which is also an invalid proposal type
* 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 * feat: add submitCouncilMemberElectionsProposal function * chore: run pre-pr * fix: remove duplicated tests * test(fuzz): use fuzz testing for happy paths * feat: add check for criteria value < optionslength * perf: optimiza for loops usage * test: fuzz invalid attestationUid * test: fuzz invalid proposer * fix: lack of attestation existance validation * test: fuzz exceeded max options test * test: fuzz unapproved attester * test: reduce upper bound for array size * test: remove duplicated test * fix: update criteria value validation logic in ProposalValidator * refactor(test): use helper functions for duplicated logic * refactor: declare approvalVotingModule variable * test: increment the assertions in council memeber election tests * 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 * refactor: normalize funding proposal voting modules in global variable * test: fuzz proposal types for revert cases * refactor: use minimal values for funding proposal revert cases tests * refactor: use more descriptive variables for testing * chore: run pre-pr * refactor: use variables instead of hardcoded values * chore: rename voting module depending on configurator instead of internal proposal type * chore: improve tests naming * test: expect proposal type configurator calls * feat: add submitUpgradeProposal function * refactor: improve variable names consistency * test: add submitUpgradeProposal tests * chore: run pre-pr * refactpr(test): separate submitUpgradePropowal tests depending on proposal type * test: improve coverage on InvalidProposalType tests * chore: improve code legibility * chore: improve comments Co-authored-by: 0xOneTony <[email protected]> Signed-off-by: Chiin <[email protected]> * fix: merge conflicts * fix: broken compile for missing variable * fix: broken tests out of enum bounds * fix: pre-pr * fix: correct order for event emission * refactor(test): declare events in Init contract * refactor: use constants for code legibility --------- Signed-off-by: Chiin <[email protected]> Co-authored-by: 0xOneTony <[email protected]>
* 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 * feat: add submitCouncilMemberElectionsProposal function * chore: run pre-pr * fix: remove duplicated tests * test(fuzz): use fuzz testing for happy paths * feat: add check for criteria value < optionslength * perf: optimiza for loops usage * test: fuzz invalid attestationUid * test: fuzz invalid proposer * fix: lack of attestation existance validation * test: fuzz exceeded max options test * test: fuzz unapproved attester * test: reduce upper bound for array size * test: remove duplicated test * fix: update criteria value validation logic in ProposalValidator * refactor(test): use helper functions for duplicated logic * refactor: declare approvalVotingModule variable * test: increment the assertions in council memeber election tests * 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 * refactor: normalize funding proposal voting modules in global variable * test: fuzz proposal types for revert cases * refactor: use minimal values for funding proposal revert cases tests * refactor: use more descriptive variables for testing * chore: run pre-pr * refactor: use variables instead of hardcoded values * chore: rename voting module depending on configurator instead of internal proposal type * chore: improve tests naming * test: expect proposal type configurator calls * feat: add submitUpgradeProposal function * refactor: improve variable names consistency * test: add submitUpgradeProposal tests * chore: run pre-pr * refactpr(test): separate submitUpgradePropowal tests depending on proposal type * test: improve coverage on InvalidProposalType tests * chore: improve code legibility * chore: improve comments Co-authored-by: 0xOneTony <[email protected]> Signed-off-by: Chiin <[email protected]> * fix: merge conflicts * fix: broken compile for missing variable * fix: broken tests out of enum bounds * fix: pre-pr * fix: correct order for event emission * refactor(test): declare events in Init contract * refactor: use constants for code legibility --------- Signed-off-by: Chiin <[email protected]> Co-authored-by: 0xOneTony <[email protected]>
Closes OPT-826, OPT-827, OPT-880