Skip to content

Commit

Permalink
test: disable interval mining test for forked blockchains
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Feb 12, 2024
1 parent 3000158 commit ab8fb12
Showing 1 changed file with 1 addition and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { assert } from "chai";

import { rpcQuantityToNumber } from "../../../../src/internal/core/jsonrpc/types/base-types";
import { ALCHEMY_URL } from "../../../setup";
import { workaroundWindowsCiFailures } from "../../../utils/workaround-windows-ci-failures";
import { setCWD } from "../helpers/cwd";
import { INTERVAL_MINING_PROVIDERS } from "../helpers/providers";
Expand All @@ -12,7 +11,6 @@ describe("Interval mining provider", function () {
workaroundWindowsCiFailures.call(this, { isFork });

describe(`${name} provider`, function () {
const safeBlockInThePast = 11_200_000;
const blockTime = 100;
const blockWaitTime = blockTime + 10;

Expand Down Expand Up @@ -45,40 +43,10 @@ describe("Interval mining provider", function () {
});

describe("hardhat_reset", function () {
if (isFork) {
testForkedProviderBehaviour();
} else {
if (!isFork) {
testNormalProviderBehaviour();
}

function testForkedProviderBehaviour() {
it("starts interval mining", async function () {
const firstBlock = await getBlockNumber();

await sleep(blockWaitTime);
const secondBlockBeforeReset = await getBlockNumber();

await this.provider.send("hardhat_reset", [
{
forking: {
jsonRpcUrl: ALCHEMY_URL,
blockNumber: safeBlockInThePast,
},
},
]);

await sleep(blockWaitTime);
const secondBlockAfterReset = await getBlockNumber();

await sleep(blockWaitTime);
const thirdBlock = await getBlockNumber();

assert.equal(secondBlockBeforeReset, firstBlock + 1);
assert.equal(secondBlockAfterReset, safeBlockInThePast + 1);
assert.equal(thirdBlock, safeBlockInThePast + 2);
});
}

function testNormalProviderBehaviour() {
it("starts interval mining", async function () {
const firstBlock = await getBlockNumber();
Expand Down

0 comments on commit ab8fb12

Please sign in to comment.