Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/snapshots/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@
"sourceCodeHash": "0x18f43b227decd0f2a895b8b55e23fa6a47706697c272bbf2482b3f912be446e1"
},
"src/governance/ProposalValidator.sol:ProposalValidator": {
"initCodeHash": "0xd072e288107128a1b0f26f41c4b257295919777cadfc06514d2a4738fb96e1d1",
"sourceCodeHash": "0x725efcbb68cb4a23af492983ba22969ddaa5d472878fb8490a437eaaa88812a8"
"initCodeHash": "0x30d570ce61624852476452d9660567bae2346002878a45703cf60e44809730ca",
"sourceCodeHash": "0xe5272e8176b0ddf3ff589629f7872b5dc6c18b900f413f0f8682865bf310faa7"
},
"src/legacy/DeployerWhitelist.sol:DeployerWhitelist": {
"initCodeHash": "0x53099379ed48b87f027d55712dbdd1da7d7099925426eb0531da9c0012e02c29",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ contract ProposalValidator is OwnableUpgradeable, ReinitializableBase, ISemver {
revert ProposalValidator_ProposalAlreadyApproved();
}

// check if proposal has already moved to vote
if (proposal.movedToVote) {
revert ProposalValidator_ProposalAlreadyMovedToVote();
}

// validate the attestation
_validateTopDelegateAttestation(_attestationUid, _msgSender());

Expand Down
17 changes: 17 additions & 0 deletions packages/contracts-bedrock/test/governance/ProposalValidator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,23 @@ contract ProposalValidator_ApproveProposal_TestFail is ProposalValidator_Init {
validator.approveProposal(_proposalHash, topDelegateAttestation_A);
}

function test_approveProposal_proposalAlreadyMovedToVote_reverts(
bytes32 _proposalHash,
uint8 proposalTypeValue
)
public
{
// Bound the proposal type to valid enum values (0-4)
proposalTypeValue = uint8(bound(proposalTypeValue, 0, 4));
ProposalValidator.ProposalType proposalType = ProposalValidator.ProposalType(proposalTypeValue);
// set proposal data so that the proposal exists and set movedToVote to true
validator.setProposalData(_proposalHash, topDelegate_A, proposalType, true, 0, CYCLE_NUMBER);

vm.expectRevert(IProposalValidator.ProposalValidator_ProposalAlreadyMovedToVote.selector);
vm.prank(topDelegate_A);
validator.approveProposal(_proposalHash, topDelegateAttestation_A);
}

function test_approveProposal_invalidSchema_reverts(bytes32 _proposalHash, uint8 proposalTypeValue) public {
// Bound the proposal type to valid enum values (0-4)
proposalTypeValue = uint8(bound(proposalTypeValue, 0, 4));
Expand Down