Skip to content
This repository was archived by the owner on Dec 5, 2021. It is now read-only.
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Imports: External */
import { BaseService, Metrics } from '@eth-optimism/common-ts'
import { JsonRpcProvider } from '@ethersproject/providers'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { BigNumber } from 'ethers'
import { LevelUp } from 'levelup'
import axios from 'axios'
Expand Down Expand Up @@ -72,7 +72,7 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {

private state: {
db: TransportDB
l2RpcProvider: JsonRpcProvider
l2RpcProvider: StaticJsonRpcProvider
} = {} as any

protected async _init(): Promise<void> {
Expand All @@ -88,7 +88,7 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {

this.state.l2RpcProvider =
typeof this.options.l2RpcProvider === 'string'
? new JsonRpcProvider(this.options.l2RpcProvider)
? new StaticJsonRpcProvider(this.options.l2RpcProvider)
: this.options.l2RpcProvider
}

Expand Down
10 changes: 5 additions & 5 deletions packages/data-transport-layer/src/services/server/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import promBundle from 'express-prom-bundle'
import { Gauge } from 'prom-client'
import cors from 'cors'
import { BigNumber } from 'ethers'
import { JsonRpcProvider } from '@ethersproject/providers'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { LevelUp } from 'levelup'
import * as Sentry from '@sentry/node'
import * as Tracing from '@sentry/tracing'
Expand Down Expand Up @@ -80,8 +80,8 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
app: express.Express
server: any
db: TransportDB
l1RpcProvider: JsonRpcProvider
l2RpcProvider: JsonRpcProvider
l1RpcProvider: StaticJsonRpcProvider
l2RpcProvider: StaticJsonRpcProvider
baseBlock: number
baseTime: number
} = {} as any
Expand All @@ -94,12 +94,12 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
this.state.db = new TransportDB(this.options.db)
this.state.l1RpcProvider =
typeof this.options.l1RpcProvider === 'string'
? new JsonRpcProvider(this.options.l1RpcProvider)
? new StaticJsonRpcProvider(this.options.l1RpcProvider)
: this.options.l1RpcProvider

this.state.l2RpcProvider =
typeof this.options.l2RpcProvider === 'string'
? new JsonRpcProvider(this.options.l2RpcProvider)
? new StaticJsonRpcProvider(this.options.l2RpcProvider)
: this.options.l2RpcProvider

this.state.baseBlock = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonRpcProvider } from '@ethersproject/providers'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { BigNumber, Event } from 'ethers'

import { TransportDB } from '../db/transport-db'
Expand All @@ -15,7 +15,7 @@ export type TypedEthersEvent<T> = Event & {

export type GetExtraDataHandler<TEventArgs, TExtraData> = (
event?: TypedEthersEvent<TEventArgs>,
l1RpcProvider?: JsonRpcProvider
l1RpcProvider?: StaticJsonRpcProvider
) => Promise<TExtraData>

export type ParseEventHandler<TEventArgs, TExtraData, TParsedEvent> = (
Expand Down
4 changes: 2 additions & 2 deletions packages/message-relayer/src/exec/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ const main = async () => {
throw new Error('Must pass L2_NODE_WEB3_URL')
}

const l2Provider = new providers.JsonRpcProvider(L2_NODE_WEB3_URL)
const l1Provider = new providers.JsonRpcProvider(L1_NODE_WEB3_URL)
const l2Provider = new providers.StaticJsonRpcProvider(L2_NODE_WEB3_URL)
const l1Provider = new providers.StaticJsonRpcProvider(L1_NODE_WEB3_URL)

let wallet: Wallet
if (RELAYER_PRIVATE_KEY) {
Expand Down
2 changes: 1 addition & 1 deletion packages/message-relayer/src/exec/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const main = async () => {
throw new Error(`must provide l2 transaction hash`)
}

const l1RpcProvider = new ethers.providers.JsonRpcProvider(l1RpcProviderUrl)
const l1RpcProvider = new ethers.providers.StaticJsonRpcProvider(l1RpcProviderUrl)
const l1Wallet = new ethers.Wallet(l1PrivateKey, l1RpcProvider)
const l1WalletBalance = await l1Wallet.getBalance()
console.log(`relayer address: ${l1Wallet.address}`)
Expand Down
16 changes: 8 additions & 8 deletions packages/message-relayer/src/relay-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ interface StateTrieProof {
* @returns Messages associated with the transaction.
*/
export const getMessagesByTransactionHash = async (
l2RpcProvider: ethers.providers.JsonRpcProvider,
l2RpcProvider: ethers.providers.StaticJsonRpcProvider,
l2CrossDomainMessengerAddress: string,
l2TransactionHash: string
): Promise<CrossDomainMessage[]> => {
Expand Down Expand Up @@ -131,7 +131,7 @@ const encodeCrossDomainMessage = (message: CrossDomainMessage): string => {
* @returns StateBatchAppended event for the given transaction or null if no such event exists.
*/
export const getStateBatchAppendedEventByTransactionIndex = async (
l1RpcProvider: ethers.providers.JsonRpcProvider,
l1RpcProvider: ethers.providers.StaticJsonRpcProvider,
l1StateCommitmentChainAddress: string,
l2TransactionIndex: number
): Promise<ethers.Event | null> => {
Expand Down Expand Up @@ -213,7 +213,7 @@ export const getStateBatchAppendedEventByTransactionIndex = async (
* batch exists.
*/
export const getStateRootBatchByTransactionIndex = async (
l1RpcProvider: ethers.providers.JsonRpcProvider,
l1RpcProvider: ethers.providers.StaticJsonRpcProvider,
l1StateCommitmentChainAddress: string,
l2TransactionIndex: number
): Promise<StateRootBatch | null> => {
Expand Down Expand Up @@ -295,7 +295,7 @@ const getMerkleTreeProof = (leaves: string[], index: number): string[] => {
* @returns Account proof and storage proof.
*/
const getStateTrieProof = async (
l2RpcProvider: ethers.providers.JsonRpcProvider,
l2RpcProvider: ethers.providers.StaticJsonRpcProvider,
blockNumber: number,
address: string,
slot: string
Expand Down Expand Up @@ -324,17 +324,17 @@ const getStateTrieProof = async (
* @returns An array of messages sent in the transaction and a proof of inclusion for each.
*/
export const getMessagesAndProofsForL2Transaction = async (
l1RpcProvider: ethers.providers.JsonRpcProvider | string,
l2RpcProvider: ethers.providers.JsonRpcProvider | string,
l1RpcProvider: ethers.providers.StaticJsonRpcProvider | string,
l2RpcProvider: ethers.providers.StaticJsonRpcProvider | string,
l1StateCommitmentChainAddress: string,
l2CrossDomainMessengerAddress: string,
l2TransactionHash: string
): Promise<CrossDomainMessagePair[]> => {
if (typeof l1RpcProvider === 'string') {
l1RpcProvider = new ethers.providers.JsonRpcProvider(l1RpcProvider)
l1RpcProvider = new ethers.providers.StaticJsonRpcProvider(l1RpcProvider)
}
if (typeof l2RpcProvider === 'string') {
l2RpcProvider = new ethers.providers.JsonRpcProvider(l2RpcProvider)
l2RpcProvider = new ethers.providers.StaticJsonRpcProvider(l2RpcProvider)
}

const l2Transaction = await l2RpcProvider.getTransaction(l2TransactionHash)
Expand Down
4 changes: 2 additions & 2 deletions packages/message-relayer/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { StateRootBatchHeader, SentMessage, SentMessageProof, BatchMessage } fro

interface MessageRelayerOptions {
// Providers for interacting with L1 and L2.
l1RpcProvider: providers.JsonRpcProvider
l2RpcProvider: providers.JsonRpcProvider
l1RpcProvider: providers.StaticJsonRpcProvider
l2RpcProvider: providers.StaticJsonRpcProvider

// Address of the AddressManager contract, used to resolve the various addresses we'll need
// within this service.
Expand Down
4 changes: 2 additions & 2 deletions packages/omgx/gas-price-oracle/src/exec/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ const main = async () => {
throw new Error('Must pass FAST_RELAYER_ADDRESS or FAST_RELAYER_PRIVATE_KEY')
}

const l1Provider = new providers.JsonRpcProvider(L1_NODE_WEB3_URL)
const l2Provider = new providers.JsonRpcProvider(L2_NODE_WEB3_URL)
const l1Provider = new providers.StaticJsonRpcProvider(L1_NODE_WEB3_URL)
const l2Provider = new providers.StaticJsonRpcProvider(L2_NODE_WEB3_URL)

const gasPriceOracleOwnerWallet = new Wallet(GAS_PRICE_ORACLE_OWNER_PRIVATE_KEY, l2Provider)

Expand Down
4 changes: 2 additions & 2 deletions packages/omgx/gas-price-oracle/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { loadContract } from '@eth-optimism/contracts'

interface GasPriceOracleOptions {
// Providers for interacting with L1 and L2.
l1RpcProvider: providers.JsonRpcProvider
l2RpcProvider: providers.JsonRpcProvider
l1RpcProvider: providers.StaticJsonRpcProvider
l2RpcProvider: providers.StaticJsonRpcProvider

// Address of the gasPrice contract
gasPriceOracleAddress: string,
Expand Down
4 changes: 2 additions & 2 deletions packages/omgx/message-relayer-fast/src/exec/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ const main = async () => {
throw new Error('Must pass L2_NODE_WEB3_URL')
}

const l2Provider = new providers.JsonRpcProvider(L2_NODE_WEB3_URL)
const l1Provider = new providers.JsonRpcProvider(L1_NODE_WEB3_URL)
const l2Provider = new providers.StaticJsonRpcProvider(L2_NODE_WEB3_URL)
const l1Provider = new providers.StaticJsonRpcProvider(L1_NODE_WEB3_URL)

let wallet: Wallet
if (FAST_RELAYER_PRIVATE_KEY) {
Expand Down
4 changes: 2 additions & 2 deletions packages/omgx/message-relayer-fast/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { StateRootBatchHeader, SentMessage, SentMessageProof, BatchMessage } fro

interface MessageRelayerOptions {
// Providers for interacting with L1 and L2.
l1RpcProvider: providers.JsonRpcProvider
l2RpcProvider: providers.JsonRpcProvider
l1RpcProvider: providers.StaticJsonRpcProvider
l2RpcProvider: providers.StaticJsonRpcProvider

// Address of the AddressManager contract, used to resolve the various addresses we'll need
// within this service.
Expand Down
9 changes: 3 additions & 6 deletions packages/omgx/wallet-frontend/src/services/networkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,13 @@ class NetworkService {
return 'wrongnetwork'
}

//dispatch(setLayer(this.L1orL2))
//const dispatch = useDispatch();

// defines the set of possible networks
const nw = getAllNetworks()

this.L1Provider = new ethers.providers.JsonRpcProvider(
this.L1Provider = new ethers.providers.StaticJsonRpcProvider(
nw[masterSystemConfig]['L1']['rpcUrl']
)
this.L2Provider = new ethers.providers.JsonRpcProvider(
this.L2Provider = new ethers.providers.StaticJsonRpcProvider(
nw[masterSystemConfig]['L2']['rpcUrl']
)

Expand Down
4 changes: 2 additions & 2 deletions packages/replica-healthcheck/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export const readConfig = (): HealthcheckServerOptions => {
}

export const binarySearchForMismatch = async (
sequencerProvider: providers.JsonRpcProvider,
replicaProvider: providers.JsonRpcProvider,
sequencerProvider: providers.StaticJsonRpcProvider,
replicaProvider: providers.StaticJsonRpcProvider,
latest: number,
logger: Logger
): Promise<number> => {
Expand Down