Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,17 @@ module.exports = {
'id-match': 'off',
'import/no-extraneous-dependencies': ['error'],
'import/no-internal-modules': 'off',
'import/order': 'off',
'import/order': [
"error",
{
groups: [
'builtin',
'external',
'internal',
],
'newlines-between': 'always',
},
],
indent: 'off',
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error',
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/actor-tests/deposits.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { utils, Wallet, BigNumber } from 'ethers'
import { expect } from 'chai'

import { setupActor, setupRun, actor, run } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env'
import { Direction } from '../test/shared/watcher-utils'
import { expect } from 'chai'

interface BenchContext {
l1Wallet: Wallet
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/actor-tests/lib/actor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { performance } from 'perf_hooks'

import { Mutex } from 'async-mutex'
import { sleep } from '../../test/shared/utils'

import {
sanitizeForMetrics,
benchDurationsSummary,
Expand All @@ -9,7 +11,7 @@ import {
failedBenchRunsTotal,
} from './metrics'
import { ActorLogger, WorkerLogger } from './logger'
import { performance } from 'perf_hooks'
import { sleep } from '../../test/shared/utils'

// eslint-disable-next-line @typescript-eslint/no-empty-function
const asyncNoop = async () => {}
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/actor-tests/lib/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs from 'fs'
import client from 'prom-client'
import http from 'http'
import url from 'url'

import client from 'prom-client'

export const metricsRegistry = new client.Registry()

const metricName = (name: string) => {
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/actor-tests/lib/runner.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as path from 'path'

import { Command } from 'commander'

import { defaultRuntime } from './convenience'
import { RunOpts } from './actor'
import { Command } from 'commander'
import pkg from '../../package.json'
import { serveMetrics } from './metrics'
import pkg from '../../package.json'

const program = new Command()
program.version(pkg.version)
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/actor-tests/nft.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { utils, Wallet, Contract } from 'ethers'
import { expect } from 'chai'

import { actor, run, setupActor, setupRun } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env'
import ERC721 from '../artifacts/contracts/NFT.sol/NFT.json'
import { expect } from 'chai'

interface Context {
wallet: Wallet
Expand Down
1 change: 1 addition & 0 deletions integration-tests/actor-tests/sends.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { utils, Wallet, BigNumber } from 'ethers'
import { expect } from 'chai'

import { actor, setupRun, setupActor, run } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env'

Expand Down
3 changes: 2 additions & 1 deletion integration-tests/actor-tests/state-dos.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { utils, Wallet, Contract } from 'ethers'
import { ethers } from 'hardhat'
import { expect } from 'chai'

import { actor, setupActor, run, setupRun } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env'
import { expect } from 'chai'

interface Context {
wallet: Wallet
Expand Down
7 changes: 4 additions & 3 deletions integration-tests/actor-tests/uniswap.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Contract, utils, Wallet } from 'ethers'
import { actor, run, setupActor, setupRun } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env'
import { FeeAmount } from '@uniswap/v3-sdk'
import ERC20 from '../artifacts/contracts/ERC20.sol/ERC20.json'
import { abi as NFTABI } from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json'
import { abi as RouterABI } from '@uniswap/v3-periphery/artifacts/contracts/SwapRouter.sol/SwapRouter.json'

import { actor, run, setupActor, setupRun } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env'
import ERC20 from '../artifacts/contracts/ERC20.sol/ERC20.json'

interface Context {
contracts: { [name: string]: Contract }
wallet: Wallet
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/test/basic-l1-l2-communication.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,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 { expect } from './shared/setup'
import { Direction } from './shared/watcher-utils'
import { OptimismEnv } from './shared/env'
import {
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/test/bridged-tokens.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { expect } from './shared/setup'

import { BigNumber, Contract, ContractFactory, utils, Wallet } from 'ethers'
import { ethers } from 'hardhat'
import * as L2Artifact from '@eth-optimism/contracts/artifacts/contracts/standards/L2StandardERC20.sol/L2StandardERC20.json'

import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env'
import { withdrawalTest } from './shared/utils'
import { Direction } from './shared/watcher-utils'
Expand Down
8 changes: 3 additions & 5 deletions integration-tests/test/contracts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { expect } from './shared/setup'

import { BigNumber, Contract, ContractFactory, utils, Wallet } from 'ethers'
import { ethers } from 'hardhat'
import { UniswapV3Deployer } from 'uniswap-v3-deploy-plugin/dist/deployer/UniswapV3Deployer'

import { OptimismEnv } from './shared/env'
import { FeeAmount, TICK_SPACINGS } from '@uniswap/v3-sdk'

import { abi as NFTABI } from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json'
import { abi as RouterABI } from '@uniswap/v3-periphery/artifacts/contracts/SwapRouter.sol/SwapRouter.json'

import { OptimismEnv } from './shared/env'
import { expect } from './shared/setup'

// Below methods taken from the Uniswap test suite, see
// https://github.com/Uniswap/v3-periphery/blob/main/test/shared/ticks.ts
const getMinTick = (tickSpacing: number) =>
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/test/fee-payment.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { expect } from './shared/setup'

/* Imports: External */
import { BigNumber, utils } from 'ethers'
import { serialize } from '@ethersproject/transactions'
import { predeploys, getContractFactory } from '@eth-optimism/contracts'

/* Imports: Internal */
import { expect } from './shared/setup'
import { hardhatTest } from './shared/utils'
import { OptimismEnv } from './shared/env'
import { Direction } from './shared/watcher-utils'
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/test/native-eth-ovm-calls.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from './shared/setup'

import { BigNumber, Contract, ContractFactory, Wallet } from 'ethers'
import { ethers } from 'hardhat'

import { expect } from './shared/setup'
import {
fundUser,
encodeSolidityRevertMessage,
Expand Down
4 changes: 1 addition & 3 deletions integration-tests/test/native-eth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { expect } from './shared/setup'

/* Imports: External */
import { Wallet, utils, BigNumber } from 'ethers'
import { serialize } from '@ethersproject/transactions'
import { predeploys } from '@eth-optimism/contracts'
import { expectApprox } from '@eth-optimism/core-utils'

/* Imports: Internal */
import { expect } from './shared/setup'
import { Direction } from './shared/watcher-utils'

import {
DEFAULT_TEST_GAS_L1,
DEFAULT_TEST_GAS_L2,
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/test/ovmcontext.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { expect } from './shared/setup'

/* Imports: External */
import { ethers } from 'hardhat'
import { injectL2Context, expectApprox } from '@eth-optimism/core-utils'
import { predeploys } from '@eth-optimism/contracts'
import { Contract, BigNumber } from 'ethers'

/* Imports: Internal */
import { expect } from './shared/setup'
import {
l2Provider,
l1Provider,
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/test/predeploys.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { expect } from './shared/setup'

/* Imports: Internal */
import { ethers } from 'ethers'
import { predeploys, getContractInterface } from '@eth-optimism/contracts'

/* Imports: External */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env'

describe('predeploys', () => {
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/test/queue-ingestion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { expect } from './shared/setup'

/* Imports: Internal */
import { providers } from 'ethers'
import { injectL2Context, applyL1ToL2Alias } from '@eth-optimism/core-utils'

/* Imports: External */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env'
import { Direction } from './shared/watcher-utils'
import { DEFAULT_TEST_GAS_L1, envConfig } from './shared/utils'
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/test/replica.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TransactionReceipt } from '@ethersproject/abstract-provider'

import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env'
import {
Expand All @@ -6,7 +8,6 @@ import {
sleep,
envConfig,
} from './shared/utils'
import { TransactionReceipt } from '@ethersproject/abstract-provider'

describe('Replica Tests', () => {
let env: OptimismEnv
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/test/rpc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { expect } from './shared/setup'

import { expectApprox, injectL2Context } from '@eth-optimism/core-utils'
import { Wallet, BigNumber, Contract, ContractFactory, constants } from 'ethers'
import { serialize } from '@ethersproject/transactions'
import { ethers } from 'hardhat'
import {
TransactionReceipt,
TransactionRequest,
} from '@ethersproject/providers'

import {
sleep,
l2Provider,
Expand All @@ -16,10 +19,7 @@ import {
envConfig,
} from './shared/utils'
import { OptimismEnv } from './shared/env'
import {
TransactionReceipt,
TransactionRequest,
} from '@ethersproject/providers'
import { expect } from './shared/setup'

describe('Basic RPC tests', () => {
let env: OptimismEnv
Expand Down
1 change: 0 additions & 1 deletion integration-tests/test/shared/watcher-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
TransactionResponse,
} from '@ethersproject/providers'
import { Watcher } from '@eth-optimism/core-utils'

import { Contract, Transaction } from 'ethers'

export const initWatcher = async (
Expand Down
4 changes: 1 addition & 3 deletions integration-tests/test/stress-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { expect } from './shared/setup'

/* Imports: External */
import { Contract, Wallet, utils } from 'ethers'
import { ethers } from 'hardhat'

/* Imports: Internal */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env'
import {
executeL1ToL2TransactionsParallel,
Expand All @@ -15,7 +14,6 @@ import {
executeRepeatedL2Transactions,
fundRandomWallet,
} from './shared/stress-test-helpers'

/* Imports: Artifacts */
import { envConfig, fundUser } from './shared/utils'

Expand Down
3 changes: 1 addition & 2 deletions integration-tests/test/whitelist.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { expect } from './shared/setup'

/* Imports: External */
import { ContractFactory } from 'ethers'
import { ethers } from 'hardhat'
import { predeploys } from '@eth-optimism/contracts'

/* Imports: Internal */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env'
import { l2Provider } from './shared/utils'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Gauge, Histogram, Counter } from 'prom-client'
import { RollupInfo, sleep } from '@eth-optimism/core-utils'
import { Logger, Metrics } from '@eth-optimism/common-ts'
import { getContractFactory } from 'old-contracts'

/* Internal Imports */
import { TxSubmissionHooks } from '..'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
import { Logger, Metrics } from '@eth-optimism/common-ts'

/* Internal Imports */
import { BlockRange, BatchSubmitter } from '.'
import { TransactionSubmitter } from '../utils'
import { BlockRange, BatchSubmitter } from '.'

export class StateBatchSubmitter extends BatchSubmitter {
// TODO: Change this so that we calculate start = scc.totalElements() and end = ctc.totalElements()!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import {
BatchContext,
AppendSequencerBatchParams,
} from '../transaction-chain-contract'

import { BlockRange, BatchSubmitter } from '.'
import { TransactionSubmitter } from '../utils'
import { BlockRange, BatchSubmitter } from '.'

export interface AutoFixBatchOptions {
fixDoublePlayedDeposits: boolean
Expand Down
3 changes: 2 additions & 1 deletion packages/batch-submitter/src/exec/run-batch-submitter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* External Imports */
import { exit } from 'process'

import { injectL2Context, Bcfg } from '@eth-optimism/core-utils'
import * as Sentry from '@sentry/node'
import { Logger, Metrics, createMetricsServer } from '@eth-optimism/common-ts'
import { exit } from 'process'
import { Signer, Wallet } from 'ethers'
import {
StaticJsonRpcProvider,
Expand Down
Loading