Skip to content
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

test: add proposalProposer cancellation in Pending #78

Merged
merged 1 commit into from
Oct 23, 2024
Merged
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
14 changes: 12 additions & 2 deletions test/Governor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,19 +448,29 @@ describe('Governor Contact', () => {
expect(deployer.address).to.equal(guardianAddress)
})

it('proposalProposer should be able to cancel proposal in Pending state', async () => {
let state: bigint
await createProposal('cancel pending proposal')
state = await governor.state(proposalId)
expect(state).to.equal(ProposalState.Pending)
await governor.connect(holders[0])['cancel(uint256)'](proposalId)
state = await governor.state(proposalId)
expect(state).to.equal(ProposalState.Canceled)
})

it('should not be possible to cancel the proposal by proposalProposer if not in Pending state', async () => {
await createProposal('should it be possible to cancel when not in pending?')
await mine((await governor.votingDelay()) + 1n)

const state = await governor.state(proposalId)

expect(state).to.equal(ProposalState.Active)
const tx = governor['cancel(uint256)'](proposalId)
const tx = governor.connect(holders[0])['cancel(uint256)'](proposalId)

expect(tx).to.be.revertedWithCustomError({ interface: governor.interface }, unexpectedProposalState)
})

describe('guardian should be able to cancel proposals even if it is not proposalProposer', async () => {
describe('Guardian should be able to cancel proposals even if it is not proposalProposer', async () => {
before(async () => {
const dispenseTx = await rif.transfer(holders[1].address, dispenseValue)
await dispenseTx.wait()
Expand Down
Loading