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
5 changes: 5 additions & 0 deletions .changeset/clever-dolls-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/data-transport-layer': patch
---

Add Sentry and Metrics switches and environment tag to DTL
5 changes: 5 additions & 0 deletions .changeset/poor-crabs-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

Fix gas estimation logic for simple ETH transfers
5 changes: 5 additions & 0 deletions .changeset/twelve-peas-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/message-relayer': patch
---

Fix to avoid getting OOM killed when the relayer runs for a long period of time
5 changes: 5 additions & 0 deletions .changeset/two-suits-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

add an env var METRICS_ENABLE for MetricsEnabledFlag
8 changes: 8 additions & 0 deletions integration-tests/test/rpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ describe('Basic RPC tests', () => {
})

describe('eth_estimateGas (returns the fee)', () => {
it('should return a gas estimate for txs with empty data', async () => {
const estimate = await l2Provider.estimateGas({
to: DEFAULT_TRANSACTION.to,
value: 0,
})
expect(estimate).to.be.eq(21000)
})

it('should return a gas estimate that grows with the size of data', async () => {
const dataLen = [0, 2, 8, 64, 256]
const l1GasPrice = await env.l1Wallet.provider.getGasPrice()
Expand Down
2 changes: 2 additions & 0 deletions l2geth/cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ var (
MetricsEnabledFlag = cli.BoolFlag{
Name: "metrics",
Usage: "Enable metrics collection and reporting",

EnvVar: "METRICS_ENABLE",
}
MetricsEnabledExpensiveFlag = cli.BoolFlag{
Name: "metrics.expensive",
Expand Down
12 changes: 7 additions & 5 deletions l2geth/internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,10 +1032,6 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr
// fees can compensate for the additional costs the sequencer pays for publishing the
// transaction calldata
func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, gasCap *big.Int) (hexutil.Uint64, error) {
if args.Data == nil {
return 0, errors.New("transaction data cannot be nil")
}

// 1. get the gas that would be used by the transaction
gasUsed, err := legacyDoEstimateGas(ctx, b, args, blockNrOrHash, gasCap)
if err != nil {
Expand All @@ -1056,7 +1052,13 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
}

// 3. calculate the fee and normalize by the default gas price
fee := core.CalculateRollupFee(*args.Data, uint64(gasUsed), dataPrice, executionPrice).Uint64() / defaultGasPrice
var data []byte
if args.Data == nil {
data = []byte{}
} else {
data = *args.Data
}
fee := core.CalculateRollupFee(data, uint64(gasUsed), dataPrice, executionPrice).Uint64() / defaultGasPrice
if fee < 21000 {
fee = 21000
}
Expand Down
39 changes: 33 additions & 6 deletions packages/contracts/deployments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ Network : __mainnet (chain id: 1)__
|OVM_ChainStorageContainer-SCC-batches|[0x7B8af5f008A7C5eFD319e68Fd5C9A68008519Caf](https://etherscan.io/address/0x7B8af5f008A7C5eFD319e68Fd5C9A68008519Caf)|
|OVM_ExecutionManager|[0x3f5FA555c434b49D946042955013966Fd108DaC3](https://etherscan.io/address/0x3f5FA555c434b49D946042955013966Fd108DaC3)|
|OVM_FraudVerifier|[0x169CC2f69Cc16da17B71Df2dce6161ef57991bB9](https://etherscan.io/address/0x169CC2f69Cc16da17B71Df2dce6161ef57991bB9)|
|OVM_L1CrossDomainMessenger|[0x598F2b19e983910529affAb7D219724a019339CC](https://etherscan.io/address/0x598F2b19e983910529affAb7D219724a019339CC)|
|OVM_L1ETHGateway|[0x40c9067ec8087EcF101FC10d2673636955b81A32](https://etherscan.io/address/0x40c9067ec8087EcF101FC10d2673636955b81A32)|
|OVM_L1MultiMessageRelayer|[0xc34F5B7279A9276A9D02491c59630fa725B7c36B](https://etherscan.io/address/0xc34F5B7279A9276A9D02491c59630fa725B7c36B)|
|OVM_SafetyChecker|[0xD87eFbBb82f1B7d25469641ee2E0E513f144394C](https://etherscan.io/address/0xD87eFbBb82f1B7d25469641ee2E0E513f144394C)|
|OVM_StateCommitmentChain|[0x6786EB419547a4902d285F70c6acDbC9AefAdB6F](https://etherscan.io/address/0x6786EB419547a4902d285F70c6acDbC9AefAdB6F)|
Expand All @@ -48,6 +46,17 @@ Network : __mainnet (chain id: 1)__
|Proxy__OVM_L1CrossDomainMessenger|[0x902e5fF5A99C4eC1C21bbab089fdabE32EF0A5DF](https://etherscan.io/address/0x902e5fF5A99C4eC1C21bbab089fdabE32EF0A5DF)|
|Proxy__OVM_L1ETHGateway|[0xe681F80966a8b1fFadECf8068bD6F99034791c95](https://etherscan.io/address/0xe681F80966a8b1fFadECf8068bD6F99034791c95)|
|mockOVM_BondManager|[0x90c5F8d045bBcCc99d907f30E8707F06D95d065b](https://etherscan.io/address/0x90c5F8d045bBcCc99d907f30E8707F06D95d065b)|
<!--
Implementation addresses. DO NOT use these addresses directly.
Use their proxied counterparts seen above.

OVM_L1CrossDomainMessenger:
- 0x598F2b19e983910529affAb7D219724a019339CC
- https://etherscan.io/address/0x598F2b19e983910529affAb7D219724a019339CC)
OVM_L1ETHGateway:
- 0x40c9067ec8087EcF101FC10d2673636955b81A32
- https://etherscan.io/address/0x40c9067ec8087EcF101FC10d2673636955b81A32)
-->
---
## KOVAN

Expand All @@ -62,8 +71,6 @@ Network : __kovan (chain id: 42)__
|OVM_ChainStorageContainer-SCC-batches|[0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0](https://kovan.etherscan.io/address/0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0)|
|OVM_ExecutionManager|[0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB](https://kovan.etherscan.io/address/0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB)|
|OVM_FraudVerifier|[0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44](https://kovan.etherscan.io/address/0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44)|
|OVM_L1CrossDomainMessenger|[0xa9D9045E4A753c856Fc0053369E780f23559E0A1](https://kovan.etherscan.io/address/0xa9D9045E4A753c856Fc0053369E780f23559E0A1)|
|OVM_L1ETHGateway|[0x25bb69ee5665536Ce6aeb51094F0bed9e4DACc30](https://kovan.etherscan.io/address/0x25bb69ee5665536Ce6aeb51094F0bed9e4DACc30)|
|OVM_L1MultiMessageRelayer|[0x942b1B1CaF9e7654318CbfCfD1bca6727C716638](https://kovan.etherscan.io/address/0x942b1B1CaF9e7654318CbfCfD1bca6727C716638)|
|OVM_SafetyChecker|[0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a](https://kovan.etherscan.io/address/0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a)|
|OVM_StateCommitmentChain|[0xdB1367bB36C34618778D492725C3eD11B508aC54](https://kovan.etherscan.io/address/0xdB1367bB36C34618778D492725C3eD11B508aC54)|
Expand All @@ -72,6 +79,17 @@ Network : __kovan (chain id: 42)__
|Proxy__OVM_L1CrossDomainMessenger|[0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0](https://kovan.etherscan.io/address/0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0)|
|Proxy__OVM_L1ETHGateway|[0xB191d67F69e823445cD59e5A88953a82be73b9C6](https://kovan.etherscan.io/address/0xB191d67F69e823445cD59e5A88953a82be73b9C6)|
|mockOVM_BondManager|[0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01](https://kovan.etherscan.io/address/0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01)|
<!--
Implementation addresses. DO NOT use these addresses directly.
Use their proxied counterparts seen above.

OVM_L1CrossDomainMessenger:
- 0xa9D9045E4A753c856Fc0053369E780f23559E0A1
- https://kovan.etherscan.io/address/0xa9D9045E4A753c856Fc0053369E780f23559E0A1)
OVM_L1ETHGateway:
- 0x25bb69ee5665536Ce6aeb51094F0bed9e4DACc30
- https://kovan.etherscan.io/address/0x25bb69ee5665536Ce6aeb51094F0bed9e4DACc30)
-->
---
## GOERLI

Expand All @@ -86,8 +104,6 @@ Network : __goerli (chain id: 5)__
|OVM_ChainStorageContainer-SCC-batches|[0x2A622E327D7A204b39355202d41BD9B752C8df54](https://goerli.etherscan.io/address/0x2A622E327D7A204b39355202d41BD9B752C8df54)|
|OVM_ExecutionManager|[0x45B459295d6b08D7dA3B9daae541D5F75E1CF818](https://goerli.etherscan.io/address/0x45B459295d6b08D7dA3B9daae541D5F75E1CF818)|
|OVM_FraudVerifier|[0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b](https://goerli.etherscan.io/address/0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b)|
|OVM_L1CrossDomainMessenger|[0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df](https://goerli.etherscan.io/address/0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df)|
|OVM_L1ETHGateway|[0x746E840b94cC75921D1cb620b83CFd0C658B2852](https://goerli.etherscan.io/address/0x746E840b94cC75921D1cb620b83CFd0C658B2852)|
|OVM_L1MultiMessageRelayer|[0x737557d97f7f2ccb0263C4b55f0D735D52c2D385](https://goerli.etherscan.io/address/0x737557d97f7f2ccb0263C4b55f0D735D52c2D385)|
|OVM_SafetyChecker|[0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0](https://goerli.etherscan.io/address/0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0)|
|OVM_StateCommitmentChain|[0x5c3e321947C99698027108351ee736823Bd157D8](https://goerli.etherscan.io/address/0x5c3e321947C99698027108351ee736823Bd157D8)|
Expand All @@ -96,4 +112,15 @@ Network : __goerli (chain id: 5)__
|Proxy__OVM_L1CrossDomainMessenger|[0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E](https://goerli.etherscan.io/address/0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E)|
|Proxy__OVM_L1ETHGateway|[0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39](https://goerli.etherscan.io/address/0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39)|
|mockOVM_BondManager|[0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C](https://goerli.etherscan.io/address/0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C)|
<!--
Implementation addresses. DO NOT use these addresses directly.
Use their proxied counterparts seen above.

OVM_L1CrossDomainMessenger:
- 0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df
- https://goerli.etherscan.io/address/0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df)
OVM_L1ETHGateway:
- 0x746E840b94cC75921D1cb620b83CFd0C658B2852
- https://goerli.etherscan.io/address/0x746E840b94cC75921D1cb620b83CFd0C658B2852)
-->
---
22 changes: 22 additions & 0 deletions packages/contracts/scripts/generate-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ const networks = {
return child.name.replace(".json", "");
});

proxiedContracts = [];
for (let i = 0; i < contracts.length; i++) {
if (contracts[i] == 'OVM_L1CrossDomainMessenger')
proxiedContracts.push(contracts.splice(i, 1)[0]);
if (contracts[i] == 'OVM_L1ETHGateway')
proxiedContracts.push(contracts.splice(i, 1)[0]);
}

for (const contract of contracts) {
const colonizedName = contract.split(':').join('-');

Expand All @@ -83,6 +91,20 @@ const networks = {
const etherscanUrl = `https://${escPrefix}etherscan.io/address/${deploymentInfo.address}`;
md += `|${colonizedName}|[${deploymentInfo.address}](${etherscanUrl})|\n`;
}

md += `<!--\nImplementation addresses. DO NOT use these addresses directly.\nUse their proxied counterparts seen above.\n\n`;

for (const proxy of proxiedContracts) {
const colonizedName = proxy.split(':').join('-');

const deploymentInfo = require(`../deployments/${deployment}/${proxy}.json`);

const escPrefix = chainId !== 1 ? `${network}.` : "";
const etherscanUrl = `https://${escPrefix}etherscan.io/address/${deploymentInfo.address}`;
md += `${colonizedName}: \n - ${deploymentInfo.address}\n - ${etherscanUrl})\n`;
}

md += `-->\n`;
md += `---\n`;
}

Expand Down
3 changes: 3 additions & 0 deletions packages/data-transport-layer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@ DATA_TRANSPORT_LAYER__LEGACY_SEQUENCER_COMPATIBILITY=false

# Monitoring
# Leave the SENTRY_DSN variable unset during local development
DATA_TRANSPORT_LAYER__USE_SENTRY=
DATA_TRANSPORT_LAYER__SENTRY_DSN=
DATA_TRANSPORT_LAYER__SENTRY_TRACE_RATE=

DATA_TRANSPORT_LAYER__ENABLE_METRICS=
2 changes: 2 additions & 0 deletions packages/data-transport-layer/src/services/main/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export interface L1DataTransportServiceOptions {
syncFromL2?: boolean
transactionsPerPollingInterval: number
legacySequencerCompatibility: boolean
useSentry?: boolean
sentryDsn?: string
sentryTraceRate?: number
enableMetrics?: boolean
defaultBackend: string
}

Expand Down
2 changes: 2 additions & 0 deletions packages/data-transport-layer/src/services/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ type ethNetwork = 'mainnet' | 'kovan' | 'goerli'
false
),
defaultBackend: config.str('default-backend', 'l1'),
useSentry: config.bool('use-sentry', false),
sentryDsn: config.str('sentry-dsn'),
sentryTraceRate: config.ufloat('sentry-trace-rate', 0.05),
enableMetrics: config.bool('enable-metrics', false),
})

await service.start()
Expand Down
22 changes: 15 additions & 7 deletions packages/data-transport-layer/src/services/server/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,29 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
private _initializeApp() {
// TODO: Maybe pass this in as a parameter instead of creating it here?
this.state.app = express()
if (this.options.ethNetworkName) {
this._initMonitoring()
if (this.options.useSentry) {
this._initSentry()
}
if (this.options.enableMetrics) {
this._initMetrics()
}
this.state.app.use(cors())
this._registerAllRoutes()
// Sentry error handling must be after all controllers
// and before other error middleware
if (this.options.ethNetworkName) {
if (this.options.useSentry) {
this.state.app.use(Sentry.Handlers.errorHandler())
}
}

/**
* Initialize Sentry and Prometheus metrics for deployed instances
* Initialize Sentry and related middleware
*/
private _initMonitoring() {
// Init Sentry options
private _initSentry() {
Sentry.init({
dsn: this.options.sentryDsn,
release: this.options.release,
environment: this.options.ethNetworkName,
integrations: [
new Sentry.Integrations.Http({ tracing: true }),
new Tracing.Integrations.Express({
Expand All @@ -136,7 +139,12 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
})
this.state.app.use(Sentry.Handlers.requestHandler())
this.state.app.use(Sentry.Handlers.tracingHandler())
// Init metrics
}

/**
* Initialize Prometheus metrics collection and endpoint
*/
private _initMetrics() {
this.metrics = new Metrics({
prefix: this.name,
labels: {
Expand Down
Loading