Skip to content

Commit

Permalink
QSP-16 Proposals Can Pass without a Valid Sponsor
Browse files Browse the repository at this point in the history
  • Loading branch information
brossetti1 committed Oct 3, 2022
1 parent deb3925 commit e090e14
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion contracts/Baal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ contract Baal is Module, EIP712Upgradeable, ReentrancyGuardUpgradeable, BaseRela
{
Proposal storage prop = proposals[id]; /*alias `proposal` storage pointers*/

require(state(id) == ProposalState.Ready, "!ready");
require(prop.sponsor != address(0), "!sponsor"); /*check proposal has been sponsored*/
require(state(id) == ProposalState.Ready, "!ready"); /* check proposal is Ready to process */

ProposalState prevProposalState = state(prop.prevProposalId);
require(
Expand Down
22 changes: 18 additions & 4 deletions test/BaalSafe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const revertMessages = {
submitProposalOffering: "Baal requires an offering",
submitVoteTimeEnded: "ended",
sponsorProposalExpired: "expired",
sponsorProposalSponsor: "!sponsor",
proposalNotSponsored: "!sponsor",
sponsorProposalNotSubmitted: "!submitted",
submitVoteNotSponsored: "!sponsored",
submitVoteNotVoting: "!voting",
Expand All @@ -54,6 +54,7 @@ const revertMessages = {
submitVoteWithSigVoted: "voted",
submitVoteWithSigMember: "!member",
processProposalNotReady: "!ready",
proposalNotSponsored: '!sponsor',
ragequitUnordered: "!order",
// unsetGuildTokensLastToken: 'reverted with panic code 0x32 (Array accessed at an out-of-bounds or negative index)',
sharesTransferPaused: "!transferable",
Expand Down Expand Up @@ -2300,7 +2301,7 @@ describe("Baal contract", function () {
);

await expect(shamanBaal.sponsorProposal(1)).to.be.revertedWith(
revertMessages.sponsorProposalSponsor
revertMessages.proposalNotSponsored
);
});

Expand Down Expand Up @@ -2725,8 +2726,21 @@ describe("Baal contract", function () {
await baal.submitVote(1, yes);
const state = await baal.state(2);
expect(state).to.equal(STATES.UNBORN);
});

it("require fail - no sponser", async function () {
await baal.submitProposal(
proposal.data,
proposal.expiration,
proposal.baalGas,
ethers.utils.id(proposal.details)
);
await baal.submitVote(1, yes);
const state = await baal.state(2);
expect(state).to.equal(STATES.UNBORN);
proposal.sponsor = null;
await expect(baal.processProposal(2, proposal.data)).to.be.revertedWith(
revertMessages.processProposalNotReady
revertMessages.proposalNotSponsored
);
});

Expand Down Expand Up @@ -2780,7 +2794,7 @@ describe("Baal contract", function () {
ethers.utils.id(proposal.details)
);
await expect(baal.processProposal(1, proposal.data)).to.be.revertedWith(
revertMessages.processProposalNotReady
revertMessages.proposalNotSponsored
); // fail at submitted
await baal.sponsorProposal(1);
await expect(baal.processProposal(1, proposal.data)).to.be.revertedWith(
Expand Down

0 comments on commit e090e14

Please sign in to comment.