-
Notifications
You must be signed in to change notification settings - Fork 30
/
l2FeedUptimeSequencer.test.ts
111 lines (88 loc) · 3.39 KB
/
l2FeedUptimeSequencer.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { expect } from "chai";
import { PACKAGE_NAME } from "../src/shared/constants";
import { L2SequencerSubtask, Task } from "../src/shared/enums";
import { useEnvironment } from "./helpers";
const isGithubActions = !!process.env.GITHUB_ACTIONS;
describe("Test chainlink:l2Sequencer module [SKIP FOR GITHUB ACTIONS]", function () {
// Actually, all the sequencers are down
useEnvironment("hardhat-chainlink-arbitrum-goerli");
before(async function () {
this.l2SequencerAddress =
this.hre.chainlink.registries.l2Sequencers.arbitrumGoerli.contractAddress;
});
describe("Run methods as hre methods", function () {
it("Check if L2 sequencer is up", async function () {
if (isGithubActions) this.skip();
const isSequencerUp =
await this.hre.chainlink.l2Sequencer.isL2SequencerUp(
this.l2SequencerAddress
);
expect(isSequencerUp).to.eq(false);
});
it("Gets L2 sequencer health data", async function () {
if (isGithubActions) this.skip();
const { isSequencerUp, timeSinceUp, isGracePeriodOver } =
await this.hre.chainlink.l2Sequencer.getTimeSinceL2SequencerIsUp(
this.l2SequencerAddress
);
expect(isSequencerUp).to.eq(false);
expect(timeSinceUp.toNumber()).to.gte(0);
expect(isGracePeriodOver).to.eq(false);
});
});
describe("Run methods as hre subtasks", function () {
it("Check if L2 sequencer is up", async function () {
if (isGithubActions) this.skip();
const isSequencerUp = await this.hre.run(
`${PACKAGE_NAME}:${Task.l2Sequencer}:${L2SequencerSubtask.isL2SequencerUp}`,
{
l2SequencerAddress: this.l2SequencerAddress,
}
);
expect(isSequencerUp).to.eq(false);
});
it("Gets L2 sequencer health data", async function () {
if (isGithubActions) this.skip();
const { isSequencerUp, timeSinceUp, isGracePeriodOver } =
await this.hre.run(
`${PACKAGE_NAME}:${Task.l2Sequencer}:${L2SequencerSubtask.getTimeSinceL2SequencerIsUp}`,
{
l2SequencerAddress: this.l2SequencerAddress,
gracePeriodTime: "3600",
}
);
expect(isSequencerUp).to.eq(false);
expect(timeSinceUp.toNumber()).to.gte(0);
expect(isGracePeriodOver).to.eq(false);
});
});
describe("Run methods as subtasks of a hre task", function () {
it("Check if L2 sequencer is up", async function () {
if (isGithubActions) this.skip();
const isSequencerUp = await this.hre.run(
`${PACKAGE_NAME}:${Task.l2Sequencer}`,
{
subtask: L2SequencerSubtask.isL2SequencerUp,
args: JSON.stringify({
l2SequencerAddress: this.l2SequencerAddress,
}),
}
);
expect(isSequencerUp).to.eq(false);
});
it("Gets L2 sequencer health data", async function () {
if (isGithubActions) this.skip();
const { isSequencerUp, timeSinceUp, isGracePeriodOver } =
await this.hre.run(`${PACKAGE_NAME}:${Task.l2Sequencer}`, {
subtask: L2SequencerSubtask.getTimeSinceL2SequencerIsUp,
args: JSON.stringify({
l2SequencerAddress: this.l2SequencerAddress,
gracePeriodTime: "3600",
}),
});
expect(isSequencerUp).to.eq(false);
expect(timeSinceUp.toNumber()).to.gte(0);
expect(isGracePeriodOver).to.eq(false);
});
});
});