Commit a7239b15 authored by Indeavr's avatar Indeavr

(refac): Enforced import ordering in eslintrc.js

parent eb926e2f
...@@ -101,7 +101,17 @@ module.exports = { ...@@ -101,7 +101,17 @@ module.exports = {
'id-match': 'off', 'id-match': 'off',
'import/no-extraneous-dependencies': ['error'], 'import/no-extraneous-dependencies': ['error'],
'import/no-internal-modules': 'off', 'import/no-internal-modules': 'off',
'import/order': 'off', 'import/order': [
"error",
{
groups: [
'builtin',
'external',
'internal',
],
'newlines-between': 'always',
},
],
indent: 'off', indent: 'off',
'jsdoc/check-alignment': 'error', 'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error', 'jsdoc/check-indentation': 'error',
......
import { utils, Wallet, BigNumber } from 'ethers' import { utils, Wallet, BigNumber } from 'ethers'
import { expect } from 'chai'
import { setupActor, setupRun, actor, run } from './lib/convenience' import { setupActor, setupRun, actor, run } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env' import { OptimismEnv } from '../test/shared/env'
import { Direction } from '../test/shared/watcher-utils' import { Direction } from '../test/shared/watcher-utils'
import { expect } from 'chai'
interface BenchContext { interface BenchContext {
l1Wallet: Wallet l1Wallet: Wallet
......
import { performance } from 'perf_hooks'
import { Mutex } from 'async-mutex' import { Mutex } from 'async-mutex'
import { sleep } from '../../test/shared/utils'
import { import {
sanitizeForMetrics, sanitizeForMetrics,
benchDurationsSummary, benchDurationsSummary,
...@@ -9,7 +11,7 @@ import { ...@@ -9,7 +11,7 @@ import {
failedBenchRunsTotal, failedBenchRunsTotal,
} from './metrics' } from './metrics'
import { ActorLogger, WorkerLogger } from './logger' 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 // eslint-disable-next-line @typescript-eslint/no-empty-function
const asyncNoop = async () => {} const asyncNoop = async () => {}
......
import fs from 'fs' import fs from 'fs'
import client from 'prom-client'
import http from 'http' import http from 'http'
import url from 'url' import url from 'url'
import client from 'prom-client'
export const metricsRegistry = new client.Registry() export const metricsRegistry = new client.Registry()
const metricName = (name: string) => { const metricName = (name: string) => {
......
import * as path from 'path' import * as path from 'path'
import { Command } from 'commander'
import { defaultRuntime } from './convenience' import { defaultRuntime } from './convenience'
import { RunOpts } from './actor' import { RunOpts } from './actor'
import { Command } from 'commander'
import pkg from '../../package.json'
import { serveMetrics } from './metrics' import { serveMetrics } from './metrics'
import pkg from '../../package.json'
const program = new Command() const program = new Command()
program.version(pkg.version) program.version(pkg.version)
......
import { utils, Wallet, Contract } from 'ethers' import { utils, Wallet, Contract } from 'ethers'
import { expect } from 'chai'
import { actor, run, setupActor, setupRun } from './lib/convenience' import { actor, run, setupActor, setupRun } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env' import { OptimismEnv } from '../test/shared/env'
import ERC721 from '../artifacts/contracts/NFT.sol/NFT.json' import ERC721 from '../artifacts/contracts/NFT.sol/NFT.json'
import { expect } from 'chai'
interface Context { interface Context {
wallet: Wallet wallet: Wallet
......
import { utils, Wallet, BigNumber } from 'ethers' import { utils, Wallet, BigNumber } from 'ethers'
import { expect } from 'chai' import { expect } from 'chai'
import { actor, setupRun, setupActor, run } from './lib/convenience' import { actor, setupRun, setupActor, run } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env' import { OptimismEnv } from '../test/shared/env'
......
import { utils, Wallet, Contract } from 'ethers' import { utils, Wallet, Contract } from 'ethers'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { expect } from 'chai'
import { actor, setupActor, run, setupRun } from './lib/convenience' import { actor, setupActor, run, setupRun } from './lib/convenience'
import { OptimismEnv } from '../test/shared/env' import { OptimismEnv } from '../test/shared/env'
import { expect } from 'chai'
interface Context { interface Context {
wallet: Wallet wallet: Wallet
......
import { Contract, utils, Wallet } from 'ethers' 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 { 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 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 { 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 { interface Context {
contracts: { [name: string]: Contract } contracts: { [name: string]: Contract }
wallet: Wallet wallet: Wallet
......
import { expect } from './shared/setup'
/* Imports: External */ /* Imports: External */
import { Contract, ContractFactory } from 'ethers' import { Contract, ContractFactory } from 'ethers'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { applyL1ToL2Alias, awaitCondition } from '@eth-optimism/core-utils' import { applyL1ToL2Alias, awaitCondition } from '@eth-optimism/core-utils'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup'
import { Direction } from './shared/watcher-utils' import { Direction } from './shared/watcher-utils'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { import {
......
import { expect } from './shared/setup'
import { BigNumber, Contract, ContractFactory, utils, Wallet } from 'ethers' import { BigNumber, Contract, ContractFactory, utils, Wallet } from 'ethers'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import * as L2Artifact from '@eth-optimism/contracts/artifacts/contracts/standards/L2StandardERC20.sol/L2StandardERC20.json' 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 { OptimismEnv } from './shared/env'
import { withdrawalTest } from './shared/utils' import { withdrawalTest } from './shared/utils'
import { Direction } from './shared/watcher-utils' import { Direction } from './shared/watcher-utils'
......
import { expect } from './shared/setup'
import { BigNumber, Contract, ContractFactory, utils, Wallet } from 'ethers' import { BigNumber, Contract, ContractFactory, utils, Wallet } from 'ethers'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { UniswapV3Deployer } from 'uniswap-v3-deploy-plugin/dist/deployer/UniswapV3Deployer' import { UniswapV3Deployer } from 'uniswap-v3-deploy-plugin/dist/deployer/UniswapV3Deployer'
import { OptimismEnv } from './shared/env'
import { FeeAmount, TICK_SPACINGS } from '@uniswap/v3-sdk' 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 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 { 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 // Below methods taken from the Uniswap test suite, see
// https://github.com/Uniswap/v3-periphery/blob/main/test/shared/ticks.ts // https://github.com/Uniswap/v3-periphery/blob/main/test/shared/ticks.ts
const getMinTick = (tickSpacing: number) => const getMinTick = (tickSpacing: number) =>
......
import { expect } from './shared/setup'
/* Imports: External */ /* Imports: External */
import { BigNumber, utils } from 'ethers' import { BigNumber, utils } from 'ethers'
import { serialize } from '@ethersproject/transactions' import { serialize } from '@ethersproject/transactions'
import { predeploys, getContractFactory } from '@eth-optimism/contracts' import { predeploys, getContractFactory } from '@eth-optimism/contracts'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup'
import { hardhatTest } from './shared/utils' import { hardhatTest } from './shared/utils'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { Direction } from './shared/watcher-utils' import { Direction } from './shared/watcher-utils'
......
import { expect } from './shared/setup'
import { BigNumber, Contract, ContractFactory, Wallet } from 'ethers' import { BigNumber, Contract, ContractFactory, Wallet } from 'ethers'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { expect } from './shared/setup'
import { import {
fundUser, fundUser,
encodeSolidityRevertMessage, encodeSolidityRevertMessage,
......
import { expect } from './shared/setup'
/* Imports: External */ /* Imports: External */
import { Wallet, utils, BigNumber } from 'ethers' import { Wallet, utils, BigNumber } from 'ethers'
import { serialize } from '@ethersproject/transactions' import { serialize } from '@ethersproject/transactions'
...@@ -7,8 +5,8 @@ import { predeploys } from '@eth-optimism/contracts' ...@@ -7,8 +5,8 @@ import { predeploys } from '@eth-optimism/contracts'
import { expectApprox } from '@eth-optimism/core-utils' import { expectApprox } from '@eth-optimism/core-utils'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup'
import { Direction } from './shared/watcher-utils' import { Direction } from './shared/watcher-utils'
import { import {
DEFAULT_TEST_GAS_L1, DEFAULT_TEST_GAS_L1,
DEFAULT_TEST_GAS_L2, DEFAULT_TEST_GAS_L2,
......
import { expect } from './shared/setup'
/* Imports: External */ /* Imports: External */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { injectL2Context, expectApprox } from '@eth-optimism/core-utils' import { injectL2Context, expectApprox } from '@eth-optimism/core-utils'
...@@ -7,6 +5,7 @@ import { predeploys } from '@eth-optimism/contracts' ...@@ -7,6 +5,7 @@ import { predeploys } from '@eth-optimism/contracts'
import { Contract, BigNumber } from 'ethers' import { Contract, BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup'
import { import {
l2Provider, l2Provider,
l1Provider, l1Provider,
......
import { expect } from './shared/setup'
/* Imports: Internal */ /* Imports: Internal */
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { predeploys, getContractInterface } from '@eth-optimism/contracts' import { predeploys, getContractInterface } from '@eth-optimism/contracts'
/* Imports: External */ /* Imports: External */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
describe('predeploys', () => { describe('predeploys', () => {
......
import { expect } from './shared/setup'
/* Imports: Internal */ /* Imports: Internal */
import { providers } from 'ethers' import { providers } from 'ethers'
import { injectL2Context, applyL1ToL2Alias } from '@eth-optimism/core-utils' import { injectL2Context, applyL1ToL2Alias } from '@eth-optimism/core-utils'
/* Imports: External */ /* Imports: External */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { Direction } from './shared/watcher-utils' import { Direction } from './shared/watcher-utils'
import { DEFAULT_TEST_GAS_L1, envConfig } from './shared/utils' import { DEFAULT_TEST_GAS_L1, envConfig } from './shared/utils'
......
import { TransactionReceipt } from '@ethersproject/abstract-provider'
import { expect } from './shared/setup' import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { import {
...@@ -6,7 +8,6 @@ import { ...@@ -6,7 +8,6 @@ import {
sleep, sleep,
envConfig, envConfig,
} from './shared/utils' } from './shared/utils'
import { TransactionReceipt } from '@ethersproject/abstract-provider'
describe('Replica Tests', () => { describe('Replica Tests', () => {
let env: OptimismEnv let env: OptimismEnv
......
import { expect } from './shared/setup'
import { expectApprox, injectL2Context } from '@eth-optimism/core-utils' import { expectApprox, injectL2Context } from '@eth-optimism/core-utils'
import { Wallet, BigNumber, Contract, ContractFactory, constants } from 'ethers' import { Wallet, BigNumber, Contract, ContractFactory, constants } from 'ethers'
import { serialize } from '@ethersproject/transactions' import { serialize } from '@ethersproject/transactions'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import {
TransactionReceipt,
TransactionRequest,
} from '@ethersproject/providers'
import { import {
sleep, sleep,
l2Provider, l2Provider,
...@@ -16,10 +19,7 @@ import { ...@@ -16,10 +19,7 @@ import {
envConfig, envConfig,
} from './shared/utils' } from './shared/utils'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { import { expect } from './shared/setup'
TransactionReceipt,
TransactionRequest,
} from '@ethersproject/providers'
describe('Basic RPC tests', () => { describe('Basic RPC tests', () => {
let env: OptimismEnv let env: OptimismEnv
......
...@@ -4,7 +4,6 @@ import { ...@@ -4,7 +4,6 @@ import {
TransactionResponse, TransactionResponse,
} from '@ethersproject/providers' } from '@ethersproject/providers'
import { Watcher } from '@eth-optimism/core-utils' import { Watcher } from '@eth-optimism/core-utils'
import { Contract, Transaction } from 'ethers' import { Contract, Transaction } from 'ethers'
export const initWatcher = async ( export const initWatcher = async (
......
import { expect } from './shared/setup'
/* Imports: External */ /* Imports: External */
import { Contract, Wallet, utils } from 'ethers' import { Contract, Wallet, utils } from 'ethers'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { import {
executeL1ToL2TransactionsParallel, executeL1ToL2TransactionsParallel,
...@@ -15,7 +14,6 @@ import { ...@@ -15,7 +14,6 @@ import {
executeRepeatedL2Transactions, executeRepeatedL2Transactions,
fundRandomWallet, fundRandomWallet,
} from './shared/stress-test-helpers' } from './shared/stress-test-helpers'
/* Imports: Artifacts */ /* Imports: Artifacts */
import { envConfig, fundUser } from './shared/utils' import { envConfig, fundUser } from './shared/utils'
......
import { expect } from './shared/setup'
/* Imports: External */ /* Imports: External */
import { ContractFactory } from 'ethers' import { ContractFactory } from 'ethers'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { predeploys } from '@eth-optimism/contracts' import { predeploys } from '@eth-optimism/contracts'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './shared/setup'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { l2Provider } from './shared/utils' import { l2Provider } from './shared/utils'
......
...@@ -14,6 +14,7 @@ import { Gauge, Histogram, Counter } from 'prom-client' ...@@ -14,6 +14,7 @@ import { Gauge, Histogram, Counter } from 'prom-client'
import { RollupInfo, sleep } from '@eth-optimism/core-utils' import { RollupInfo, sleep } from '@eth-optimism/core-utils'
import { Logger, Metrics } from '@eth-optimism/common-ts' import { Logger, Metrics } from '@eth-optimism/common-ts'
import { getContractFactory } from 'old-contracts' import { getContractFactory } from 'old-contracts'
/* Internal Imports */ /* Internal Imports */
import { TxSubmissionHooks } from '..' import { TxSubmissionHooks } from '..'
......
...@@ -12,8 +12,8 @@ import { ...@@ -12,8 +12,8 @@ import {
import { Logger, Metrics } from '@eth-optimism/common-ts' import { Logger, Metrics } from '@eth-optimism/common-ts'
/* Internal Imports */ /* Internal Imports */
import { BlockRange, BatchSubmitter } from '.'
import { TransactionSubmitter } from '../utils' import { TransactionSubmitter } from '../utils'
import { BlockRange, BatchSubmitter } from '.'
export class StateBatchSubmitter extends BatchSubmitter { export class StateBatchSubmitter extends BatchSubmitter {
// TODO: Change this so that we calculate start = scc.totalElements() and end = ctc.totalElements()! // TODO: Change this so that we calculate start = scc.totalElements() and end = ctc.totalElements()!
......
...@@ -20,9 +20,8 @@ import { ...@@ -20,9 +20,8 @@ import {
BatchContext, BatchContext,
AppendSequencerBatchParams, AppendSequencerBatchParams,
} from '../transaction-chain-contract' } from '../transaction-chain-contract'
import { BlockRange, BatchSubmitter } from '.'
import { TransactionSubmitter } from '../utils' import { TransactionSubmitter } from '../utils'
import { BlockRange, BatchSubmitter } from '.'
export interface AutoFixBatchOptions { export interface AutoFixBatchOptions {
fixDoublePlayedDeposits: boolean fixDoublePlayedDeposits: boolean
......
/* External Imports */ /* External Imports */
import { exit } from 'process'
import { injectL2Context, Bcfg } from '@eth-optimism/core-utils' import { injectL2Context, Bcfg } from '@eth-optimism/core-utils'
import * as Sentry from '@sentry/node' import * as Sentry from '@sentry/node'
import { Logger, Metrics, createMetricsServer } from '@eth-optimism/common-ts' import { Logger, Metrics, createMetricsServer } from '@eth-optimism/common-ts'
import { exit } from 'process'
import { Signer, Wallet } from 'ethers' import { Signer, Wallet } from 'ethers'
import { import {
StaticJsonRpcProvider, StaticJsonRpcProvider,
......
import { expect } from '../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import '@nomiclabs/hardhat-ethers' import '@nomiclabs/hardhat-ethers'
import { Signer, ContractFactory, Contract, BigNumber } from 'ethers' import { Signer, ContractFactory, Contract, BigNumber } from 'ethers'
import sinon from 'sinon' import sinon from 'sinon'
import scc from '@eth-optimism/contracts/artifacts/contracts/L1/rollup/StateCommitmentChain.sol/StateCommitmentChain.json' import scc from '@eth-optimism/contracts/artifacts/contracts/L1/rollup/StateCommitmentChain.sol/StateCommitmentChain.json'
import { getContractInterface } from '@eth-optimism/contracts' import { getContractInterface } from '@eth-optimism/contracts'
import { smockit, MockContract } from '@eth-optimism/smock' import { smockit, MockContract } from '@eth-optimism/smock'
import { getContractFactory } from 'old-contracts' import { getContractFactory } from 'old-contracts'
import { QueueOrigin, Batch, remove0x } from '@eth-optimism/core-utils'
import { Logger, Metrics } from '@eth-optimism/common-ts'
/* Internal Imports */ /* Internal Imports */
import { MockchainProvider } from './mockchain-provider' import { MockchainProvider } from './mockchain-provider'
import { import { expect } from '../setup'
makeAddressManager,
setProxyTarget,
FORCE_INCLUSION_PERIOD_SECONDS,
} from '../helpers'
import { import {
CanonicalTransactionChainContract, CanonicalTransactionChainContract,
TransactionBatchSubmitter as RealTransactionBatchSubmitter, TransactionBatchSubmitter as RealTransactionBatchSubmitter,
...@@ -28,9 +22,11 @@ import { ...@@ -28,9 +22,11 @@ import {
YnatmTransactionSubmitter, YnatmTransactionSubmitter,
ResubmissionConfig, ResubmissionConfig,
} from '../../src' } from '../../src'
import {
import { QueueOrigin, Batch, remove0x } from '@eth-optimism/core-utils' makeAddressManager,
import { Logger, Metrics } from '@eth-optimism/common-ts' setProxyTarget,
FORCE_INCLUSION_PERIOD_SECONDS,
} from '../helpers'
const EXAMPLE_STATE_ROOT = const EXAMPLE_STATE_ROOT =
'0x16b7f83f409c7195b1f4fde5652f1b54a4477eacb6db7927691becafba5f8801' '0x16b7f83f409c7195b1f4fde5652f1b54a4477eacb6db7927691becafba5f8801'
......
import { expect } from '../setup'
import { ethers, BigNumber, Signer } from 'ethers' import { ethers, BigNumber, Signer } from 'ethers'
import { submitTransactionWithYNATM } from '../../src/utils/tx-submission'
import { ResubmissionConfig } from '../../src'
import { import {
TransactionReceipt, TransactionReceipt,
TransactionResponse, TransactionResponse,
} from '@ethersproject/abstract-provider' } from '@ethersproject/abstract-provider'
import { expect } from '../setup'
import { submitTransactionWithYNATM } from '../../src/utils/tx-submission'
import { ResubmissionConfig } from '../../src'
const nullFunction = () => undefined const nullFunction = () => undefined
const nullHooks = { const nullHooks = {
beforeSendTransaction: nullFunction, beforeSendTransaction: nullFunction,
......
import { Server } from 'net'
import prometheus, { import prometheus, {
collectDefaultMetrics, collectDefaultMetrics,
DefaultMetricsCollectorConfiguration, DefaultMetricsCollectorConfiguration,
Registry, Registry,
} from 'prom-client' } from 'prom-client'
import express from 'express' import express from 'express'
import { Server } from 'net'
import { Logger } from './logger' import { Logger } from './logger'
......
/* External Imports */ /* External Imports */
import * as fs from 'fs' import * as fs from 'fs'
import * as path from 'path' import * as path from 'path'
import * as mkdirp from 'mkdirp' import * as mkdirp from 'mkdirp'
const ensure = (value, key) => { const ensure = (value, key) => {
......
/* eslint @typescript-eslint/no-var-requires: "off" */ /* eslint @typescript-eslint/no-var-requires: "off" */
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { DeployFunction } from 'hardhat-deploy/dist/types' import { DeployFunction } from 'hardhat-deploy/dist/types'
import { awaitCondition } from '@eth-optimism/core-utils'
import { import {
getContractFromArtifact, getContractFromArtifact,
fundAccount, fundAccount,
...@@ -8,7 +10,6 @@ import { ...@@ -8,7 +10,6 @@ import {
BIG_BALANCE, BIG_BALANCE,
} from '../src/deploy-utils' } from '../src/deploy-utils'
import { names } from '../src/address-names' import { names } from '../src/address-names'
import { awaitCondition } from '@eth-optimism/core-utils'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
if ((hre as any).deployConfig.forked !== 'true') { if ((hre as any).deployConfig.forked !== 'true') {
......
/* Imports: Internal */ /* Imports: Internal */
import { DeployFunction } from 'hardhat-deploy/dist/types'
import { names } from '../src/address-names' import { names } from '../src/address-names'
/* Imports: External */ /* Imports: External */
import { DeployFunction } from 'hardhat-deploy/dist/types'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deploy } = hre.deployments const { deploy } = hre.deployments
......
import path from 'path' import path from 'path'
import glob from 'glob'
import fs from 'fs' import fs from 'fs'
import glob from 'glob'
/** /**
* Script for automatically generating a file which has a series of `require` statements for * Script for automatically generating a file which has a series of `require` statements for
* importing JSON contract artifacts. We do this to preserve browser compatibility. * importing JSON contract artifacts. We do this to preserve browser compatibility.
......
import path from 'path' import path from 'path'
import glob from 'glob'
import fs from 'fs' import fs from 'fs'
import glob from 'glob'
/** /**
* Script for automatically generating a TypeScript file for retrieving deploy artifact JSON files. * Script for automatically generating a TypeScript file for retrieving deploy artifact JSON files.
* We do this to make sure that this package remains browser compatible. * We do this to make sure that this package remains browser compatible.
......
import dirtree from 'directory-tree'
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
import dirtree from 'directory-tree'
import { predeploys } from '../src' import { predeploys } from '../src'
interface DeploymentInfo { interface DeploymentInfo {
......
/* External Imports */ /* External Imports */
import { promisify } from 'util'
import { exec } from 'child_process' import { exec } from 'child_process'
import { promisify } from 'util'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { import {
computeStorageSlots, computeStorageSlots,
......
import { createInterface } from 'readline' import { createInterface } from 'readline'
import { hexStringEquals } from '@eth-optimism/core-utils' import { hexStringEquals } from '@eth-optimism/core-utils'
export const getInput = (query) => { export const getInput = (query) => {
......
...@@ -4,9 +4,9 @@ import { ethers } from 'ethers' ...@@ -4,9 +4,9 @@ import { ethers } from 'ethers'
import { task } from 'hardhat/config' import { task } from 'hardhat/config'
import * as types from 'hardhat/internal/core/params/argumentTypes' import * as types from 'hardhat/internal/core/params/argumentTypes'
import { hexStringEquals } from '@eth-optimism/core-utils' import { hexStringEquals } from '@eth-optimism/core-utils'
import { getContractFactory, getContractDefinition } from '../src/contract-defs' import { getContractFactory, getContractDefinition } from '../src/contract-defs'
import { names } from '../src/address-names' import { names } from '../src/address-names'
import { import {
getInput, getInput,
color as c, color as c,
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { task } from 'hardhat/config' import { task } from 'hardhat/config'
import * as types from 'hardhat/internal/core/params/argumentTypes' import * as types from 'hardhat/internal/core/params/argumentTypes'
import { getContractFactory, getContractDefinition } from '../src/contract-defs'
import { getContractFactory, getContractDefinition } from '../src/contract-defs'
import { import {
getInput, getInput,
color as c, color as c,
......
'use strict' 'use strict'
import fs from 'fs' import fs from 'fs'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { task } from 'hardhat/config' import { task } from 'hardhat/config'
import * as types from 'hardhat/internal/core/params/argumentTypes' import * as types from 'hardhat/internal/core/params/argumentTypes'
import { LedgerSigner } from '@ethersproject/hardware-wallets' import { LedgerSigner } from '@ethersproject/hardware-wallets'
import { getContractFactory } from '../src/contract-defs' import { getContractFactory } from '../src/contract-defs'
import { predeploys } from '../src/predeploys' import { predeploys } from '../src/predeploys'
......
...@@ -4,6 +4,7 @@ import { ethers } from 'ethers' ...@@ -4,6 +4,7 @@ import { ethers } from 'ethers'
import { task } from 'hardhat/config' import { task } from 'hardhat/config'
import * as types from 'hardhat/internal/core/params/argumentTypes' import * as types from 'hardhat/internal/core/params/argumentTypes'
import { LedgerSigner } from '@ethersproject/hardware-wallets' import { LedgerSigner } from '@ethersproject/hardware-wallets'
import { getContractFactory } from '../src/contract-defs' import { getContractFactory } from '../src/contract-defs'
import { predeploys } from '../src/predeploys' import { predeploys } from '../src/predeploys'
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, BigNumber } from 'ethers' import { Signer, ContractFactory, Contract, BigNumber } from 'ethers'
...@@ -11,6 +9,7 @@ import { ...@@ -11,6 +9,7 @@ import {
} from '@eth-optimism/core-utils' } from '@eth-optimism/core-utils'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { import {
makeAddressManager, makeAddressManager,
setProxyTarget, setProxyTarget,
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, constants } from 'ethers' import { Signer, ContractFactory, Contract, constants } from 'ethers'
...@@ -7,6 +5,7 @@ import { Interface } from 'ethers/lib/utils' ...@@ -7,6 +5,7 @@ import { Interface } from 'ethers/lib/utils'
import { smockit, MockContract, smoddit } from '@eth-optimism/smock' import { smockit, MockContract, smoddit } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../helpers' import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../helpers'
import { getContractInterface, predeploys } from '../../../../src' import { getContractInterface, predeploys } from '../../../../src'
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract } from 'ethers'
...@@ -13,6 +11,7 @@ import { keccak256 } from 'ethers/lib/utils' ...@@ -13,6 +11,7 @@ import { keccak256 } from 'ethers/lib/utils'
import _ from 'lodash' import _ from 'lodash'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { import {
makeAddressManager, makeAddressManager,
setProxyTarget, setProxyTarget,
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, constants } from 'ethers' import { Signer, ContractFactory, Contract, constants } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock' import { smockit, MockContract } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { import {
makeAddressManager, makeAddressManager,
setProxyTarget, setProxyTarget,
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, Contract } from 'ethers' import { Signer, Contract } from 'ethers'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { makeAddressManager } from '../../../helpers' import { makeAddressManager } from '../../../helpers'
describe('BondManager', () => { describe('BondManager', () => {
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import hre, { ethers } from 'hardhat' import hre, { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract } from 'ethers'
...@@ -7,6 +5,7 @@ import { smockit, MockContract } from '@eth-optimism/smock' ...@@ -7,6 +5,7 @@ import { smockit, MockContract } from '@eth-optimism/smock'
import { applyL1ToL2Alias } from '@eth-optimism/core-utils' import { applyL1ToL2Alias } from '@eth-optimism/core-utils'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { import {
NON_NULL_BYTES32, NON_NULL_BYTES32,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract } from 'ethers'
...@@ -11,8 +9,8 @@ import { ...@@ -11,8 +9,8 @@ import {
} from '@eth-optimism/smock' } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../helpers' import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../helpers'
import { getContractInterface } from '../../../../src' import { getContractInterface } from '../../../../src'
const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated'
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract } from 'ethers'
import { smoddit } from '@eth-optimism/smock' import { smoddit } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { predeploys, getContractInterface } from '../../../../src' import { predeploys, getContractInterface } from '../../../../src'
describe('L2StandardTokenFactory', () => { describe('L2StandardTokenFactory', () => {
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { ContractFactory, Contract, Signer } from 'ethers' import { ContractFactory, Contract, Signer } from 'ethers'
import { expect } from '../../../setup'
describe('OVM_ETH', () => { describe('OVM_ETH', () => {
let signer1: Signer let signer1: Signer
let signer2: Signer let signer2: Signer
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { ContractFactory, Contract, Signer } from 'ethers' import { ContractFactory, Contract, Signer } from 'ethers'
import { calculateL1GasUsed, calculateL1Fee } from '@eth-optimism/core-utils' import { calculateL1GasUsed, calculateL1Fee } from '@eth-optimism/core-utils'
import { expect } from '../../../setup'
describe('OVM_GasPriceOracle', () => { describe('OVM_GasPriceOracle', () => {
const initialGasPrice = 0 const initialGasPrice = 0
let signer1: Signer let signer1: Signer
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { ContractFactory, Contract } from 'ethers' import { ContractFactory, Contract } from 'ethers'
...@@ -8,6 +6,7 @@ import { remove0x } from '@eth-optimism/core-utils' ...@@ -8,6 +6,7 @@ import { remove0x } from '@eth-optimism/core-utils'
import { keccak256 } from 'ethers/lib/utils' import { keccak256 } from 'ethers/lib/utils'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { NON_ZERO_ADDRESS } from '../../../helpers/constants' import { NON_ZERO_ADDRESS } from '../../../helpers/constants'
const ELEMENT_TEST_SIZES = [1, 2, 4, 8, 16] const ELEMENT_TEST_SIZES = [1, 2, 4, 8, 16]
......
import { expect } from '../../../setup'
/* Imports: External */ /* Imports: External */
import hre from 'hardhat' import hre from 'hardhat'
import { MockContract, smockit } from '@eth-optimism/smock' import { MockContract, smockit } from '@eth-optimism/smock'
import { Contract, Signer } from 'ethers' import { Contract, Signer } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from '../../../setup'
import { predeploys } from '../../../../src' import { predeploys } from '../../../../src'
describe('OVM_SequencerFeeVault', () => { describe('OVM_SequencerFeeVault', () => {
......
import { expect } from '../../setup'
/* Imports: External */ /* Imports: External */
import hre from 'hardhat' import hre from 'hardhat'
import { Contract, Signer } from 'ethers' import { Contract, Signer } from 'ethers'
import { smockit } from '@eth-optimism/smock' import { smockit } from '@eth-optimism/smock'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from '../../setup'
import { getContractInterface } from '../../../src' import { getContractInterface } from '../../../src'
describe('L1ChugSplashProxy', () => { describe('L1ChugSplashProxy', () => {
......
import '../../../setup'
/* Internal Imports */ /* Internal Imports */
import '../../../setup'
import { Lib_OVMCodec_TEST_JSON } from '../../../data' import { Lib_OVMCodec_TEST_JSON } from '../../../data'
import { runJsonTest } from '../../../helpers' import { runJsonTest } from '../../../helpers'
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract } from 'ethers' import { Contract } from 'ethers'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { Lib_RLPWriter_TEST_JSON } from '../../../data' import { Lib_RLPWriter_TEST_JSON } from '../../../data'
const encode = async (Lib_RLPWriter: Contract, input: any): Promise<void> => { const encode = async (Lib_RLPWriter: Contract, input: any): Promise<void> => {
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract } from 'ethers' import { Contract } from 'ethers'
import { applyL1ToL2Alias, undoL1ToL2Alias } from '@eth-optimism/core-utils' import { applyL1ToL2Alias, undoL1ToL2Alias } from '@eth-optimism/core-utils'
import { expect } from '../../../setup'
describe('AddressAliasHelper', () => { describe('AddressAliasHelper', () => {
let AddressAliasHelper: Contract let AddressAliasHelper: Contract
before(async () => { before(async () => {
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import * as rlp from 'rlp' import * as rlp from 'rlp'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
...@@ -8,6 +6,7 @@ import { fromHexString, toHexString } from '@eth-optimism/core-utils' ...@@ -8,6 +6,7 @@ import { fromHexString, toHexString } from '@eth-optimism/core-utils'
import { Trie } from 'merkle-patricia-tree/dist/baseTrie' import { Trie } from 'merkle-patricia-tree/dist/baseTrie'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { TrieTestGenerator } from '../../../helpers' import { TrieTestGenerator } from '../../../helpers'
import * as officialTestJson from '../../../data/json/libraries/trie/trietest.json' import * as officialTestJson from '../../../data/json/libraries/trie/trietest.json'
import * as officialTestAnyOrderJson from '../../../data/json/libraries/trie/trieanyorder.json' import * as officialTestAnyOrderJson from '../../../data/json/libraries/trie/trieanyorder.json'
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract } from 'ethers' import { Contract } from 'ethers'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { TrieTestGenerator } from '../../../helpers' import { TrieTestGenerator } from '../../../helpers'
const NODE_COUNTS = [1, 2, 128] const NODE_COUNTS = [1, 2, 128]
......
import { expect } from '../../../setup'
import hre from 'hardhat' import hre from 'hardhat'
import { Contract, ethers } from 'ethers' import { Contract, ethers } from 'ethers'
import { expect } from '../../../setup'
describe('Lib_Buffer', () => { describe('Lib_Buffer', () => {
let Lib_Buffer: Contract let Lib_Buffer: Contract
beforeEach(async () => { beforeEach(async () => {
......
/* Internal Imports */ /* Internal Imports */
import { Lib_BytesUtils_TEST_JSON } from '../../../data'
import { runJsonTest } from '../../../helpers'
/* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract } from 'ethers' import { Contract } from 'ethers'
/* External Imports */
import { Lib_BytesUtils_TEST_JSON } from '../../../data'
import { runJsonTest } from '../../../helpers'
import { expect } from '../../../setup' import { expect } from '../../../setup'
describe('Lib_BytesUtils', () => { describe('Lib_BytesUtils', () => {
......
import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract, BigNumber } from 'ethers' import { Contract, BigNumber } from 'ethers'
...@@ -7,6 +5,7 @@ import { MerkleTree } from 'merkletreejs' ...@@ -7,6 +5,7 @@ import { MerkleTree } from 'merkletreejs'
import { fromHexString, toHexString } from '@eth-optimism/core-utils' import { fromHexString, toHexString } from '@eth-optimism/core-utils'
/* Internal Imports */ /* Internal Imports */
import { expect } from '../../../setup'
import { NON_NULL_BYTES32 } from '../../../helpers' import { NON_NULL_BYTES32 } from '../../../helpers'
const NODE_COUNTS = [ const NODE_COUNTS = [
......
import { NON_ZERO_ADDRESS } from '../constants'
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { NON_ZERO_ADDRESS } from '../constants'
export const DUMMY_BATCH_HEADERS = [ export const DUMMY_BATCH_HEADERS = [
{ {
batchIndex: 0, batchIndex: 0,
......
import { expect } from '../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract, BigNumber } from 'ethers' import { Contract, BigNumber } from 'ethers'
import { expect } from '../../setup'
const bigNumberify = (arr: any[]) => { const bigNumberify = (arr: any[]) => {
return arr.map((el: any) => { return arr.map((el: any) => {
if (typeof el === 'number') { if (typeof el === 'number') {
......
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { bnToAddress } from './bn' import { bnToAddress } from './bn'
// Constant representing the alias to apply to the msg.sender when a contract sends an L1 => L2 // Constant representing the alias to apply to the msg.sender when a contract sends an L1 => L2
......
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { remove0x, add0x } from './common/hex-strings' import { remove0x, add0x } from './common/hex-strings'
/** /**
......
import { add0x, remove0x, encodeHex } from '../common'
import { BigNumber, ethers } from 'ethers' import { BigNumber, ethers } from 'ethers'
import { add0x, remove0x, encodeHex } from '../common'
export interface BatchContext { export interface BatchContext {
numSequencedTransactions: number numSequencedTransactions: number
numSubsequentQueueTransactions: number numSubsequentQueueTransactions: number
......
import { expect } from 'chai' import { expect } from 'chai'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { sleep } from './misc' import { sleep } from './misc'
interface deviationRanges { interface deviationRanges {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { remove0x } from './common' import { remove0x } from './common'
const txDataZeroGas = 4 const txDataZeroGas = 4
......
import './setup' import './setup'
/* Internal Imports */ /* Internal Imports */
import { expect } from 'chai'
import { import {
encodeAppendSequencerBatch, encodeAppendSequencerBatch,
decodeAppendSequencerBatch, decodeAppendSequencerBatch,
sequencerBatch, sequencerBatch,
} from '../src' } from '../src'
import { expect } from 'chai'
describe('BatchEncoder', () => { describe('BatchEncoder', () => {
describe('appendSequencerBatch', () => { describe('appendSequencerBatch', () => {
......
import { expect } from './setup'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './setup'
import { import {
toRpcHexString, toRpcHexString,
remove0x, remove0x,
......
import { expect } from './setup'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './setup'
import { sleep } from '../src' import { sleep } from '../src'
describe('sleep', async () => { describe('sleep', async () => {
......
import { expect } from './setup' import { assert } from 'chai'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from './setup'
import { expectApprox, awaitCondition } from '../src' import { expectApprox, awaitCondition } from '../src'
import { assert } from 'chai'
describe('awaitCondition', () => { describe('awaitCondition', () => {
it('should try the condition fn until it returns true', async () => { it('should try the condition fn until it returns true', async () => {
......
...@@ -3,6 +3,7 @@ import { LevelUp } from 'levelup' ...@@ -3,6 +3,7 @@ import { LevelUp } from 'levelup'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { SimpleDB } from './simple-db'
import { import {
EnqueueEntry, EnqueueEntry,
StateRootBatchEntry, StateRootBatchEntry,
...@@ -10,7 +11,6 @@ import { ...@@ -10,7 +11,6 @@ import {
TransactionBatchEntry, TransactionBatchEntry,
TransactionEntry, TransactionEntry,
} from '../types/database-types' } from '../types/database-types'
import { SimpleDB } from './simple-db'
const TRANSPORT_DB_KEYS = { const TRANSPORT_DB_KEYS = {
ENQUEUE: `enqueue`, ENQUEUE: `enqueue`,
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
import { SequencerBatchAppendedEvent } from '@eth-optimism/contracts/dist/types/CanonicalTransactionChain' import { SequencerBatchAppendedEvent } from '@eth-optimism/contracts/dist/types/CanonicalTransactionChain'
/* Imports: Internal */ /* Imports: Internal */
import { MissingElementError } from './errors'
import { import {
DecodedSequencerBatchTransaction, DecodedSequencerBatchTransaction,
SequencerBatchAppendedExtraData, SequencerBatchAppendedExtraData,
...@@ -18,7 +19,6 @@ import { ...@@ -18,7 +19,6 @@ import {
EventHandlerSet, EventHandlerSet,
} from '../../../types' } from '../../../types'
import { SEQUENCER_GAS_LIMIT, parseSignatureVParam } from '../../../utils' import { SEQUENCER_GAS_LIMIT, parseSignatureVParam } from '../../../utils'
import { MissingElementError } from './errors'
export const handleEventsSequencerBatchAppended: EventHandlerSet< export const handleEventsSequencerBatchAppended: EventHandlerSet<
SequencerBatchAppendedEvent, SequencerBatchAppendedEvent,
......
...@@ -4,6 +4,7 @@ import { getContractFactory } from '@eth-optimism/contracts' ...@@ -4,6 +4,7 @@ import { getContractFactory } from '@eth-optimism/contracts'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { MissingElementError } from './errors'
import { import {
StateRootBatchEntry, StateRootBatchEntry,
StateBatchAppendedExtraData, StateBatchAppendedExtraData,
...@@ -11,7 +12,6 @@ import { ...@@ -11,7 +12,6 @@ import {
StateRootEntry, StateRootEntry,
EventHandlerSet, EventHandlerSet,
} from '../../../types' } from '../../../types'
import { MissingElementError } from './errors'
export const handleEventsStateBatchAppended: EventHandlerSet< export const handleEventsStateBatchAppended: EventHandlerSet<
StateBatchAppendedEvent, StateBatchAppendedEvent,
......
...@@ -3,8 +3,8 @@ import { BigNumber } from 'ethers' ...@@ -3,8 +3,8 @@ import { BigNumber } from 'ethers'
import { TransactionEnqueuedEvent } from '@eth-optimism/contracts/dist/types/CanonicalTransactionChain' import { TransactionEnqueuedEvent } from '@eth-optimism/contracts/dist/types/CanonicalTransactionChain'
/* Imports: Internal */ /* Imports: Internal */
import { EnqueueEntry, EventHandlerSet } from '../../../types'
import { MissingElementError } from './errors' import { MissingElementError } from './errors'
import { EnqueueEntry, EventHandlerSet } from '../../../types'
export const handleEventsTransactionEnqueued: EventHandlerSet< export const handleEventsTransactionEnqueued: EventHandlerSet<
TransactionEnqueuedEvent, TransactionEnqueuedEvent,
......
...@@ -8,6 +8,10 @@ import { constants } from 'ethers' ...@@ -8,6 +8,10 @@ import { constants } from 'ethers'
import { Gauge, Counter } from 'prom-client' import { Gauge, Counter } from 'prom-client'
/* Imports: Internal */ /* Imports: Internal */
import { handleEventsTransactionEnqueued } from './handlers/transaction-enqueued'
import { handleEventsSequencerBatchAppended } from './handlers/sequencer-batch-appended'
import { handleEventsStateBatchAppended } from './handlers/state-batch-appended'
import { MissingElementError } from './handlers/errors'
import { TransportDB } from '../../db/transport-db' import { TransportDB } from '../../db/transport-db'
import { import {
OptimismContracts, OptimismContracts,
...@@ -17,11 +21,7 @@ import { ...@@ -17,11 +21,7 @@ import {
validators, validators,
} from '../../utils' } from '../../utils'
import { EventHandlerSet } from '../../types' import { EventHandlerSet } from '../../types'
import { handleEventsTransactionEnqueued } from './handlers/transaction-enqueued'
import { handleEventsSequencerBatchAppended } from './handlers/sequencer-batch-appended'
import { handleEventsStateBatchAppended } from './handlers/state-batch-appended'
import { L1DataTransportServiceOptions } from '../main/service' import { L1DataTransportServiceOptions } from '../main/service'
import { MissingElementError } from './handlers/errors'
interface L1IngestionMetrics { interface L1IngestionMetrics {
highestSyncedL1Block: Gauge<string> highestSyncedL1Block: Gauge<string>
......
...@@ -8,10 +8,10 @@ import bfj from 'bfj' ...@@ -8,10 +8,10 @@ import bfj from 'bfj'
import { Gauge } from 'prom-client' import { Gauge } from 'prom-client'
/* Imports: Internal */ /* Imports: Internal */
import { handleSequencerBlock } from './handlers/transaction'
import { TransportDB } from '../../db/transport-db' import { TransportDB } from '../../db/transport-db'
import { sleep, toRpcHexString, validators } from '../../utils' import { sleep, toRpcHexString, validators } from '../../utils'
import { L1DataTransportServiceOptions } from '../main/service' import { L1DataTransportServiceOptions } from '../main/service'
import { handleSequencerBlock } from './handlers/transaction'
interface L2IngestionMetrics { interface L2IngestionMetrics {
highestSyncedL2Block: Gauge<string> highestSyncedL2Block: Gauge<string>
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
import { BaseService, Metrics } from '@eth-optimism/common-ts' import { BaseService, Metrics } from '@eth-optimism/common-ts'
import { LevelUp } from 'levelup' import { LevelUp } from 'levelup'
import level from 'level' import level from 'level'
import { Counter } from 'prom-client'
/* Imports: Internal */ /* Imports: Internal */
import { L1IngestionService } from '../l1-ingestion/service' import { L1IngestionService } from '../l1-ingestion/service'
import { L1TransportServer } from '../server/service' import { L1TransportServer } from '../server/service'
import { validators } from '../../utils' import { validators } from '../../utils'
import { L2IngestionService } from '../l2-ingestion/service' import { L2IngestionService } from '../l2-ingestion/service'
import { Counter } from 'prom-client'
export interface L1DataTransportServiceOptions { export interface L1DataTransportServiceOptions {
nodeEnv: string nodeEnv: string
......
...@@ -2,13 +2,13 @@ import { BaseProvider } from '@ethersproject/providers' ...@@ -2,13 +2,13 @@ import { BaseProvider } from '@ethersproject/providers'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { TypedEvent } from '@eth-optimism/contracts/dist/types/common' import { TypedEvent } from '@eth-optimism/contracts/dist/types/common'
import { TransportDB } from '../db/transport-db'
import { import {
TransactionBatchEntry, TransactionBatchEntry,
TransactionEntry, TransactionEntry,
StateRootBatchEntry, StateRootBatchEntry,
StateRootEntry, StateRootEntry,
} from './database-types' } from './database-types'
import { TransportDB } from '../db/transport-db'
export type GetExtraDataHandler<TEvent extends TypedEvent, TExtraData> = ( export type GetExtraDataHandler<TEvent extends TypedEvent, TExtraData> = (
event?: TEvent, event?: TEvent,
......
import { fromHexString } from '@eth-optimism/core-utils'
import * as url from 'url' import * as url from 'url'
import { fromHexString } from '@eth-optimism/core-utils'
export const validators = { export const validators = {
isBoolean: (val: any): boolean => { isBoolean: (val: any): boolean => {
return typeof val === 'boolean' return typeof val === 'boolean'
......
import { expect } from '../../../../setup'
/* Imports: External */ /* Imports: External */
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { Block } from '@ethersproject/abstract-provider' import { Block } from '@ethersproject/abstract-provider'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from '../../../../setup'
import { handleEventsStateBatchAppended } from '../../../../../src/services/l1-ingestion/handlers/state-batch-appended' import { handleEventsStateBatchAppended } from '../../../../../src/services/l1-ingestion/handlers/state-batch-appended'
import { StateBatchAppendedExtraData } from '../../../../../src/types' import { StateBatchAppendedExtraData } from '../../../../../src/types'
import { l1StateBatchData } from '../../../examples/l1-data' import { l1StateBatchData } from '../../../examples/l1-data'
......
import { expect } from '../../../../setup'
/* Imports: External */ /* Imports: External */
import { ethers, BigNumber } from 'ethers' import { ethers, BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from '../../../../setup'
import { handleEventsTransactionEnqueued } from '../../../../../src/services/l1-ingestion/handlers/transaction-enqueued' import { handleEventsTransactionEnqueued } from '../../../../../src/services/l1-ingestion/handlers/transaction-enqueued'
const MAX_ITERATIONS = 128 const MAX_ITERATIONS = 128
......
import { expect } from '../../../../setup'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from '../../../../setup'
import { l2Block } from '../../../examples/l2-data' import { l2Block } from '../../../examples/l2-data'
import { handleSequencerBlock } from '../../../../../src/services/l2-ingestion/handlers/transaction' import { handleSequencerBlock } from '../../../../../src/services/l2-ingestion/handlers/transaction'
......
import { Wallet, providers } from 'ethers' import { Wallet, providers } from 'ethers'
import { MessageRelayerService } from '../service'
import { Bcfg } from '@eth-optimism/core-utils' import { Bcfg } from '@eth-optimism/core-utils'
import { Logger, LoggerOptions } from '@eth-optimism/common-ts' import { Logger, LoggerOptions } from '@eth-optimism/common-ts'
import * as Sentry from '@sentry/node' import * as Sentry from '@sentry/node'
import * as dotenv from 'dotenv' import * as dotenv from 'dotenv'
import Config from 'bcfg' import Config from 'bcfg'
import { MessageRelayerService } from '../service'
dotenv.config() dotenv.config()
const main = async () => { const main = async () => {
......
...@@ -2,16 +2,15 @@ ...@@ -2,16 +2,15 @@
import { Contract, ethers, Wallet, BigNumber, providers } from 'ethers' import { Contract, ethers, Wallet, BigNumber, providers } from 'ethers'
import * as rlp from 'rlp' import * as rlp from 'rlp'
import { MerkleTree } from 'merkletreejs' import { MerkleTree } from 'merkletreejs'
/* Imports: Internal */
import { fromHexString, sleep } from '@eth-optimism/core-utils' import { fromHexString, sleep } from '@eth-optimism/core-utils'
import { Logger, BaseService, Metrics } from '@eth-optimism/common-ts' import { Logger, BaseService, Metrics } from '@eth-optimism/common-ts'
import { import {
loadContract, loadContract,
loadContractFromManager, loadContractFromManager,
predeploys, predeploys,
} from '@eth-optimism/contracts' } from '@eth-optimism/contracts'
/* Imports: Internal */
import { StateRootBatchHeader, SentMessage, SentMessageProof } from './types' import { StateRootBatchHeader, SentMessage, SentMessageProof } from './types'
interface MessageRelayerOptions { interface MessageRelayerOptions {
......
import { expect } from '../setup'
/* Imports: External */ /* Imports: External */
import hre from 'hardhat' import hre from 'hardhat'
import { Contract, Signer } from 'ethers' import { Contract, Signer } from 'ethers'
...@@ -8,6 +6,7 @@ import { smockit } from '@eth-optimism/smock' ...@@ -8,6 +6,7 @@ import { smockit } from '@eth-optimism/smock'
import { toPlainObject } from 'lodash' import { toPlainObject } from 'lodash'
/* Imports: Internal */ /* Imports: Internal */
import { expect } from '../setup'
import { import {
getMerkleTreeProof, getMerkleTreeProof,
getMessagesAndProofsForL2Transaction, getMessagesAndProofsForL2Transaction,
......
...@@ -6,6 +6,7 @@ import { ...@@ -6,6 +6,7 @@ import {
POOL_INIT_CODE_HASH_OPTIMISM_KOVAN, POOL_INIT_CODE_HASH_OPTIMISM_KOVAN,
} from '@uniswap/v3-sdk' } from '@uniswap/v3-sdk'
import { Token } from '@uniswap/sdk-core' import { Token } from '@uniswap/sdk-core'
import { UNISWAP_V3_FACTORY_ADDRESS } from './constants' import { UNISWAP_V3_FACTORY_ADDRESS } from './constants'
import { downloadAllSolcVersions } from './solc' import { downloadAllSolcVersions } from './solc'
import { import {
......
...@@ -5,6 +5,7 @@ import { ...@@ -5,6 +5,7 @@ import {
POOL_INIT_CODE_HASH_OPTIMISM_KOVAN, POOL_INIT_CODE_HASH_OPTIMISM_KOVAN,
} from '@uniswap/v3-sdk' } from '@uniswap/v3-sdk'
import { sleep, add0x, remove0x, clone } from '@eth-optimism/core-utils' import { sleep, add0x, remove0x, clone } from '@eth-optimism/core-utils'
import { import {
OLD_ETH_ADDRESS, OLD_ETH_ADDRESS,
WETH_TRANSFER_ADDRESSES, WETH_TRANSFER_ADDRESSES,
......
/* eslint @typescript-eslint/no-var-requires: "off" */ /* eslint @typescript-eslint/no-var-requires: "off" */
import fetch from 'node-fetch'
import path from 'path'
import fs from 'fs' import fs from 'fs'
import path from 'path'
import fetch from 'node-fetch'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { clone } from '@eth-optimism/core-utils' import { clone } from '@eth-optimism/core-utils'
import setupMethods from 'solc/wrapper' import setupMethods from 'solc/wrapper'
import { import {
COMPILER_VERSIONS_TO_SOLC, COMPILER_VERSIONS_TO_SOLC,
EMSCRIPTEN_BUILD_LIST, EMSCRIPTEN_BUILD_LIST,
......
import { ethers } from 'ethers'
import fs from 'fs' import fs from 'fs'
import { ethers } from 'ethers'
import { add0x, remove0x, clone } from '@eth-optimism/core-utils' import { add0x, remove0x, clone } from '@eth-optimism/core-utils'
import { StateDump, SurgeryDataSources, AccountType } from './types' import { StateDump, SurgeryDataSources, AccountType } from './types'
import { findAccount } from './utils' import { findAccount } from './utils'
import { handlers } from './handlers' import { handlers } from './handlers'
......
/* eslint @typescript-eslint/no-var-requires: "off" */ /* eslint @typescript-eslint/no-var-requires: "off" */
import { createReadStream } from 'fs'
import * as fs from 'fs'
import * as assert from 'assert'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { abi as UNISWAP_FACTORY_ABI } from '@uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.json' import { abi as UNISWAP_FACTORY_ABI } from '@uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.json'
import { Interface } from '@ethersproject/abi' import { Interface } from '@ethersproject/abi'
import { parseChunked } from '@discoveryjs/json-ext' import { parseChunked } from '@discoveryjs/json-ext'
import { createReadStream } from 'fs'
import * as fs from 'fs'
import byline from 'byline' import byline from 'byline'
import * as dotenv from 'dotenv' import * as dotenv from 'dotenv'
import * as assert from 'assert'
import { reqenv, getenv, remove0x } from '@eth-optimism/core-utils' import { reqenv, getenv, remove0x } from '@eth-optimism/core-utils'
import { import {
Account, Account,
EtherscanContract, EtherscanContract,
......
import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util' import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util'
import { add0x } from '@eth-optimism/core-utils' import { add0x } from '@eth-optimism/core-utils'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { expect, env } from './setup' import { expect, env } from './setup'
import { AccountType } from '../scripts/types' import { AccountType } from '../scripts/types'
......
import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util' import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util'
import { add0x } from '@eth-optimism/core-utils' import { add0x } from '@eth-optimism/core-utils'
import { expect, env } from './setup' import { expect, env } from './setup'
import { AccountType, Account } from '../scripts/types' import { AccountType, Account } from '../scripts/types'
......
import { expect } from '@eth-optimism/core-utils/test/setup' import { expect } from '@eth-optimism/core-utils/test/setup'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { env } from './setup' import { env } from './setup'
describe('erc20', () => { describe('erc20', () => {
......
import { ethers, BigNumber, Contract } from 'ethers' import { ethers, BigNumber, Contract } from 'ethers'
import { expect, env, ERC20_ABI } from './setup' import { expect, env, ERC20_ABI } from './setup'
import { AccountType } from '../scripts/types'
import { GenesisJsonProvider } from './provider' import { GenesisJsonProvider } from './provider'
import { AccountType } from '../scripts/types'
describe('predeploys', () => { describe('predeploys', () => {
const predeploys = { const predeploys = {
......
import { expect } from '@eth-optimism/core-utils/test/setup' import { expect } from '@eth-optimism/core-utils/test/setup'
import { ethers, BigNumber } from 'ethers' import { ethers, BigNumber } from 'ethers'
import { GenesisJsonProvider } from './provider'
import { Genesis } from '@eth-optimism/core-utils/src/types' import { Genesis } from '@eth-optimism/core-utils/src/types'
import { import {
remove0x, remove0x,
...@@ -8,6 +7,8 @@ import { ...@@ -8,6 +7,8 @@ import {
} from '@eth-optimism/core-utils/src/common/hex-strings' } from '@eth-optimism/core-utils/src/common/hex-strings'
import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util' import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util'
import { GenesisJsonProvider } from './provider'
const account = '0x66a84544bed4ca45b3c024776812abf87728fbaf' const account = '0x66a84544bed4ca45b3c024776812abf87728fbaf'
const genesis: Genesis = { const genesis: Genesis = {
......
import path from 'path'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import { Deferrable } from '@ethersproject/properties' import { Deferrable } from '@ethersproject/properties'
...@@ -16,8 +18,6 @@ import { ...@@ -16,8 +18,6 @@ import {
Listener, Listener,
} from '@ethersproject/abstract-provider' } from '@ethersproject/abstract-provider'
import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util' import { KECCAK256_RLP_S, KECCAK256_NULL_S } from 'ethereumjs-util'
import path from 'path'
import { bytes32ify, remove0x, add0x } from '@eth-optimism/core-utils' import { bytes32ify, remove0x, add0x } from '@eth-optimism/core-utils'
// Represents the ethereum state // Represents the ethereum state
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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