Commit 0af3d196 authored by Kelvin Fichter's avatar Kelvin Fichter

fix: lint files after fixing linting command issue

parent 45115399
...@@ -370,8 +370,9 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -370,8 +370,9 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
} }
let isEqual = true let isEqual = true
const [queueEleHash, timestamp, blockNumber] = const [, timestamp, blockNumber] = await this.chainContract.getQueueElement(
await this.chainContract.getQueueElement(queueIndex) queueIndex
)
// TODO: Verify queue element hash equality. The queue element hash can be computed with: // TODO: Verify queue element hash equality. The queue element hash can be computed with:
// keccak256( abi.encode( msg.sender, _target, _gasLimit, _data)) // keccak256( abi.encode( msg.sender, _target, _gasLimit, _data))
...@@ -445,7 +446,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -445,7 +446,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
if (nextQueueIndex >= totalQueueElements) { if (nextQueueIndex >= totalQueueElements) {
break break
} }
const [queueEleHash, timestamp, blockNumber] = const [, timestamp, blockNumber] =
await this.chainContract.getQueueElement(nextQueueIndex) await this.chainContract.getQueueElement(nextQueueIndex)
if (timestamp < ele.timestamp || blockNumber < ele.blockNumber) { if (timestamp < ele.timestamp || blockNumber < ele.blockNumber) {
...@@ -506,7 +507,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -506,7 +507,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
const totalQueueElements = const totalQueueElements =
pendingQueueElements + nextRemoteQueueElements pendingQueueElements + nextRemoteQueueElements
if (nextQueueIndex < totalQueueElements) { if (nextQueueIndex < totalQueueElements) {
const [queueEleHash, queueTimestamp, queueBlockNumber] = const [, queueTimestamp, queueBlockNumber] =
await this.chainContract.getQueueElement(nextQueueIndex) await this.chainContract.getQueueElement(nextQueueIndex)
latestTimestamp = queueTimestamp latestTimestamp = queueTimestamp
latestBlockNumber = queueBlockNumber latestBlockNumber = queueBlockNumber
...@@ -611,8 +612,6 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -611,8 +612,6 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
// convert to bytes27 // convert to bytes27
meta = meta.slice(10) meta = meta.slice(10)
const totalElements = meta.slice(-10)
const nextQueueIndex = meta.slice(-20, -10)
const lastTimestamp = parseInt(meta.slice(-30, -20), 16) const lastTimestamp = parseInt(meta.slice(-30, -20), 16)
const lastBlockNumber = parseInt(meta.slice(-40, -30), 16) const lastBlockNumber = parseInt(meta.slice(-40, -30), 16)
this.logger.debug('Retrieved timestamp and block number from CTC', { this.logger.debug('Retrieved timestamp and block number from CTC', {
...@@ -627,8 +626,9 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -627,8 +626,9 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
queueIndex: number, queueIndex: number,
queueElement: BatchElement queueElement: BatchElement
): Promise<BatchElement> { ): Promise<BatchElement> {
const [queueEleHash, timestamp, blockNumber] = const [, timestamp, blockNumber] = await this.chainContract.getQueueElement(
await this.chainContract.getQueueElement(queueIndex) queueIndex
)
if ( if (
timestamp > queueElement.timestamp && timestamp > queueElement.timestamp &&
......
import { Signer, utils, ethers, PopulatedTransaction } from 'ethers' import { Signer, ethers, PopulatedTransaction } from 'ethers'
import { import {
TransactionReceipt, TransactionReceipt,
TransactionResponse, TransactionResponse,
......
...@@ -4,12 +4,10 @@ import { expect } from '../setup' ...@@ -4,12 +4,10 @@ import { expect } from '../setup'
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 ganache from 'ganache-core'
import sinon from 'sinon' import sinon from 'sinon'
import { Web3Provider } from '@ethersproject/providers'
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, predeploys } 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'
...@@ -27,27 +25,19 @@ import { ...@@ -27,27 +25,19 @@ import {
StateBatchSubmitter, StateBatchSubmitter,
TX_BATCH_SUBMITTER_LOG_TAG, TX_BATCH_SUBMITTER_LOG_TAG,
STATE_BATCH_SUBMITTER_LOG_TAG, STATE_BATCH_SUBMITTER_LOG_TAG,
BatchSubmitter,
YnatmTransactionSubmitter, YnatmTransactionSubmitter,
ResubmissionConfig, ResubmissionConfig,
} from '../../src' } from '../../src'
import { import { QueueOrigin, Batch, remove0x } from '@eth-optimism/core-utils'
QueueOrigin,
Batch,
Signature,
remove0x,
} from '@eth-optimism/core-utils'
import { Logger, Metrics } from '@eth-optimism/common-ts' import { Logger, Metrics } from '@eth-optimism/common-ts'
const DUMMY_ADDRESS = '0x' + '00'.repeat(20)
const EXAMPLE_STATE_ROOT = const EXAMPLE_STATE_ROOT =
'0x16b7f83f409c7195b1f4fde5652f1b54a4477eacb6db7927691becafba5f8801' '0x16b7f83f409c7195b1f4fde5652f1b54a4477eacb6db7927691becafba5f8801'
const MAX_GAS_LIMIT = 8_000_000 const MAX_GAS_LIMIT = 8_000_000
const MAX_TX_SIZE = 100_000 const MAX_TX_SIZE = 100_000
const MIN_TX_SIZE = 1_000 const MIN_TX_SIZE = 1_000
const MIN_GAS_PRICE_IN_GWEI = 1 const MIN_GAS_PRICE_IN_GWEI = 1
const MAX_GAS_PRICE_IN_GWEI = 70
const GAS_RETRY_INCREMENT = 5 const GAS_RETRY_INCREMENT = 5
const GAS_THRESHOLD_IN_GWEI = 120 const GAS_THRESHOLD_IN_GWEI = 120
...@@ -67,13 +57,9 @@ const getQueueElement = async ( ...@@ -67,13 +57,9 @@ const getQueueElement = async (
const nextQueueElement = await ctcContract.getQueueElement(nextQueueIndex) const nextQueueElement = await ctcContract.getQueueElement(nextQueueIndex)
return nextQueueElement return nextQueueElement
} }
const DUMMY_SIG: Signature = {
r: '11'.repeat(32),
s: '22'.repeat(32),
v: 1,
}
// A transaction batch submitter which skips the validate batch check // A transaction batch submitter which skips the validate batch check
class TransactionBatchSubmitter extends RealTransactionBatchSubmitter { class TransactionBatchSubmitter extends RealTransactionBatchSubmitter {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected async _validateBatch(batch: Batch): Promise<boolean> { protected async _validateBatch(batch: Batch): Promise<boolean> {
return true return true
} }
...@@ -250,11 +236,6 @@ describe('BatchSubmitter', () => { ...@@ -250,11 +236,6 @@ describe('BatchSubmitter', () => {
describe('TransactionBatchSubmitter', () => { describe('TransactionBatchSubmitter', () => {
describe('submitNextBatch', () => { describe('submitNextBatch', () => {
const enqueuedElements: Array<{
blockNumber: number
timestamp: number
}> = []
let batchSubmitter let batchSubmitter
beforeEach(async () => { beforeEach(async () => {
for (let i = 1; i < 15; i++) { for (let i = 1; i < 15; i++) {
...@@ -490,21 +471,3 @@ describe('BatchSubmitter', () => { ...@@ -490,21 +471,3 @@ describe('BatchSubmitter', () => {
}) })
}) })
}) })
describe('Batch Submitter with Ganache', () => {
let signer
const server = ganache.server({
default_balance_ether: 420,
blockTime: 2_000,
})
const provider = new Web3Provider(ganache.provider())
before(async () => {
await server.listen(3001)
signer = await provider.getSigner()
})
after(async () => {
await server.close()
})
})
...@@ -120,7 +120,6 @@ export class MockchainProvider extends providers.JsonRpcProvider { ...@@ -120,7 +120,6 @@ export class MockchainProvider extends providers.JsonRpcProvider {
} }
private _toL2Block(block: UnformattedL2Block): L2Block { private _toL2Block(block: UnformattedL2Block): L2Block {
const txType: number = parseInt(block.transactions[0].signatureHashType, 10)
const l1BlockNumber: number = parseInt( const l1BlockNumber: number = parseInt(
block.transactions[0].l1BlockNumber, block.transactions[0].l1BlockNumber,
10 10
......
/* External Imports */ /* External Imports */
import { ethers } from 'ethers'
import { defaultAccounts } from 'ethereum-waffle' import { defaultAccounts } from 'ethereum-waffle'
export const FORCE_INCLUSION_PERIOD_SECONDS = 600 export const FORCE_INCLUSION_PERIOD_SECONDS = 600
......
...@@ -89,7 +89,6 @@ describe('submitTransactionWithYNATM', async () => { ...@@ -89,7 +89,6 @@ describe('submitTransactionWithYNATM', async () => {
// than our resubmission timeout // than our resubmission timeout
const resubmissionTimeout = 100 const resubmissionTimeout = 100
const txReceiptDelay = resubmissionTimeout * 3 const txReceiptDelay = resubmissionTimeout * 3
const numConfirmations = 3
let lastGasPrice = BigNumber.from(0) let lastGasPrice = BigNumber.from(0)
// Create a transaction which has a gas price that we will watch increment // Create a transaction which has a gas price that we will watch increment
const tx = { const tx = {
...@@ -106,10 +105,7 @@ describe('submitTransactionWithYNATM', async () => { ...@@ -106,10 +105,7 @@ describe('submitTransactionWithYNATM', async () => {
hash: 'dummy hash', hash: 'dummy hash',
} as TransactionResponse } as TransactionResponse
} }
const waitForTransaction = async ( const waitForTransaction = async (): Promise<TransactionReceipt> => {
hash: string,
_numConfirmations: number
): Promise<TransactionReceipt> => {
await new Promise((r) => setTimeout(r, txReceiptDelay)) await new Promise((r) => setTimeout(r, txReceiptDelay))
return {} as TransactionReceipt return {} as TransactionReceipt
} }
...@@ -117,7 +113,7 @@ describe('submitTransactionWithYNATM', async () => { ...@@ -117,7 +113,7 @@ describe('submitTransactionWithYNATM', async () => {
getGasPrice: async () => ethers.BigNumber.from(0), getGasPrice: async () => ethers.BigNumber.from(0),
sendTransaction, sendTransaction,
provider: { provider: {
waitForTransaction, waitForTransaction: waitForTransaction as any,
}, },
} as Signer } as Signer
const config: ResubmissionConfig = { const config: ResubmissionConfig = {
......
...@@ -20,7 +20,7 @@ export class SimpleDB { ...@@ -20,7 +20,7 @@ export class SimpleDB {
endIndex: number endIndex: number
): Promise<TEntry[] | []> { ): Promise<TEntry[] | []> {
try { try {
return new Promise<any[]>((resolve, reject) => { return new Promise<any[]>((resolve) => {
const entries: any[] = [] const entries: any[] = []
this.db this.db
.createValueStream({ .createValueStream({
...@@ -30,7 +30,7 @@ export class SimpleDB { ...@@ -30,7 +30,7 @@ export class SimpleDB {
.on('data', (transaction: string) => { .on('data', (transaction: string) => {
entries.push(JSON.parse(transaction)) entries.push(JSON.parse(transaction))
}) })
.on('error', (err: any) => { .on('error', () => {
resolve(null) resolve(null)
}) })
.on('close', () => { .on('close', () => {
......
...@@ -17,11 +17,7 @@ import { ...@@ -17,11 +17,7 @@ import {
TransactionEntry, TransactionEntry,
EventHandlerSet, EventHandlerSet,
} from '../../../types' } from '../../../types'
import { import { SEQUENCER_GAS_LIMIT, parseSignatureVParam } from '../../../utils'
SEQUENCER_ENTRYPOINT_ADDRESS,
SEQUENCER_GAS_LIMIT,
parseSignatureVParam,
} from '../../../utils'
import { MissingElementError } from './errors' import { MissingElementError } from './errors'
export const handleEventsSequencerBatchAppended: EventHandlerSet< export const handleEventsSequencerBatchAppended: EventHandlerSet<
......
...@@ -9,11 +9,7 @@ import { ...@@ -9,11 +9,7 @@ import {
StateRootEntry, StateRootEntry,
TransactionEntry, TransactionEntry,
} from '../../../types' } from '../../../types'
import { import { padHexString, parseSignatureVParam } from '../../../utils'
padHexString,
SEQUENCER_GAS_LIMIT,
parseSignatureVParam,
} from '../../../utils'
export const handleSequencerBlock = { export const handleSequencerBlock = {
parseBlock: async ( parseBlock: async (
......
/* Imports: External */ /* Imports: External */
import { BaseService, Logger, 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'
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
import { BaseService, Logger, Metrics } from '@eth-optimism/common-ts' import { BaseService, Logger, Metrics } from '@eth-optimism/common-ts'
import express, { Request, Response } from 'express' import express, { Request, Response } from 'express'
import promBundle from 'express-prom-bundle' import promBundle from 'express-prom-bundle'
import { Gauge } from 'prom-client'
import cors from 'cors' import cors from 'cors'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { JsonRpcProvider } from '@ethersproject/providers' import { JsonRpcProvider } from '@ethersproject/providers'
......
...@@ -14,7 +14,6 @@ import { ...@@ -14,7 +14,6 @@ import {
StateDump, StateDump,
SurgeryConfigs, SurgeryConfigs,
GenesisFile, GenesisFile,
SupportedNetworks,
} from './types' } from './types'
import { UNISWAP_V3_FACTORY_ADDRESS } from './constants' import { UNISWAP_V3_FACTORY_ADDRESS } from './constants'
......
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