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