Skip to content

Commit 0a6ddd6

Browse files
committed
test(gateway-contracts): tests for pausing and unpausing tasks
1 parent b28909c commit 0a6ddd6

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

gateway-contracts/hardhat.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import "./tasks/deployment/contracts";
1818
import "./tasks/deployment/empty_proxies";
1919
import "./tasks/deployment/mock_contracts";
2020
import "./tasks/getters";
21+
import "./tasks/pauseContracts";
2122
import "./tasks/safeSmartAccounts";
2223
import "./tasks/upgradeContracts";
2324

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
2+
import { expect } from "chai";
3+
import hre from "hardhat";
4+
5+
import { Decryption, InputVerification } from "../typechain-types";
6+
import { loadTestVariablesFixture } from "./utils";
7+
8+
describe("Pausing and Unpausing Tasks", function () {
9+
let decryption: Decryption;
10+
let inputVerification: InputVerification;
11+
describe("Hardhat pausing/unpausing tasks", function () {
12+
before(async function () {
13+
// `PAUSER_PRIVATE_KEY` env variable is assigned value of `PAUSER_PRIVATE_KEY_0`
14+
const pauserPrivateKey = process.env.PAUSER_PRIVATE_KEY_0;
15+
process.env.PAUSER_PRIVATE_KEY = pauserPrivateKey;
16+
17+
const fixtureData = await loadFixture(loadTestVariablesFixture);
18+
decryption = fixtureData.decryption;
19+
inputVerification = fixtureData.inputVerification;
20+
});
21+
22+
it("Should pause all contracts", async function () {
23+
expect(await inputVerification.paused()).to.eq(false);
24+
expect(await decryption.paused()).to.eq(false);
25+
await hre.run("task:pauseAllGatewayContracts", { useInternalGatewayConfigAddress: true });
26+
expect(await inputVerification.paused()).to.eq(true);
27+
expect(await decryption.paused()).to.eq(true);
28+
});
29+
30+
it("Should unpause all contracts", async function () {
31+
await hre.run("task:unpauseAllGatewayContracts", { useInternalGatewayConfigAddress: true });
32+
expect(await inputVerification.paused()).to.eq(false);
33+
expect(await decryption.paused()).to.eq(false);
34+
});
35+
36+
it("Should pause inputVerification", async function () {
37+
await hre.run("task:pauseInputVerification", { useInternalGatewayConfigAddress: true });
38+
expect(await inputVerification.paused()).to.eq(true);
39+
expect(await decryption.paused()).to.eq(false);
40+
});
41+
42+
it("Should pause decryption", async function () {
43+
await hre.run("task:pauseDecryption", { useInternalGatewayConfigAddress: true });
44+
expect(await inputVerification.paused()).to.eq(true);
45+
expect(await decryption.paused()).to.eq(true);
46+
});
47+
48+
it("Should unpause inputVerification", async function () {
49+
await hre.run("task:unpauseInputVerification", { useInternalGatewayConfigAddress: true });
50+
expect(await inputVerification.paused()).to.eq(false);
51+
expect(await decryption.paused()).to.eq(true);
52+
});
53+
54+
it("Should unpause decryption", async function () {
55+
await hre.run("task:unpauseDecryption", { useInternalGatewayConfigAddress: true });
56+
expect(await inputVerification.paused()).to.eq(false);
57+
expect(await decryption.paused()).to.eq(false);
58+
});
59+
});
60+
});

0 commit comments

Comments
 (0)