From fb91e0d482df9a510e582dcf267aadd8892fcebd Mon Sep 17 00:00:00 2001 From: David <104078303+davidtaikocha@users.noreply.github.com> Date: Tue, 22 Nov 2022 22:20:19 +0800 Subject: [PATCH] fix(test): fix two occasional errors when running bridge tests (#305) * fix(test): fix two occasional errors when running bridge tests * style: remove some unused comments --- packages/protocol/test/bridge/Bridge.test.ts | 12 +++++------- .../test/bridge/libs/LibBridgeInvoke.test.ts | 1 - .../test/bridge/libs/LibBridgeProcess.test.ts | 10 +++++----- .../protocol/test/bridge/libs/LibBridgeRetry.test.ts | 4 ++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/protocol/test/bridge/Bridge.test.ts b/packages/protocol/test/bridge/Bridge.test.ts index 6a137d3cde4..fe3ee1a84aa 100644 --- a/packages/protocol/test/bridge/Bridge.test.ts +++ b/packages/protocol/test/bridge/Bridge.test.ts @@ -1,12 +1,10 @@ import { expect } from "chai" -import { AddressManager, Bridge, EtherVault } from "../../typechain" -import { ethers } from "hardhat" import { BigNumber, Signer } from "ethers" +import { ethers } from "hardhat" +import RLP from "rlp" +import { AddressManager, Bridge, EtherVault } from "../../typechain" import { Message } from "../utils/message" import { Block, BlockHeader, EthGetProofResponse } from "../utils/rpc" -// import { getSlot, MessageStatus } from "../../tasks/utils" -import RLP from "rlp" -// const helpers = require("@nomicfoundation/hardhat-network-helpers") async function deployBridge( signer: Signer, @@ -860,7 +858,7 @@ describe("integration:Bridge", function () { const storageValue = await ethers.provider.getStorageAt( l1Bridge.address, key, - block.hash + block.number ) // make sure it equals 1 so our proof will pass expect(storageValue).to.be.eq( @@ -984,7 +982,7 @@ describe("integration:Bridge", function () { const storageValue = await ethers.provider.getStorageAt( l1Bridge.address, key, - block.hash + block.number ) // make sure it equals 1 so our proof will pass expect(storageValue).to.be.eq( diff --git a/packages/protocol/test/bridge/libs/LibBridgeInvoke.test.ts b/packages/protocol/test/bridge/libs/LibBridgeInvoke.test.ts index 7a9c444adbe..8bd38e5ba8d 100644 --- a/packages/protocol/test/bridge/libs/LibBridgeInvoke.test.ts +++ b/packages/protocol/test/bridge/libs/LibBridgeInvoke.test.ts @@ -1,4 +1,3 @@ -// import { expect } from "chai" import { expect } from "chai" import { ethers } from "hardhat" import { Message } from "../../utils/message" diff --git a/packages/protocol/test/bridge/libs/LibBridgeProcess.test.ts b/packages/protocol/test/bridge/libs/LibBridgeProcess.test.ts index 6d176e0f6d8..efebc4d9316 100644 --- a/packages/protocol/test/bridge/libs/LibBridgeProcess.test.ts +++ b/packages/protocol/test/bridge/libs/LibBridgeProcess.test.ts @@ -1,11 +1,11 @@ +import * as helpers from "@nomicfoundation/hardhat-network-helpers" import { expect } from "chai" -import hre, { ethers } from "hardhat" -import { Message } from "../../utils/message" -import { AddressManager, Bridge } from "../../../typechain" -import { getSlot } from "../../../tasks/utils" import * as fs from "fs" +import hre, { ethers } from "hardhat" import * as path from "path" -const helpers = require("@nomicfoundation/hardhat-network-helpers") +import { getSlot } from "../../../tasks/utils" +import { AddressManager, Bridge } from "../../../typechain" +import { Message } from "../../utils/message" describe("LibBridgeProcess", function () { function getStateSlot() { diff --git a/packages/protocol/test/bridge/libs/LibBridgeRetry.test.ts b/packages/protocol/test/bridge/libs/LibBridgeRetry.test.ts index e71335c825b..8f0d50b8169 100644 --- a/packages/protocol/test/bridge/libs/LibBridgeRetry.test.ts +++ b/packages/protocol/test/bridge/libs/LibBridgeRetry.test.ts @@ -1,8 +1,8 @@ +import * as helpers from "@nomicfoundation/hardhat-network-helpers" import { expect } from "chai" import hre, { ethers } from "hardhat" +import { decode, getSlot } from "../../../tasks/utils" import { Message } from "../../utils/message" -import { getSlot, decode } from "../../../tasks/utils" -const helpers = require("@nomicfoundation/hardhat-network-helpers") describe("LibBridgeRetry", function () { async function deployLibBridgeRetryFixture() {