Commit 38c7e5a2 authored by Mark Tyneway's avatar Mark Tyneway

Merge branch 'develop' into regenesis/0.4.0

parents a0d9e565 14243701
---
'@eth-optimism/l2geth': patch
---
Optimize main polling loops
---
'@eth-optimism/batch-submitter': patch
---
Fix typo in USE_HARDHAT config
l2geth/ @smartcontracts @tynes @karlfloersch # CODEOWNERS can be disruptive because it automatically requests review from individuals across the
packages/specs/l2geth/ @smartcontracts @tynes @karlfloersch # board. We still like to use this file to track who's working on what, but all lines are commented
packages/contracts/ @smartcontracts @ben-chain @maurelian @elenadimitrova # out so that GitHub won't trigger review requests.
packages/specs/protocol/ @smartcontracts @ben-chain @maurelian
ops/ @tynes @karlfloersch # l2geth/ @smartcontracts @tynes @karlfloersch
packages/hardhat-ovm/ @smartcontracts # packages/specs/l2geth/ @smartcontracts @tynes @karlfloersch
packages/smock/ @smartcontracts @maurelian # packages/contracts/ @smartcontracts @ben-chain @maurelian @elenadimitrova
packages/core-utils/ @smartcontracts @annieke @ben-chain # packages/specs/protocol/ @smartcontracts @ben-chain @maurelian
packages/common-ts/ @annieke # ops/ @tynes @karlfloersch
packages/core-utils/src/watcher.ts @K-Ho # packages/hardhat-ovm/ @smartcontracts
packages/message-relayer/ @K-Ho # packages/smock/ @smartcontracts @maurelian
packages/batch-submitter/ @annieke @karlfloersch # packages/core-utils/ @smartcontracts @annieke @ben-chain
packages/data-transport-layer/ @annieke # packages/common-ts/ @annieke
integration-tests/ @tynes # packages/core-utils/src/watcher.ts @K-Ho
# packages/message-relayer/ @K-Ho
# packages/batch-submitter/ @annieke @karlfloersch
# packages/data-transport-layer/ @annieke
# integration-tests/ @tynes
...@@ -74,11 +74,11 @@ jobs: ...@@ -74,11 +74,11 @@ jobs:
- name: Docker Image Name - name: Docker Image Name
id: docker_image_name id: docker_image_name
run: | run: |
if [ $CUSTOM_IMAGE_NAME == '' ] if [ -z "${CUSTOM_IMAGE_NAME}" ]
then then
echo "::set-output name=canary-docker-tag::${GITHUB_SHA::8}" echo "::set-output name=canary-docker-tag::${GITHUB_SHA::8}"
else else
echo "::set-output name=canary-docker-tag::prerelease-$CUSTOM_IMAGE_NAME" echo "::set-output name=canary-docker-tag::prerelease-${CUSTOM_IMAGE_NAME}"
fi fi
env: env:
CUSTOM_IMAGE_NAME: ${{ github.event.inputs.customImageName }} CUSTOM_IMAGE_NAME: ${{ github.event.inputs.customImageName }}
...@@ -112,7 +112,7 @@ jobs: ...@@ -112,7 +112,7 @@ jobs:
context: . context: .
file: ./ops/docker/Dockerfile.geth file: ./ops/docker/Dockerfile.geth
push: true push: true
tags: ethereumoptimism/l2geth:${{ needs.canary-publish.outputs.l2geth }} tags: ethereumoptimism/l2geth:${{ steps.docker_image_name.outputs.canary-docker-tag }}
# pushes the base builder image to dockerhub # pushes the base builder image to dockerhub
builder: builder:
......
# Changelog # Changelog
## 0.3.9
### Patch Changes
- f409ce75: Fixes an off-by-one error that would sometimes break replica syncing when stopping and restarting geth.
- d9fd67d2: Correctly log 'end of OVM execution' message.
## 0.3.8
### Patch Changes
- 989a3027: Optimize main polling loops
- cc6c7f07: Bump golang version to 1.15
## 0.3.7 ## 0.3.7
### Patch Changes ### Patch Changes
......
...@@ -466,10 +466,9 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas ...@@ -466,10 +466,9 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
ret = []byte{} ret = []byte{}
} }
} }
} if evm.Context.EthCallSender == nil {
log.Debug("Reached the end of an OVM execution", "ID", evm.Id, "Return Data", hexutil.Encode(ret), "Error", err)
if evm.Context.EthCallSender == nil { }
log.Debug("Reached the end of an OVM execution", "ID", evm.Id, "Return Data", hexutil.Encode(ret), "Error", err)
} }
} }
......
module github.com/ethereum/go-ethereum module github.com/ethereum/go-ethereum
go 1.13 go 1.15
require ( require (
github.com/Azure/azure-pipeline-go v0.2.2 // indirect github.com/Azure/azure-pipeline-go v0.2.2 // indirect
......
...@@ -196,7 +196,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus ...@@ -196,7 +196,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth), unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth),
pendingTasks: make(map[common.Hash]*task), pendingTasks: make(map[common.Hash]*task),
txsCh: make(chan core.NewTxsEvent, txChanSize), txsCh: make(chan core.NewTxsEvent, txChanSize),
rollupCh: make(chan core.NewTxsEvent, txChanSize), rollupCh: make(chan core.NewTxsEvent, 1),
chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize), chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize),
chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize), chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize),
newWorkCh: make(chan *newWorkReq), newWorkCh: make(chan *newWorkReq),
......
{ {
"name": "@eth-optimism/l2geth", "name": "@eth-optimism/l2geth",
"version": "0.3.7", "version": "0.3.9",
"private": true, "private": true,
"devDependencies": {} "devDependencies": {}
} }
...@@ -240,21 +240,22 @@ func (s *SyncService) initializeLatestL1(ctcDeployHeight *big.Int) error { ...@@ -240,21 +240,22 @@ func (s *SyncService) initializeLatestL1(ctcDeployHeight *big.Int) error {
s.SetLatestL1Timestamp(context.Timestamp) s.SetLatestL1Timestamp(context.Timestamp)
s.SetLatestL1BlockNumber(context.BlockNumber) s.SetLatestL1BlockNumber(context.BlockNumber)
} else { } else {
// Prevent underflows
if *index != 0 {
*index = *index - 1
}
log.Info("Found latest index", "index", *index) log.Info("Found latest index", "index", *index)
block := s.bc.GetBlockByNumber(*index) block := s.bc.GetBlockByNumber(*index + 1)
if block == nil { if block == nil {
block = s.bc.CurrentBlock() block = s.bc.CurrentBlock()
idx := block.Number().Uint64() blockNum := block.Number().Uint64()
if idx > *index { if blockNum > *index {
// This is recoverable with a reorg but should never happen // This is recoverable with a reorg but should never happen
return fmt.Errorf("Current block height greater than index") return fmt.Errorf("Current block height greater than index")
} }
s.SetLatestIndex(&idx) var idx *uint64
log.Info("Block not found, resetting index", "new", idx, "old", *index) if blockNum > 0 {
num := blockNum - 1
idx = &num
}
s.SetLatestIndex(idx)
log.Info("Block not found, resetting index", "new", stringify(idx), "old", *index)
} }
txs := block.Transactions() txs := block.Transactions()
if len(txs) != 1 { if len(txs) != 1 {
......
# Build Geth in a stock Go builder container # Build Geth in a stock Go builder container
FROM golang:1.14-alpine as builder FROM golang:1.15-alpine as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git RUN apk add --no-cache make gcc musl-dev linux-headers git
......
# Changelog # Changelog
## 0.3.5
### Patch Changes
- 7cce55a9: Add status to generic error log to disambiguate errors
## 0.3.4
### Patch Changes
- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry
- cc742715: Fix typo in USE_HARDHAT config
- 98b7839f: Change monotonicity band-aid code to log warnings not errors
- c520100d: Fix a bug in fixMonotonicity auto healer
- 85362d44: Log additional data in monotonicity violation
- Updated dependencies [baa3b761]
- @eth-optimism/common-ts@0.1.3
## 0.3.3 ## 0.3.3
### Patch Changes ### Patch Changes
......
{ {
"name": "@eth-optimism/batch-submitter", "name": "@eth-optimism/batch-submitter",
"version": "0.3.3", "version": "0.3.5",
"private": true, "private": true,
"description": "[Optimism] Batch submission for sequencer & aggregators", "description": "[Optimism] Batch submission for sequencer & aggregators",
"main": "dist/index", "main": "dist/index",
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
"url": "https://github.com/ethereum-optimism/optimism-monorepo.git" "url": "https://github.com/ethereum-optimism/optimism-monorepo.git"
}, },
"dependencies": { "dependencies": {
"@eth-optimism/common-ts": "^0.1.2", "@eth-optimism/common-ts": "^0.1.3",
"@eth-optimism/contracts": "^0.3.5", "@eth-optimism/contracts": "^0.3.5",
"@eth-optimism/core-utils": "^0.4.5", "@eth-optimism/core-utils": "^0.4.5",
"@eth-optimism/ynatm": "^0.2.2", "@eth-optimism/ynatm": "^0.2.2",
"@ethersproject/abstract-provider": "^5.0.5", "@ethersproject/abstract-provider": "^5.0.5",
"@ethersproject/providers": "^5.0.14", "@ethersproject/providers": "^5.0.14",
"@sentry/node": "^6.2.5",
"bcfg": "^0.1.6", "bcfg": "^0.1.6",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
......
...@@ -232,11 +232,30 @@ export abstract class BatchSubmitter { ...@@ -232,11 +232,30 @@ export abstract class BatchSubmitter {
gasRetryIncrement: this.gasRetryIncrement, gasRetryIncrement: this.gasRetryIncrement,
} }
const receipt = await BatchSubmitter.getReceiptWithResubmission( let receipt: TransactionReceipt
txFunc, try {
resubmissionConfig, receipt = await BatchSubmitter.getReceiptWithResubmission(
this.logger txFunc,
) resubmissionConfig,
this.logger
)
} catch (err) {
if (err.reason) {
this.logger.error(`Transaction invalid: ${err.reason}, aborting`, {
message: err.toString(),
stack: err.stack,
code: err.code,
})
return
}
this.logger.error('Encountered error at submission, aborting', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
return
}
this.logger.info('Received transaction receipt', { receipt }) this.logger.info('Received transaction receipt', { receipt })
this.logger.info(successMessage) this.logger.info(successMessage)
......
...@@ -301,8 +301,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -301,8 +301,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
// Fix our batches if we are configured to. TODO: Remove this. // Fix our batches if we are configured to. TODO: Remove this.
batch = await this._fixBatch(batch) batch = await this._fixBatch(batch)
if (!(await this._validateBatch(batch))) { if (!(await this._validateBatch(batch))) {
this.logger.error('Batch is malformed! Cannot submit next batch!') return
throw new Error('Batch is malformed! Cannot submit next batch!')
} }
let sequencerBatchParams = await this._getSequencerBatchParams( let sequencerBatchParams = await this._getSequencerBatchParams(
startBlock, startBlock,
...@@ -356,13 +355,17 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -356,13 +355,17 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
// Verify all of the batch elements are monotonic // Verify all of the batch elements are monotonic
let lastTimestamp: number let lastTimestamp: number
let lastBlockNumber: number let lastBlockNumber: number
for (const ele of batch) { for (const [idx, ele] of batch.entries()) {
if (ele.timestamp < lastTimestamp) { if (ele.timestamp < lastTimestamp) {
this.logger.error('Timestamp monotonicity violated! Element', { ele }) this.logger.error('Timestamp monotonicity violated! Element', {
idx,
ele,
})
return false return false
} }
if (ele.blockNumber < lastBlockNumber) { if (ele.blockNumber < lastBlockNumber) {
this.logger.error('Block Number monotonicity violated! Element', { this.logger.error('Block Number monotonicity violated! Element', {
idx,
ele, ele,
}) })
return false return false
...@@ -469,7 +472,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -469,7 +472,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
] = await this.chainContract.getQueueElement(nextQueueIndex) ] = await this.chainContract.getQueueElement(nextQueueIndex)
if (timestamp < ele.timestamp || blockNumber < ele.blockNumber) { if (timestamp < ele.timestamp || blockNumber < ele.blockNumber) {
this.logger.error('Fixing skipped deposit', { this.logger.warn('Fixing skipped deposit', {
badTimestamp: ele.timestamp, badTimestamp: ele.timestamp,
skippedQueueTimestamp: timestamp, skippedQueueTimestamp: timestamp,
badBlockNumber: ele.blockNumber, badBlockNumber: ele.blockNumber,
...@@ -563,38 +566,31 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -563,38 +566,31 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
ele.timestamp < earliestTimestamp || ele.timestamp < earliestTimestamp ||
ele.blockNumber < earliestBlockNumber ele.blockNumber < earliestBlockNumber
) { ) {
this.logger.error('Fixing timestamp/blockNumber too small', { this.logger.warn('Fixing timestamp/blockNumber too small', {
oldTimestamp: ele.timestamp, oldTimestamp: ele.timestamp,
newTimestamp: earliestTimestamp, newTimestamp: earliestTimestamp,
oldBlockNumber: ele.blockNumber, oldBlockNumber: ele.blockNumber,
newBlockNumber: earliestBlockNumber, newBlockNumber: earliestBlockNumber,
}) })
fixedBatch.push({ ele.timestamp = earliestTimestamp
...ele, ele.blockNumber = earliestBlockNumber
timestamp: earliestTimestamp,
blockNumber: earliestBlockNumber,
})
continue
} }
// Fix the element if its timestammp/blockNumber is too large // Fix the element if its timestammp/blockNumber is too large
if ( if (
ele.timestamp > latestTimestamp || ele.timestamp > latestTimestamp ||
ele.blockNumber > latestBlockNumber ele.blockNumber > latestBlockNumber
) { ) {
this.logger.error('Fixing timestamp/blockNumber too large.', { this.logger.warn('Fixing timestamp/blockNumber too large.', {
oldTimestamp: ele.timestamp, oldTimestamp: ele.timestamp,
newTimestamp: latestTimestamp, newTimestamp: latestTimestamp,
oldBlockNumber: ele.blockNumber, oldBlockNumber: ele.blockNumber,
newBlockNumber: latestBlockNumber, newBlockNumber: latestBlockNumber,
}) })
fixedBatch.push({ ele.timestamp = latestTimestamp
...ele, ele.blockNumber = latestBlockNumber
timestamp: latestTimestamp,
blockNumber: latestBlockNumber,
})
continue
} }
// No fixes needed! earliestTimestamp = ele.timestamp
earliestBlockNumber = ele.blockNumber
fixedBatch.push(ele) fixedBatch.push(ele)
} }
return fixedBatch return fixedBatch
......
/* External Imports */ /* External Imports */
import { injectL2Context, Bcfg } from '@eth-optimism/core-utils' import { injectL2Context, Bcfg } from '@eth-optimism/core-utils'
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 { exit } from 'process'
import { Signer, Wallet } from 'ethers' import { Signer, Wallet } from 'ethers'
...@@ -101,15 +102,17 @@ export const run = async () => { ...@@ -101,15 +102,17 @@ export const run = async () => {
let logger let logger
if (config.bool('use-sentry', env.USE_SENTRY === 'true')) { if (config.bool('use-sentry', env.USE_SENTRY === 'true')) {
const sentryOptions = {
release,
dsn: sentryDsn,
tracesSampleRate: sentryTraceRate,
environment: network,
}
Sentry.init(sentryOptions)
// Initialize Sentry for Batch Submitter deployed to a network // Initialize Sentry for Batch Submitter deployed to a network
logger = new Logger({ logger = new Logger({
name, name,
sentryOptions: { sentryOptions,
release,
dsn: sentryDsn,
tracesSampleRate: sentryTraceRate,
environment: network,
},
}) })
} else { } else {
// Skip initializing Sentry // Skip initializing Sentry
...@@ -438,11 +441,29 @@ export const run = async () => { ...@@ -438,11 +441,29 @@ export const run = async () => {
try { try {
await func() await func()
} catch (err) { } catch (err) {
logger.error('Error submitting batch', { switch (err.code) {
message: err.toString(), case 'SERVER_ERROR':
stack: err.stack, logger.error(`Encountered server error with status ${err.status}`, {
code: err.code, message: err.toString(),
}) stack: err.stack,
code: err.code,
})
break
case 'NETWORK_ERROR':
logger.error('Could not detect network', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
break
default:
logger.error('Unhandled exception during batch submission', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
break
}
logger.info('Retrying...') logger.info('Retrying...')
} }
// Sleep // Sleep
......
# @eth-optimism/common-ts # @eth-optimism/common-ts
## 0.1.3
### Patch Changes
- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry
## 0.1.2 ## 0.1.2
### Patch Changes ### Patch Changes
......
{ {
"name": "@eth-optimism/common-ts", "name": "@eth-optimism/common-ts",
"version": "0.1.2", "version": "0.1.3",
"main": "dist/index", "main": "dist/index",
"files": [ "files": [
"dist/*" "dist/*"
......
...@@ -9,6 +9,11 @@ type OptionSettings<TOptions> = { ...@@ -9,6 +9,11 @@ type OptionSettings<TOptions> = {
} }
} }
type BaseServiceOptions<T> = T & {
logger?: Logger
metrics?: Metrics
}
/** /**
* Base for other "Service" objects. Handles your standard initialization process, can dynamically * Base for other "Service" objects. Handles your standard initialization process, can dynamically
* start and stop. * start and stop.
...@@ -21,11 +26,18 @@ export class BaseService<T> { ...@@ -21,11 +26,18 @@ export class BaseService<T> {
protected initialized: boolean = false protected initialized: boolean = false
protected running: boolean = false protected running: boolean = false
constructor(name: string, options: T, optionSettings: OptionSettings<T>) { constructor(
name: string,
options: BaseServiceOptions<T>,
optionSettings: OptionSettings<T>
) {
validateOptions(options, optionSettings) validateOptions(options, optionSettings)
this.name = name this.name = name
this.options = mergeDefaultOptions(options, optionSettings) this.options = mergeDefaultOptions(options, optionSettings)
this.logger = new Logger({ name }) this.logger = options.logger || new Logger({ name })
if (options.metrics) {
this.metrics = options.metrics
}
} }
/** /**
......
# data transport layer # data transport layer
## 0.3.6
### Patch Changes
- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry
- Updated dependencies [baa3b761]
- @eth-optimism/common-ts@0.1.3
## 0.3.5 ## 0.3.5
### Patch Changes ### Patch Changes
......
{ {
"name": "@eth-optimism/data-transport-layer", "name": "@eth-optimism/data-transport-layer",
"version": "0.3.5", "version": "0.3.6",
"private": true, "private": true,
"main": "dist/index", "main": "dist/index",
"files": [ "files": [
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"build": "tsc -p tsconfig.build.json" "build": "tsc -p tsconfig.build.json"
}, },
"dependencies": { "dependencies": {
"@eth-optimism/common-ts": "^0.1.2", "@eth-optimism/common-ts": "^0.1.3",
"@eth-optimism/contracts": "^0.3.5", "@eth-optimism/contracts": "^0.3.5",
"@eth-optimism/core-utils": "^0.4.5", "@eth-optimism/core-utils": "^0.4.5",
"@ethersproject/providers": "^5.0.21", "@ethersproject/providers": "^5.0.21",
......
/* Imports: External */ /* Imports: External */
import { BaseService } from '@eth-optimism/common-ts' import { BaseService, Logger } from '@eth-optimism/common-ts'
import { LevelUp } from 'levelup' import { LevelUp } from 'levelup'
import level from 'level' import level from 'level'
......
/* Imports: External */ /* Imports: External */
import { BaseService, 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 cors from 'cors' import cors from 'cors'
...@@ -125,10 +125,17 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> { ...@@ -125,10 +125,17 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
* Initialize Sentry and related middleware * Initialize Sentry and related middleware
*/ */
private _initSentry() { private _initSentry() {
Sentry.init({ const sentryOptions = {
dsn: this.options.sentryDsn, dsn: this.options.sentryDsn,
release: this.options.release, release: this.options.release,
environment: this.options.ethNetworkName, environment: this.options.ethNetworkName,
}
this.logger = new Logger({
name: this.name,
sentryOptions,
})
Sentry.init({
...sentryOptions,
integrations: [ integrations: [
new Sentry.Integrations.Http({ tracing: true }), new Sentry.Integrations.Http({ tracing: true }),
new Tracing.Integrations.Express({ new Tracing.Integrations.Express({
......
# @eth-optimism/message-relayer # @eth-optimism/message-relayer
## 0.1.5
### Patch Changes
- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry
- Updated dependencies [baa3b761]
- @eth-optimism/common-ts@0.1.3
## 0.1.4 ## 0.1.4
### Patch Changes ### Patch Changes
......
{ {
"name": "@eth-optimism/message-relayer", "name": "@eth-optimism/message-relayer",
"version": "0.1.4", "version": "0.1.5",
"description": "[Optimism] Cross Domain Message Relayer service", "description": "[Optimism] Cross Domain Message Relayer service",
"main": "dist/index", "main": "dist/index",
"types": "dist/index", "types": "dist/index",
...@@ -29,9 +29,10 @@ ...@@ -29,9 +29,10 @@
"url": "https://github.com/ethereum-optimism/optimism.git" "url": "https://github.com/ethereum-optimism/optimism.git"
}, },
"dependencies": { "dependencies": {
"@eth-optimism/common-ts": "^0.1.2", "@eth-optimism/common-ts": "^0.1.3",
"@eth-optimism/contracts": "^0.3.5", "@eth-optimism/contracts": "^0.3.5",
"@eth-optimism/core-utils": "^0.4.5", "@eth-optimism/core-utils": "^0.4.5",
"@sentry/node": "6.2.5",
"bcfg": "^0.1.6", "bcfg": "^0.1.6",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"ethers": "^5.1.0", "ethers": "^5.1.0",
......
import { Wallet, providers } from 'ethers' import { Wallet, providers } from 'ethers'
import { MessageRelayerService } from '../service' 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 * as Sentry from '@sentry/node'
import * as dotenv from 'dotenv' import * as dotenv from 'dotenv'
import Config from 'bcfg' import Config from 'bcfg'
...@@ -14,6 +16,27 @@ const main = async () => { ...@@ -14,6 +16,27 @@ const main = async () => {
}) })
const env = process.env const env = process.env
const SENTRY_DSN = config.str('sentry-dsn', env.SENTRY_DSN)
const USE_SENTRY = config.bool('use-sentry', env.USE_SENTRY === 'true')
const ETH_NETWORK_NAME = config.str('eth-network-name', env.ETH_NETWORK_NAME)
const loggerOptions: LoggerOptions = {
name: 'Message_Relayer',
}
if (USE_SENTRY) {
const sentryOptions = {
release: `message-relayer@${process.env.npm_package_version}`,
dsn: SENTRY_DSN,
environment: ETH_NETWORK_NAME,
}
loggerOptions.sentryOptions = sentryOptions
Sentry.init(sentryOptions)
}
const logger = new Logger(loggerOptions)
const L2_NODE_WEB3_URL = config.str('l2-node-web3-url', env.L2_NODE_WEB3_URL) const L2_NODE_WEB3_URL = config.str('l2-node-web3-url', env.L2_NODE_WEB3_URL)
const L1_NODE_WEB3_URL = config.str('l1-node-web3-url', env.L1_NODE_WEB3_URL) const L1_NODE_WEB3_URL = config.str('l1-node-web3-url', env.L1_NODE_WEB3_URL)
const ADDRESS_MANAGER_ADDRESS = config.str( const ADDRESS_MANAGER_ADDRESS = config.str(
...@@ -82,6 +105,7 @@ const main = async () => { ...@@ -82,6 +105,7 @@ const main = async () => {
l2BlockOffset: L2_BLOCK_OFFSET, l2BlockOffset: L2_BLOCK_OFFSET,
l1StartOffset: L1_START_OFFSET, l1StartOffset: L1_START_OFFSET,
getLogsInterval: GET_LOGS_INTERVAL, getLogsInterval: GET_LOGS_INTERVAL,
logger,
}) })
await service.start() await service.start()
......
...@@ -5,7 +5,7 @@ import { MerkleTree } from 'merkletreejs' ...@@ -5,7 +5,7 @@ import { MerkleTree } from 'merkletreejs'
/* Imports: Internal */ /* Imports: Internal */
import { fromHexString, sleep } from '@eth-optimism/core-utils' import { fromHexString, sleep } from '@eth-optimism/core-utils'
import { BaseService } from '@eth-optimism/common-ts' import { Logger, BaseService, Metrics } from '@eth-optimism/common-ts'
import { import {
loadContract, loadContract,
...@@ -44,6 +44,12 @@ interface MessageRelayerOptions { ...@@ -44,6 +44,12 @@ interface MessageRelayerOptions {
// Number of blocks within each getLogs query - max is 2000 // Number of blocks within each getLogs query - max is 2000
getLogsInterval?: number getLogsInterval?: number
// A custom logger to transport logs via; default STDOUT
logger?: Logger
// A custom metrics tracker to manage metrics; default undefined
metrics?: Metrics
} }
const optionSettings = { const optionSettings = {
......
...@@ -1964,15 +1964,15 @@ ...@@ -1964,15 +1964,15 @@
"@sentry/utils" "6.2.5" "@sentry/utils" "6.2.5"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/core@6.3.5": "@sentry/core@6.6.0":
version "6.3.5" version "6.6.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.3.5.tgz#6b73de736eb9d0040be94cdbb06a744cd6b9172e" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.6.0.tgz#51661d2dd5023d6cd07467422de1854282ced7e5"
integrity sha512-VR2ibDy33mryD0mT6d9fGhKjdNzS2FSwwZPe9GvmNOjkyjly/oV91BKVoYJneCqOeq8fyj2lvkJGKuupdJNDqg== integrity sha512-EjdeT6paAdxAZgfsVCB8wneahQF3nAUt9GxOJxaOBUv8BSc3HQ/svcTU3RU7k8YsP26PseEOIsedaxsEVZ+7og==
dependencies: dependencies:
"@sentry/hub" "6.3.5" "@sentry/hub" "6.6.0"
"@sentry/minimal" "6.3.5" "@sentry/minimal" "6.6.0"
"@sentry/types" "6.3.5" "@sentry/types" "6.6.0"
"@sentry/utils" "6.3.5" "@sentry/utils" "6.6.0"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/hub@5.30.0": "@sentry/hub@5.30.0":
...@@ -2002,13 +2002,13 @@ ...@@ -2002,13 +2002,13 @@
"@sentry/utils" "6.3.1" "@sentry/utils" "6.3.1"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/hub@6.3.5": "@sentry/hub@6.6.0":
version "6.3.5" version "6.6.0"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.3.5.tgz#c5bc6760f7e4e53e87149703b106804299060389" resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.6.0.tgz#1b9fa22ee104b7d6afd2dc4c40a1459fda259366"
integrity sha512-ZYFo7VYKwdPVjuV9BDFiYn+MpANn6eZMz5QDBfZ2dugIvIVbuOyOOLx8PSa3ZXJoVTZZ7s2wD2fi/ZxKjNjZOQ== integrity sha512-1Yw0kbxcvO7njZUDGvCKB6DxU5jQio7Be3Kx5qxwcx8ojpT9lo9p+IYZajgl6zQqkjjbVm/4SoYqU24ozu5vxw==
dependencies: dependencies:
"@sentry/types" "6.3.5" "@sentry/types" "6.6.0"
"@sentry/utils" "6.3.5" "@sentry/utils" "6.6.0"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/minimal@5.30.0": "@sentry/minimal@5.30.0":
...@@ -2038,13 +2038,28 @@ ...@@ -2038,13 +2038,28 @@
"@sentry/types" "6.3.1" "@sentry/types" "6.3.1"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/minimal@6.3.5": "@sentry/minimal@6.6.0":
version "6.3.5" version "6.6.0"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.3.5.tgz#ef4894771243d01d81e91819400d2ecdcb34b411" resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.6.0.tgz#48684734e3c380e5e63a9357d05f0c18bae84419"
integrity sha512-4RqIGAU0+8iI/1sw0GYPTr4SUA88/i2+JPjFJ+qloh5ANVaNwhFPRChw+Ys9xpre8LV9JZrEsEf8AvQr4fkNbA== integrity sha512-xVBlZIDxSvHvNdvD5KmjTf8Xgi78vLpT4xqJaDUkW7B+DqWMVJZe5aUdQmcp7X/zWxctBwyMKsdHO7oiHkpS+Q==
dependencies: dependencies:
"@sentry/hub" "6.3.5" "@sentry/hub" "6.6.0"
"@sentry/types" "6.3.5" "@sentry/types" "6.6.0"
tslib "^1.9.3"
"@sentry/node@6.2.5", "@sentry/node@^6.2.5":
version "6.2.5"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.2.5.tgz#6e6694c0c3ce6ca231710f40da0cac7fd5c645ef"
integrity sha512-/iM3khzGnUH713VFhZBAEYJhb/saEQSVz7Udogml+O7mFQ4rutnwJhgoGcB9YYrwMv2m7qOSszkdZbemDV6k2g==
dependencies:
"@sentry/core" "6.2.5"
"@sentry/hub" "6.2.5"
"@sentry/tracing" "6.2.5"
"@sentry/types" "6.2.5"
"@sentry/utils" "6.2.5"
cookie "^0.4.1"
https-proxy-agent "^5.0.0"
lru_map "^0.3.3"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/node@^5.18.1": "@sentry/node@^5.18.1":
...@@ -2062,31 +2077,16 @@ ...@@ -2062,31 +2077,16 @@
lru_map "^0.3.3" lru_map "^0.3.3"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/node@^6.2.5":
version "6.2.5"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.2.5.tgz#6e6694c0c3ce6ca231710f40da0cac7fd5c645ef"
integrity sha512-/iM3khzGnUH713VFhZBAEYJhb/saEQSVz7Udogml+O7mFQ4rutnwJhgoGcB9YYrwMv2m7qOSszkdZbemDV6k2g==
dependencies:
"@sentry/core" "6.2.5"
"@sentry/hub" "6.2.5"
"@sentry/tracing" "6.2.5"
"@sentry/types" "6.2.5"
"@sentry/utils" "6.2.5"
cookie "^0.4.1"
https-proxy-agent "^5.0.0"
lru_map "^0.3.3"
tslib "^1.9.3"
"@sentry/node@^6.3.1": "@sentry/node@^6.3.1":
version "6.3.5" version "6.6.0"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.3.5.tgz#d5cbf941d0a4caf7b8e644d71cc6b463eeda214e" resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.6.0.tgz#e535e1e679cf894752810529ffdee93cbfd078f0"
integrity sha512-scPB+DoAEPaqkYuyb8d/gVWbFmX5PhaYSNHybeHncaP/P4itLdq/AoAWGNxl0Hj4EQokfT4OZWxaaJi7SCYnaw== integrity sha512-heKie/AOanYq3mCsKR1igPn1sUIxBmGibBp79Xc0iSAgliPKnnLkqUjvAIKu6mcevL9UOUhpMDLzhilkaG+bAA==
dependencies: dependencies:
"@sentry/core" "6.3.5" "@sentry/core" "6.6.0"
"@sentry/hub" "6.3.5" "@sentry/hub" "6.6.0"
"@sentry/tracing" "6.3.5" "@sentry/tracing" "6.6.0"
"@sentry/types" "6.3.5" "@sentry/types" "6.6.0"
"@sentry/utils" "6.3.5" "@sentry/utils" "6.6.0"
cookie "^0.4.1" cookie "^0.4.1"
https-proxy-agent "^5.0.0" https-proxy-agent "^5.0.0"
lru_map "^0.3.3" lru_map "^0.3.3"
...@@ -2114,15 +2114,15 @@ ...@@ -2114,15 +2114,15 @@
"@sentry/utils" "6.2.5" "@sentry/utils" "6.2.5"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/tracing@6.3.5": "@sentry/tracing@6.6.0":
version "6.3.5" version "6.6.0"
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.3.5.tgz#f76c362159141f860081ec7df80aa9f85b545860" resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.6.0.tgz#ce62fcb951faa6447cf47889f91efe3617b9eed2"
integrity sha512-TNKAST1ge2g24BlTfVxNp4gP5t3drbi0OVCh8h8ah+J7UjHSfdiqhd9W2h5qv1GO61gGlpWeN/TyioyQmOxu0Q== integrity sha512-tjXrmAOFfVBfx+ZmgE5bkpDPs/euNj0xrUg8MowCWGfCRn01W679tTb+dyNeP6faxQTo2RcaD68xD8oLroJwwA==
dependencies: dependencies:
"@sentry/hub" "6.3.5" "@sentry/hub" "6.6.0"
"@sentry/minimal" "6.3.5" "@sentry/minimal" "6.6.0"
"@sentry/types" "6.3.5" "@sentry/types" "6.6.0"
"@sentry/utils" "6.3.5" "@sentry/utils" "6.6.0"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/tracing@^6.3.1": "@sentry/tracing@^6.3.1":
...@@ -2151,10 +2151,10 @@ ...@@ -2151,10 +2151,10 @@
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.3.1.tgz#af3b54728b29f633f38fbe51b8c10e3834fbc158" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.3.1.tgz#af3b54728b29f633f38fbe51b8c10e3834fbc158"
integrity sha512-BEBn8JX1yaooCAuonbaMci9z0RjwwMbQ3Eny/eyDdd+rjXprZCZaStZnCvSThbNBqAJ8YaUqY2YBMnEwJxarAw== integrity sha512-BEBn8JX1yaooCAuonbaMci9z0RjwwMbQ3Eny/eyDdd+rjXprZCZaStZnCvSThbNBqAJ8YaUqY2YBMnEwJxarAw==
"@sentry/types@6.3.5": "@sentry/types@6.6.0":
version "6.3.5" version "6.6.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.3.5.tgz#d5eca7e76c250882ab78c01a8df894a9a9ca537d" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.6.0.tgz#55cbca23859bad87411f0f32135a968e6e40a639"
integrity sha512-tY/3pkAmGYJ3F0BtwInsdt/uclNvF8aNG7XHsTPQNzk7BkNVWjCXx0sjxi6CILirl5nwNxYxVeTr2ZYAEZ/dSQ== integrity sha512-lZ1uFN0lSNftAohi0lciEoSL58Gk/Ib1lLKaj0FSOvB1PAUmvo5dPtLdd0qjtNdtoaM8zqhrAbwCTQ8XZCDRsg==
"@sentry/utils@5.30.0": "@sentry/utils@5.30.0":
version "5.30.0" version "5.30.0"
...@@ -2180,12 +2180,12 @@ ...@@ -2180,12 +2180,12 @@
"@sentry/types" "6.3.1" "@sentry/types" "6.3.1"
tslib "^1.9.3" tslib "^1.9.3"
"@sentry/utils@6.3.5": "@sentry/utils@6.6.0":
version "6.3.5" version "6.6.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.3.5.tgz#a4805448cb0314d3d119688162aa695598a10bbb" resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.6.0.tgz#b34d342d05eefc25b7ddd3f27f41c050f1e7e1ef"
integrity sha512-kHUcZ37QYlNzz7c9LVdApITXHaNmQK7+sw/If3M/qpff1fd5XoecA8laLfcYuz+Cw5mRhVmdhPcCRM3Xi1IGXg== integrity sha512-FK9yqz2x+ef50B54tueeJ6mfb7Pf3lN75omx/YQBDL5cicyOV4j4kJDqn8/VKYhcSuX+ZaCZ/8bvOf0lxe0aHg==
dependencies: dependencies:
"@sentry/types" "6.3.5" "@sentry/types" "6.6.0"
tslib "^1.9.3" tslib "^1.9.3"
"@sindresorhus/is@^0.14.0": "@sindresorhus/is@^0.14.0":
......
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