|
| 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