Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Feb 14, 2024
1 parent d4108b4 commit cdc41b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 7 additions & 3 deletions contracts/Cross-chain/OmnichainGovernanceExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ contract OmnichainGovernanceExecutor is ReentrancyGuard, BaseOmnichainController
enum ProposalState {
Canceled,
Queued,
Executed,
Pending
Executed
}

/**
Expand Down Expand Up @@ -128,6 +127,11 @@ contract OmnichainGovernanceExecutor is ReentrancyGuard, BaseOmnichainController
*/
event SetSrcChainId(uint16 indexed oldSrcChainId, uint16 indexed newSrcChainId);

/**
* @notice Thrown when proposal ID is invalid.
*/
error InvalidProposalId();

constructor(address endpoint_, address guardian_, uint16 srcChainId_) BaseOmnichainControllerDest(endpoint_) {
ensureNonzeroAddress(guardian_);
GUARDIAN = guardian_;
Expand Down Expand Up @@ -250,7 +254,7 @@ contract OmnichainGovernanceExecutor is ReentrancyGuard, BaseOmnichainController
// queued only when proposal is received
return ProposalState.Queued;
} else {
return ProposalState.Pending;
revert InvalidProposalId();
}
}

Expand Down
9 changes: 5 additions & 4 deletions tests/Cross-chain/Omnichain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,13 @@ describe("Omnichain: ", async function () {

it("Revert if proposal is not queued", async function () {
const proposalId = (await getLastRemoteProposalId()).add(1);
await expect(executor.connect(deployer).cancel(proposalId)).to.be.revertedWith(
"OmnichainGovernanceExecutor::cancel: proposal should be queued and not executed",
await expect(executor.connect(deployer).cancel(proposalId)).to.be.revertedWithCustomError(
executor,
"InvalidProposalId",
);
});
it("Return Pending state when proposal is not queued", async function () {
expect(await executor.state(1000)).to.equals(3);
it("Revert when proposal is not queued", async function () {
await expect(executor.state(1000)).to.be.revertedWithCustomError(executor, "InvalidProposalId");
});

it("Emit ProposalCanceled event when proposal gets canceled", async function () {
Expand Down

0 comments on commit cdc41b6

Please sign in to comment.