Commit 45642dc8 authored by Antonis Kogias's avatar Antonis Kogias

replaced l1Provider and l2Provider with env.l1Provider and env.l2Provider

parent 752a2d1f
---
'@eth-optimism/integration-tests': patch
---
Replaces l1Provider and l2Provider with env.l1Provider and env.l2Provider respectively.
...@@ -2,17 +2,11 @@ ...@@ -2,17 +2,11 @@
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { expectApprox } from '@eth-optimism/core-utils' import { expectApprox } from '@eth-optimism/core-utils'
import { predeploys } from '@eth-optimism/contracts' import { predeploys } from '@eth-optimism/contracts'
import { asL2Provider } from '@eth-optimism/sdk'
import { Contract, BigNumber } from 'ethers' import { Contract, BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup' import { expect } from './shared/setup'
import { import { envConfig, DEFAULT_TEST_GAS_L1 } from './shared/utils'
l2Provider,
l1Provider,
envConfig,
DEFAULT_TEST_GAS_L1,
} from './shared/utils'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
/** /**
...@@ -21,7 +15,6 @@ import { OptimismEnv } from './shared/env' ...@@ -21,7 +15,6 @@ import { OptimismEnv } from './shared/env'
* must be equal to the blocknumber/timestamp of the L1 transaction. * must be equal to the blocknumber/timestamp of the L1 transaction.
*/ */
describe('OVM Context: Layer 2 EVM Context', () => { describe('OVM Context: Layer 2 EVM Context', () => {
const L2Provider = asL2Provider(l2Provider)
let env: OptimismEnv let env: OptimismEnv
before(async () => { before(async () => {
env = await OptimismEnv.new() env = await OptimismEnv.new()
...@@ -66,8 +59,10 @@ describe('OVM Context: Layer 2 EVM Context', () => { ...@@ -66,8 +59,10 @@ describe('OVM Context: Layer 2 EVM Context', () => {
// Get the L1 block that the enqueue transaction was in so that // Get the L1 block that the enqueue transaction was in so that
// the timestamp can be compared against the layer two contract // the timestamp can be compared against the layer two contract
const l1Block = await l1Provider.getBlock(pair.receipt.blockNumber) const l1Block = await env.l1Provider.getBlock(pair.receipt.blockNumber)
const l2Block = await l2Provider.getBlock(pair.remoteReceipt.blockNumber) const l2Block = await env.l2Provider.getBlock(
pair.remoteReceipt.blockNumber
)
// block.number should return the value of the L2 block number. // block.number should return the value of the L2 block number.
const l2BlockNumber = await OVMContextStorage.blockNumbers(i) const l2BlockNumber = await OVMContextStorage.blockNumbers(i)
...@@ -103,7 +98,7 @@ describe('OVM Context: Layer 2 EVM Context', () => { ...@@ -103,7 +98,7 @@ describe('OVM Context: Layer 2 EVM Context', () => {
}) })
await dummyTx.wait() await dummyTx.wait()
const block = await L2Provider.getBlockWithTransactions('latest') const block = await env.l2Provider.getBlockWithTransactions('latest')
const [, returnData] = await Multicall.callStatic.aggregate( const [, returnData] = await Multicall.callStatic.aggregate(
[ [
[ [
......
This diff is collapsed.
...@@ -6,7 +6,6 @@ import { predeploys } from '@eth-optimism/contracts' ...@@ -6,7 +6,6 @@ import { predeploys } from '@eth-optimism/contracts'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup' import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { l2Provider } from './shared/utils'
describe('Whitelist', async () => { describe('Whitelist', async () => {
const initialAmount = 1000 const initialAmount = 1000
...@@ -24,7 +23,7 @@ describe('Whitelist', async () => { ...@@ -24,7 +23,7 @@ describe('Whitelist', async () => {
describe('when the whitelist is disabled', () => { describe('when the whitelist is disabled', () => {
it('should be able to deploy a contract', async () => { it('should be able to deploy a contract', async () => {
await expect( await expect(
l2Provider.send('eth_call', [ env.l2Provider.send('eth_call', [
Factory__ERC20.getDeployTransaction( Factory__ERC20.getDeployTransaction(
initialAmount, initialAmount,
tokenName, tokenName,
...@@ -50,7 +49,7 @@ describe('Whitelist', async () => { ...@@ -50,7 +49,7 @@ describe('Whitelist', async () => {
it('should fail if the user is not whitelisted', async () => { it('should fail if the user is not whitelisted', async () => {
await expect( await expect(
l2Provider.send('eth_call', [ env.l2Provider.send('eth_call', [
{ {
...Factory__ERC20.getDeployTransaction( ...Factory__ERC20.getDeployTransaction(
initialAmount, initialAmount,
...@@ -77,7 +76,7 @@ describe('Whitelist', async () => { ...@@ -77,7 +76,7 @@ describe('Whitelist', async () => {
it('should succeed if the user is whitelisted', async () => { it('should succeed if the user is whitelisted', async () => {
await expect( await expect(
l2Provider.send('eth_call', [ env.l2Provider.send('eth_call', [
{ {
...Factory__ERC20.getDeployTransaction( ...Factory__ERC20.getDeployTransaction(
initialAmount, initialAmount,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment