diff --git a/.changeset/spicy-kiwis-double.md b/.changeset/spicy-kiwis-double.md new file mode 100644 index 0000000000000000000000000000000000000000..d4d0d43e9f76c9a940e349de39eff714ff12ed0c --- /dev/null +++ b/.changeset/spicy-kiwis-double.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/integration-tests': patch +--- + +Use hardhat-ethers for importing factories in integration tests diff --git a/integration-tests/actor-tests/state-dos.test.ts b/integration-tests/actor-tests/state-dos.test.ts index 4e6acb6534e160f1297bc7f0a93f2049194e2d42..62ea72261baa84537b3ba522d3b8683d00e31466 100644 --- a/integration-tests/actor-tests/state-dos.test.ts +++ b/integration-tests/actor-tests/state-dos.test.ts @@ -1,7 +1,7 @@ -import { utils, Wallet, Contract, ContractFactory } from 'ethers' +import { utils, Wallet, Contract } from 'ethers' +import { ethers } from 'hardhat' import { actor, setupActor, run, setupRun } from './lib/convenience' import { OptimismEnv } from '../test/shared/env' -import StateDOS from '../artifacts/contracts/StateDOS.sol/StateDOS.json' import { expect } from 'chai' interface Context { @@ -16,11 +16,7 @@ actor('Trie DoS accounts', () => { setupActor(async () => { env = await OptimismEnv.new() - const factory = new ContractFactory( - StateDOS.abi, - StateDOS.bytecode, - env.l2Wallet - ) + const factory = await ethers.getContractFactory('StateDOS', env.l2Wallet) contract = await factory.deploy() await contract.deployed() }) diff --git a/integration-tests/test/basic-l1-l2-communication.spec.ts b/integration-tests/test/basic-l1-l2-communication.spec.ts index 2f84b823809e7aa1ed7b25001eff72275df47fe9..a09aec07ad89e459b98d301f122f804b51ecdb36 100644 --- a/integration-tests/test/basic-l1-l2-communication.spec.ts +++ b/integration-tests/test/basic-l1-l2-communication.spec.ts @@ -2,11 +2,10 @@ import { expect } from './shared/setup' /* Imports: External */ import { Contract, ContractFactory } from 'ethers' +import { ethers } from 'hardhat' import { applyL1ToL2Alias, awaitCondition } from '@eth-optimism/core-utils' /* Imports: Internal */ -import simpleStorageJson from '../artifacts/contracts/SimpleStorage.sol/SimpleStorage.json' -import l2ReverterJson from '../artifacts/contracts/Reverter.sol/Reverter.json' import { Direction } from './shared/watcher-utils' import { OptimismEnv } from './shared/env' import { isMainnet } from './shared/utils' @@ -22,19 +21,16 @@ describe('Basic L1<>L2 Communication', async () => { before(async () => { env = await OptimismEnv.new() - Factory__L1SimpleStorage = new ContractFactory( - simpleStorageJson.abi, - simpleStorageJson.bytecode, + Factory__L1SimpleStorage = await ethers.getContractFactory( + 'SimpleStorage', env.l1Wallet ) - Factory__L2SimpleStorage = new ContractFactory( - simpleStorageJson.abi, - simpleStorageJson.bytecode, + Factory__L2SimpleStorage = await ethers.getContractFactory( + 'SimpleStorage', env.l2Wallet ) - Factory__L2Reverter = new ContractFactory( - l2ReverterJson.abi, - l2ReverterJson.bytecode, + Factory__L2Reverter = await ethers.getContractFactory( + 'Reverter', env.l2Wallet ) }) diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index b02dc0ac487e872f65a7c353df0c5cb192a7ed68..4742c30cfc6be63fc68a5d3b90c56ba163f2d63a 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -18,7 +18,6 @@ import { TransactionReceipt, TransactionRequest, } from '@ethersproject/providers' -import simpleStorageJson from '../artifacts/contracts/SimpleStorage.sol/SimpleStorage.json' describe('Basic RPC tests', () => { let env: OptimismEnv @@ -491,9 +490,8 @@ describe('Basic RPC tests', () => { describe('debug_traceTransaction', () => { it('should match debug_traceBlock', async () => { - const storage = new ContractFactory( - simpleStorageJson.abi, - simpleStorageJson.bytecode, + const storage = await ethers.getContractFactory( + 'SimpleStorage', env.l2Wallet ) const tx = (await storage.deploy()).deployTransaction diff --git a/integration-tests/test/stress-tests.spec.ts b/integration-tests/test/stress-tests.spec.ts index 16873f0653f418a67eb53a90a0a84606371d1fce..ad56fd5b6f272da38c1ed509a29a29c6f34ec52a 100644 --- a/integration-tests/test/stress-tests.spec.ts +++ b/integration-tests/test/stress-tests.spec.ts @@ -1,7 +1,8 @@ import { expect } from './shared/setup' /* Imports: External */ -import { Contract, ContractFactory, Wallet, utils } from 'ethers' +import { Contract, Wallet, utils } from 'ethers' +import { ethers } from 'hardhat' /* Imports: Internal */ import { OptimismEnv } from './shared/env' @@ -16,7 +17,6 @@ import { } from './shared/stress-test-helpers' /* Imports: Artifacts */ -import simpleStorageJson from '../artifacts/contracts/SimpleStorage.sol/SimpleStorage.json' import { fundUser, isLiveNetwork, isMainnet } from './shared/utils' // Need a big timeout to allow for all transactions to be processed. @@ -60,14 +60,12 @@ describe('stress tests', () => { let L2SimpleStorage: Contract let L1SimpleStorage: Contract beforeEach(async () => { - const factory__L1SimpleStorage = new ContractFactory( - simpleStorageJson.abi, - simpleStorageJson.bytecode, + const factory__L1SimpleStorage = await ethers.getContractFactory( + 'SimpleStorage', env.l1Wallet ) - const factory__L2SimpleStorage = new ContractFactory( - simpleStorageJson.abi, - simpleStorageJson.bytecode, + const factory__L2SimpleStorage = await ethers.getContractFactory( + 'SimpleStorage', env.l2Wallet ) L1SimpleStorage = await factory__L1SimpleStorage.deploy()