Commit fc64f875 authored by Kevin Chen's avatar Kevin Chen

fault-detector: Remove pre-bedrock support.

parent 52eb1a26
import { Contract, BigNumber } from 'ethers' import { Contract, BigNumber } from 'ethers'
import { Logger } from '@eth-optimism/common-ts' import { Logger } from '@eth-optimism/common-ts'
export interface OutputOracle<TSubmissionEventArgs> { export interface OutputOracle {
contract: Contract contract: Contract
filter: any filter: any
getTotalElements: () => Promise<BigNumber> getTotalElements: () => Promise<BigNumber>
getEventIndex: (args: TSubmissionEventArgs) => BigNumber getEventIndex: (args: any) => BigNumber
} }
/** /**
...@@ -54,8 +54,8 @@ const getCache = ( ...@@ -54,8 +54,8 @@ const getCache = (
* @param contract Contract to update cache for. * @param contract Contract to update cache for.
* @param filter Event filter to use. * @param filter Event filter to use.
*/ */
export const updateOracleCache = async <TSubmissionEventArgs>( export const updateOracleCache = async (
oracle: OutputOracle<TSubmissionEventArgs>, oracle: OutputOracle,
logger?: Logger logger?: Logger
): Promise<void> => { ): Promise<void> => {
const cache = getCache(oracle.contract.address) const cache = getCache(oracle.contract.address)
...@@ -86,7 +86,7 @@ export const updateOracleCache = async <TSubmissionEventArgs>( ...@@ -86,7 +86,7 @@ export const updateOracleCache = async <TSubmissionEventArgs>(
// Throw the events into the cache. // Throw the events into the cache.
for (const event of events) { for (const event of events) {
cache.eventCache[ cache.eventCache[
oracle.getEventIndex(event.args as TSubmissionEventArgs).toNumber() oracle.getEventIndex(event.args).toNumber()
] = { ] = {
blockNumber: event.blockNumber, blockNumber: event.blockNumber,
transactionHash: event.transactionHash, transactionHash: event.transactionHash,
...@@ -135,8 +135,8 @@ export const updateOracleCache = async <TSubmissionEventArgs>( ...@@ -135,8 +135,8 @@ export const updateOracleCache = async <TSubmissionEventArgs>(
* @param index State batch index to search for. * @param index State batch index to search for.
* @returns Event corresponding to the batch. * @returns Event corresponding to the batch.
*/ */
export const findEventForStateBatch = async <TSubmissionEventArgs>( export const findEventForStateBatch = async (
oracle: OutputOracle<TSubmissionEventArgs>, oracle: OutputOracle,
index: number, index: number,
logger?: Logger logger?: Logger
): Promise<PartialEvent> => { ): Promise<PartialEvent> => {
...@@ -166,8 +166,8 @@ export const findEventForStateBatch = async <TSubmissionEventArgs>( ...@@ -166,8 +166,8 @@ export const findEventForStateBatch = async <TSubmissionEventArgs>(
* @param oracle Output oracle contract. * @param oracle Output oracle contract.
* @returns Starting state root batch index. * @returns Starting state root batch index.
*/ */
export const findFirstUnfinalizedStateBatchIndex = async <TSubmissionEventArgs>( export const findFirstUnfinalizedStateBatchIndex = async (
oracle: OutputOracle<TSubmissionEventArgs>, oracle: OutputOracle,
fpw: number, fpw: number,
logger?: Logger logger?: Logger
): Promise<number> => { ): Promise<number> => {
......
This diff is collapsed.
...@@ -29,7 +29,7 @@ describe('helpers', () => { ...@@ -29,7 +29,7 @@ describe('helpers', () => {
let AddressManager: Contract let AddressManager: Contract
let ChainStorageContainer: Contract let ChainStorageContainer: Contract
let StateCommitmentChain: Contract let StateCommitmentChain: Contract
let oracle: OutputOracle<any> let oracle: OutputOracle
beforeEach(async () => { beforeEach(async () => {
// Set up fakes // Set up fakes
FakeBondManager = await smock.fake(getContractInterface('BondManager')) FakeBondManager = await smock.fake(getContractInterface('BondManager'))
......
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