Commit 8ee8fb51 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into slither-9.0

parents 3f485627 1e51b79e
---
'@eth-optimism/contracts-bedrock': patch
---
Use uint64 for arithmetic in XDM's baseGas
---
'@eth-optimism/sdk': patch
---
Adds contract addresses for the Bedrock Alpha testnet
---
'@eth-optimism/contracts-bedrock': patch
'@eth-optimism/sdk': patch
---
Rename the event emitted in the L2ToL1MessagePasser
---
"@eth-optimism/contracts-periphery": patch
---
mainnet nft bridge deployments
---
'@eth-optimism/endpoint-monitor': major
---
Initial release of endpoint monitor
...@@ -26,7 +26,7 @@ pull_request_rules: ...@@ -26,7 +26,7 @@ pull_request_rules:
actions: actions:
queue: queue:
name: default name: default
method: squash method: merge
- name: Add merge train label - name: Add merge train label
conditions: conditions:
- "queue-position >= 0" - "queue-position >= 0"
......
...@@ -32,6 +32,7 @@ jobs: ...@@ -32,6 +32,7 @@ jobs:
batch-submitter-service: ${{ steps.packages.outputs.batch-submitter-service }} batch-submitter-service: ${{ steps.packages.outputs.batch-submitter-service }}
indexer: ${{ steps.packages.outputs.indexer }} indexer: ${{ steps.packages.outputs.indexer }}
teleportr: ${{ steps.packages.outputs.teleportr }} teleportr: ${{ steps.packages.outputs.teleportr }}
endpoint-monitor: ${{ steps.packages.outputs.l2geth-exporter }}
steps: steps:
- name: Check out source code - name: Check out source code
...@@ -603,3 +604,41 @@ jobs: ...@@ -603,3 +604,41 @@ jobs:
GITDATE=${{ steps.build_args.outputs.GITDATE }} GITDATE=${{ steps.build_args.outputs.GITDATE }}
GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }} GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }}
GITVERSION=${{ steps.build_args.outputs.GITVERSION }} GITVERSION=${{ steps.build_args.outputs.GITVERSION }}
endpoint-monitor:
name: Publish endpoint-monitor Version ${{ needs.canary-publish.outputs.canary-docker-tag }}
needs: canary-publish
if: needs.canary-publish.outputs.endpoint-monitor != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}
- name: Set build args
id: build_args
run: |
echo ::set-output name=GITDATE::"$(date +%d-%m-%Y)"
echo ::set-output name=GITVERSION::$(jq -r .version ./endpoint-monitor/package.json)
echo ::set-output name=GITCOMMIT::"$GITHUB_SHA"
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./endpoint-monitor/Dockerfile
push: true
tags: ethereumoptimism/endpoint-monitor:${{ needs.canary-publish.outputs.endpoint-monitor }}
build-args: |
GITDATE=${{ steps.build_args.outputs.GITDATE }}
GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }}
GITVERSION=${{ steps.build_args.outputs.GITVERSION }}
...@@ -29,6 +29,7 @@ jobs: ...@@ -29,6 +29,7 @@ jobs:
teleportr: ${{ steps.packages.outputs.teleportr }} teleportr: ${{ steps.packages.outputs.teleportr }}
ci-builder: ${{ steps.packages.outputs.ci-builder }} ci-builder: ${{ steps.packages.outputs.ci-builder }}
foundry: ${{ steps.packages.outputs.foundry }} foundry: ${{ steps.packages.outputs.foundry }}
endpoint-monitor: ${{ steps.packages.outputs.endpoint-monitor }}
steps: steps:
- name: Checkout Repo - name: Checkout Repo
...@@ -635,3 +636,40 @@ jobs: ...@@ -635,3 +636,40 @@ jobs:
GITDATE=${{ steps.build_args.outputs.GITDATE }} GITDATE=${{ steps.build_args.outputs.GITDATE }}
GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }} GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }}
GITVERSION=${{ steps.build_args.outputs.GITVERSION }} GITVERSION=${{ steps.build_args.outputs.GITVERSION }}
endpoint-monitor:
name: Publish endpoint-monitor Version ${{ needs.release.outputs.endpoint-monitor}}
needs: release
if: needs.release.outputs.endpoint-monitor != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}
- name: Set build args
id: build_args
run: |
echo ::set-output name=GITDATE::"$(date +%d-%m-%Y)"
echo ::set-output name=GITVERSION::$(jq -r .version ./endpoint-monitor/package.json)
echo ::set-output name=GITCOMMIT::"$GITHUB_SHA"
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./endpoint-monitor/Dockerfile
push: true
tags: ethereumoptimism/endpoint-monitor:${{ needs.release.outputs.endpoint-monitor }},ethereumoptimism/endpoint-monitor:latest
build-args: |
GITDATE=${{ steps.build_args.outputs.GITDATE }}
GITCOMMIT=${{ steps.build_args.outputs.GITCOMMIT }}
GITVERSION=${{ steps.build_args.outputs.GITVERSION }}
# @eth-optimism/endpoint-monitor
...@@ -50,9 +50,9 @@ func CLIFlags(envPrefix string) []cli.Flag { ...@@ -50,9 +50,9 @@ func CLIFlags(envPrefix string) []cli.Flag {
} }
type Config struct { type Config struct {
Providers []string `envconfig:"PROVIDERS" required:"true"` Providers []string
CheckInterval time.Duration `envconfig:"CHECK_INTERVAL" default:"5m"` CheckInterval time.Duration
CheckDuration time.Duration `envconfig:"CHECK_DURATION" default:"4m"` CheckDuration time.Duration
LogConfig oplog.CLIConfig LogConfig oplog.CLIConfig
MetricsConfig opmetrics.CLIConfig MetricsConfig opmetrics.CLIConfig
......
{
"name": "@eth-optimism/endpoint-monitor",
"version": "0.0.0",
"private": true,
"dependencies": {}
}
...@@ -7,6 +7,10 @@ LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) ...@@ -7,6 +7,10 @@ LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)
LDFLAGSSTRING +=-X main.GitVersion=$(GITVERSION) LDFLAGSSTRING +=-X main.GitVersion=$(GITVERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)" LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
# Note: Requires legacy contracts to be built before
# running and binding-related Make targets.
SCC_ABI_ARTIFACT = ../packages/contracts/artifacts/contracts/L1/rollup/StateCommitmentChain.sol/StateCommitmentChain.json
indexer: indexer:
env GO111MODULE=on go build -v $(LDFLAGS) ./cmd/indexer env GO111MODULE=on go build -v $(LDFLAGS) ./cmd/indexer
...@@ -19,8 +23,28 @@ test: ...@@ -19,8 +23,28 @@ test:
lint: lint:
golangci-lint run ./... golangci-lint run ./...
bindings: bindings-scc
bindings-scc:
$(eval temp := $(shell mktemp))
cat $(SCC_ABI_ARTIFACT) \
| jq -r .bytecode > $(temp)
cat $(SCC_ABI_ARTIFACT) \
| jq .abi \
| abigen --pkg scc \
--abi - \
--out bindings/scc/statecommitmentchain.go \
--type StateCommitmentChain \
--bin $(temp)
rm $(temp)
.PHONY: \ .PHONY: \
indexer \ indexer \
bindings \
bindings-scc \
clean \ clean \
test \ test \
lint lint
This diff is collapsed.
...@@ -3,9 +3,9 @@ module github.com/ethereum-optimism/optimism/op-batcher ...@@ -3,9 +3,9 @@ module github.com/ethereum-optimism/optimism/op-batcher
go 1.18 go 1.18
require ( require (
github.com/ethereum-optimism/optimism/op-node v0.8.9 github.com/ethereum-optimism/optimism/op-node v0.8.10
github.com/ethereum-optimism/optimism/op-proposer v0.8.9 github.com/ethereum-optimism/optimism/op-proposer v0.8.10
github.com/ethereum-optimism/optimism/op-service v0.8.9 github.com/ethereum-optimism/optimism/op-service v0.8.10
github.com/ethereum/go-ethereum v1.10.23 github.com/ethereum/go-ethereum v1.10.23
github.com/miguelmota/go-ethereum-hdwallet v0.1.1 github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/urfave/cli v1.22.9 github.com/urfave/cli v1.22.9
...@@ -22,7 +22,7 @@ require ( ...@@ -22,7 +22,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 // indirect github.com/ethereum-optimism/optimism/op-bindings v0.8.10 // indirect
github.com/fjl/memsize v0.0.1 // indirect github.com/fjl/memsize v0.0.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect github.com/go-stack/stack v1.8.1 // indirect
......
...@@ -149,14 +149,14 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m ...@@ -149,14 +149,14 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 h1:QeYLhgZP0QkDLxyXhkWLj/iHDFkMNI18abgrHL4I9TE= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum-optimism/optimism/op-node v0.8.9 h1:wUxvjeHB1nQtnsxbNxqHthSS+Uune7Xb17NWXDBdSXI= github.com/ethereum-optimism/optimism/op-node v0.8.10 h1:1Gc4FtR5B+HgfQ+byNn3P+tiJarpMZSYjj5iLvA3YtU=
github.com/ethereum-optimism/optimism/op-node v0.8.9/go.mod h1:ETNw9UP6sy/pWf6aoNHEgQKrXN2ca0Fm0OqIbCEghYk= github.com/ethereum-optimism/optimism/op-node v0.8.10/go.mod h1:6NkgIThuQbPY6fA9lI2A52DaeLM2FvrcwGCBVEY2fS8=
github.com/ethereum-optimism/optimism/op-proposer v0.8.9 h1:affd05NB0zxYJA/aCXEwDtaH1kcZfu3b3mnJTn94v74= github.com/ethereum-optimism/optimism/op-proposer v0.8.10 h1:dLzbYmaoMBViqCPlIUFB+bagSuwsd173P8kDhUMbBTQ=
github.com/ethereum-optimism/optimism/op-proposer v0.8.9/go.mod h1:00UGw9VkWSv/0TyltXqU2NGsp4QaWVPzLZ4zvpUGbhU= github.com/ethereum-optimism/optimism/op-proposer v0.8.10/go.mod h1:tdUw40bNis2G1uDT3jNv7BWWM+FzTar+fS5zv6o2YPA=
github.com/ethereum-optimism/optimism/op-service v0.8.9 h1:YdMBcgXi+NHqX3pKR6UhjGHtBeF8AQK6kLmwpv7LzJM= github.com/ethereum-optimism/optimism/op-service v0.8.10 h1:K3IABHI1b0MDrDXALvTKTbzy6IogGD6NgmbqfKEcEwM=
github.com/ethereum-optimism/optimism/op-service v0.8.9/go.mod h1:K0uybOhICTc2yfhrRj0cD1m7aPkOf5C9e6bUmvf4rGA= github.com/ethereum-optimism/optimism/op-service v0.8.10/go.mod h1:K0uybOhICTc2yfhrRj0cD1m7aPkOf5C9e6bUmvf4rGA=
github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg= github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const GasPriceOracleStorageLayoutJSON = "{\"storage\":[{\"astId\":27789,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":1754,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"spacer_1_0_32\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"},{\"astId\":1757,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"spacer_2_0_32\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":1760,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"overhead\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_uint256\"},{\"astId\":1763,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"scalar\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_uint256\"},{\"astId\":1766,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"decimals\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_uint256\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const GasPriceOracleStorageLayoutJSON = "{\"storage\":[{\"astId\":27829,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":1754,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"spacer_1_0_32\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"},{\"astId\":1757,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"spacer_2_0_32\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":1760,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"overhead\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_uint256\"},{\"astId\":1763,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"scalar\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_uint256\"},{\"astId\":1766,\"contract\":\"contracts/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"decimals\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_uint256\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var GasPriceOracleStorageLayout = new(solc.StorageLayout) var GasPriceOracleStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const GovernanceTokenStorageLayoutJSON = "{\"storage\":[{\"astId\":28139,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":28145,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":28147,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":28149,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":28151,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":29516,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_nonces\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_mapping(t_address,t_struct(Counter)30305_storage)\"},{\"astId\":29524,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_PERMIT_TYPEHASH_DEPRECATED_SLOT\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_bytes32\"},{\"astId\":28857,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_delegates\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_mapping(t_address,t_address)\"},{\"astId\":28863,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_checkpoints\",\"offset\":0,\"slot\":\"8\",\"type\":\"t_mapping(t_address,t_array(t_struct(Checkpoint)28848_storage)dyn_storage)\"},{\"astId\":28867,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupplyCheckpoints\",\"offset\":0,\"slot\":\"9\",\"type\":\"t_array(t_struct(Checkpoint)28848_storage)dyn_storage\"},{\"astId\":27789,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"10\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_struct(Checkpoint)28848_storage)dyn_storage\":{\"encoding\":\"dynamic_array\",\"label\":\"struct ERC20Votes.Checkpoint[]\",\"numberOfBytes\":\"32\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_address,t_address)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e address)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_address\"},\"t_mapping(t_address,t_array(t_struct(Checkpoint)28848_storage)dyn_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct ERC20Votes.Checkpoint[])\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_array(t_struct(Checkpoint)28848_storage)dyn_storage\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_struct(Counter)30305_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct Counters.Counter)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_struct(Counter)30305_storage\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_struct(Checkpoint)28848_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ERC20Votes.Checkpoint\",\"numberOfBytes\":\"32\"},\"t_struct(Counter)30305_storage\":{\"encoding\":\"inplace\",\"label\":\"struct Counters.Counter\",\"numberOfBytes\":\"32\"},\"t_uint224\":{\"encoding\":\"inplace\",\"label\":\"uint224\",\"numberOfBytes\":\"28\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"}}}" const GovernanceTokenStorageLayoutJSON = "{\"storage\":[{\"astId\":28179,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":28185,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":28187,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":28189,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":28191,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":29556,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_nonces\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_mapping(t_address,t_struct(Counter)30345_storage)\"},{\"astId\":29564,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_PERMIT_TYPEHASH_DEPRECATED_SLOT\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_bytes32\"},{\"astId\":28897,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_delegates\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_mapping(t_address,t_address)\"},{\"astId\":28903,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_checkpoints\",\"offset\":0,\"slot\":\"8\",\"type\":\"t_mapping(t_address,t_array(t_struct(Checkpoint)28888_storage)dyn_storage)\"},{\"astId\":28907,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupplyCheckpoints\",\"offset\":0,\"slot\":\"9\",\"type\":\"t_array(t_struct(Checkpoint)28888_storage)dyn_storage\"},{\"astId\":27829,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"10\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_struct(Checkpoint)28888_storage)dyn_storage\":{\"encoding\":\"dynamic_array\",\"label\":\"struct ERC20Votes.Checkpoint[]\",\"numberOfBytes\":\"32\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_address,t_address)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e address)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_address\"},\"t_mapping(t_address,t_array(t_struct(Checkpoint)28888_storage)dyn_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct ERC20Votes.Checkpoint[])\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_array(t_struct(Checkpoint)28888_storage)dyn_storage\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_struct(Counter)30345_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct Counters.Counter)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_struct(Counter)30345_storage\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_struct(Checkpoint)28888_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ERC20Votes.Checkpoint\",\"numberOfBytes\":\"32\"},\"t_struct(Counter)30345_storage\":{\"encoding\":\"inplace\",\"label\":\"struct Counters.Counter\",\"numberOfBytes\":\"32\"},\"t_uint224\":{\"encoding\":\"inplace\",\"label\":\"uint224\",\"numberOfBytes\":\"28\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"}}}"
var GovernanceTokenStorageLayout = new(solc.StorageLayout) var GovernanceTokenStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const L2StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":26339,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":26342,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":26349,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":26354,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_array(t_uint256)47_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)47_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[47]\",\"numberOfBytes\":\"1504\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const L2StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":26379,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":26382,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":26389,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":26394,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_array(t_uint256)47_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)47_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[47]\",\"numberOfBytes\":\"1504\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var L2StandardBridgeStorageLayout = new(solc.StorageLayout) var L2StandardBridgeStorageLayout = new(solc.StorageLayout)
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ const L2ToL1MessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":2546,\"co ...@@ -13,7 +13,7 @@ const L2ToL1MessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":2546,\"co
var L2ToL1MessagePasserStorageLayout = new(solc.StorageLayout) var L2ToL1MessagePasserStorageLayout = new(solc.StorageLayout)
var L2ToL1MessagePasserDeployedBin = "0x60806040526004361061005e5760003560e01c806382e3702d1161004357806382e3702d146100c7578063affed0e014610107578063c2b3e5ac1461012b57600080fd5b806344df8e701461008757806354fd4d501461009c57600080fd5b366100825761008033620186a060405180602001604052806000815250610139565b005b600080fd5b34801561009357600080fd5b5061008061026d565b3480156100a857600080fd5b506100b16102a5565b6040516100be9190610587565b60405180910390f35b3480156100d357600080fd5b506100f76100e23660046105a1565b60006020819052908152604090205460ff1681565b60405190151581526020016100be565b34801561011357600080fd5b5061011d60015481565b6040519081526020016100be565b6100806101393660046105e9565b600061019e6040518060c0016040528060015481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200134815260200185815260200184815250610348565b6000818152602081905260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915554905191925073ffffffffffffffffffffffffffffffffffffffff8616913391907f87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a61369061022c903490899089906106ed565b60405180910390a460405181907f2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb90600090a2505060018054810190555050565b4761027781610395565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606102d07f00000000000000000000000000000000000000000000000000000000000000006103c4565b6102f97f00000000000000000000000000000000000000000000000000000000000000006103c4565b6103227f00000000000000000000000000000000000000000000000000000000000000006103c4565b60405160200161033493929190610715565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761037897909695910161078b565b604051602081830303815290604052805190602001209050919050565b806040516103a290610501565b6040518091039082f09050801580156103bf573d6000803e3d6000fd5b505050565b60608160000361040757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610431578061041b81610811565b915061042a9050600a83610878565b915061040b565b60008167ffffffffffffffff81111561044c5761044c6105ba565b6040519080825280601f01601f191660200182016040528015610476576020820181803683370190505b5090505b84156104f95761048b60018361088c565b9150610498600a866108a3565b6104a39060306108b7565b60f81b8183815181106104b8576104b86108cf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506104f2600a86610878565b945061047a565b949350505050565b6008806108ff83390190565b60005b83811015610528578181015183820152602001610510565b83811115610537576000848401525b50505050565b6000815180845261055581602086016020860161050d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061059a602083018461053d565b9392505050565b6000602082840312156105b357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156105fe57600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461062257600080fd5b925060208401359150604084013567ffffffffffffffff8082111561064657600080fd5b818601915086601f83011261065a57600080fd5b81358181111561066c5761066c6105ba565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156106b2576106b26105ba565b816040528281528960208487010111156106cb57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b83815282602082015260606040820152600061070c606083018461053d565b95945050505050565b6000845161072781846020890161050d565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610763816001850160208a0161050d565b6001920191820152835161077e81600284016020880161050d565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526107d660c083018461053d565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610842576108426107e2565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261088757610887610849565b500490565b60008282101561089e5761089e6107e2565b500390565b6000826108b2576108b2610849565b500690565b600082198211156108ca576108ca6107e2565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a" var L2ToL1MessagePasserDeployedBin = "0x60806040526004361061005e5760003560e01c806382e3702d1161004357806382e3702d146100c7578063affed0e014610107578063c2b3e5ac1461012b57600080fd5b806344df8e701461008757806354fd4d501461009c57600080fd5b366100825761008033620186a060405180602001604052806000815250610139565b005b600080fd5b34801561009357600080fd5b5061008061026d565b3480156100a857600080fd5b506100b16102a5565b6040516100be9190610587565b60405180910390f35b3480156100d357600080fd5b506100f76100e23660046105a1565b60006020819052908152604090205460ff1681565b60405190151581526020016100be565b34801561011357600080fd5b5061011d60015481565b6040519081526020016100be565b6100806101393660046105e9565b600061019e6040518060c0016040528060015481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200134815260200185815260200184815250610348565b6000818152602081905260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915554905191925073ffffffffffffffffffffffffffffffffffffffff8616913391907f7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d729061022c903490899089906106ed565b60405180910390a460405181907fedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c90600090a2505060018054810190555050565b4761027781610395565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606102d07f00000000000000000000000000000000000000000000000000000000000000006103c4565b6102f97f00000000000000000000000000000000000000000000000000000000000000006103c4565b6103227f00000000000000000000000000000000000000000000000000000000000000006103c4565b60405160200161033493929190610715565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761037897909695910161078b565b604051602081830303815290604052805190602001209050919050565b806040516103a290610501565b6040518091039082f09050801580156103bf573d6000803e3d6000fd5b505050565b60608160000361040757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610431578061041b81610811565b915061042a9050600a83610878565b915061040b565b60008167ffffffffffffffff81111561044c5761044c6105ba565b6040519080825280601f01601f191660200182016040528015610476576020820181803683370190505b5090505b84156104f95761048b60018361088c565b9150610498600a866108a3565b6104a39060306108b7565b60f81b8183815181106104b8576104b86108cf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506104f2600a86610878565b945061047a565b949350505050565b6008806108ff83390190565b60005b83811015610528578181015183820152602001610510565b83811115610537576000848401525b50505050565b6000815180845261055581602086016020860161050d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061059a602083018461053d565b9392505050565b6000602082840312156105b357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156105fe57600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461062257600080fd5b925060208401359150604084013567ffffffffffffffff8082111561064657600080fd5b818601915086601f83011261065a57600080fd5b81358181111561066c5761066c6105ba565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156106b2576106b26105ba565b816040528281528960208487010111156106cb57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b83815282602082015260606040820152600061070c606083018461053d565b95945050505050565b6000845161072781846020890161050d565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610763816001850160208a0161050d565b6001920191820152835161077e81600284016020880161050d565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526107d660c083018461053d565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610842576108426107e2565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261088757610887610849565b500490565b60008282101561089e5761089e6107e2565b500390565b6000826108b2576108b2610849565b500690565b600082198211156108ca576108ca6107e2565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a"
func init() { func init() {
if err := json.Unmarshal([]byte(L2ToL1MessagePasserStorageLayoutJSON), L2ToL1MessagePasserStorageLayout); err != nil { if err := json.Unmarshal([]byte(L2ToL1MessagePasserStorageLayoutJSON), L2ToL1MessagePasserStorageLayout); err != nil {
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const LegacyERC20ETHStorageLayoutJSON = "{\"storage\":[{\"astId\":28139,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":28145,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":28147,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":28149,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":28151,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":25252,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"remoteToken\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_address\"},{\"astId\":25255,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"bridge\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const LegacyERC20ETHStorageLayoutJSON = "{\"storage\":[{\"astId\":28179,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":28185,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":28187,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":28189,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":28191,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":25292,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"remoteToken\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_address\"},{\"astId\":25295,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"bridge\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var LegacyERC20ETHStorageLayout = new(solc.StorageLayout) var LegacyERC20ETHStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const OptimismPortalStorageLayoutJSON = "{\"storage\":[{\"astId\":27979,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":27982,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1404,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"params\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_struct(ResourceParams)1374_storage\"},{\"astId\":1409,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_array(t_uint256)48_storage\"},{\"astId\":982,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"l2Sender\",\"offset\":0,\"slot\":\"50\",\"type\":\"t_address\"},{\"astId\":995,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"finalizedWithdrawals\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_mapping(t_bytes32,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)48_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[48]\",\"numberOfBytes\":\"1536\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_struct(ResourceParams)1374_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ResourceMetering.ResourceParams\",\"numberOfBytes\":\"32\"},\"t_uint128\":{\"encoding\":\"inplace\",\"label\":\"uint128\",\"numberOfBytes\":\"16\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}" const OptimismPortalStorageLayoutJSON = "{\"storage\":[{\"astId\":28019,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":28022,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1404,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"params\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_struct(ResourceParams)1374_storage\"},{\"astId\":1409,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_array(t_uint256)48_storage\"},{\"astId\":982,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"l2Sender\",\"offset\":0,\"slot\":\"50\",\"type\":\"t_address\"},{\"astId\":995,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"finalizedWithdrawals\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_mapping(t_bytes32,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)48_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[48]\",\"numberOfBytes\":\"1536\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_struct(ResourceParams)1374_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ResourceMetering.ResourceParams\",\"numberOfBytes\":\"32\"},\"t_uint128\":{\"encoding\":\"inplace\",\"label\":\"uint128\",\"numberOfBytes\":\"16\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var OptimismPortalStorageLayout = new(solc.StorageLayout) var OptimismPortalStorageLayout = new(solc.StorageLayout)
......
...@@ -4,7 +4,7 @@ go 1.18 ...@@ -4,7 +4,7 @@ go 1.18
require ( require (
github.com/ethereum-optimism/optimism/l2geth v0.0.0-20220820030939-de38b6f6f77e github.com/ethereum-optimism/optimism/l2geth v0.0.0-20220820030939-de38b6f6f77e
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 github.com/ethereum-optimism/optimism/op-bindings v0.8.10
github.com/ethereum/go-ethereum v1.10.23 github.com/ethereum/go-ethereum v1.10.23
github.com/holiman/uint256 v1.2.0 github.com/holiman/uint256 v1.2.0
github.com/mattn/go-isatty v0.0.14 github.com/mattn/go-isatty v0.0.14
......
...@@ -176,8 +176,8 @@ github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOn ...@@ -176,8 +176,8 @@ github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOn
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/l2geth v0.0.0-20220820030939-de38b6f6f77e h1:LUfy9ofKcen9Cm1T9JyGNnrPLR2AmyelFbohS6bs4X8= github.com/ethereum-optimism/optimism/l2geth v0.0.0-20220820030939-de38b6f6f77e h1:LUfy9ofKcen9Cm1T9JyGNnrPLR2AmyelFbohS6bs4X8=
github.com/ethereum-optimism/optimism/l2geth v0.0.0-20220820030939-de38b6f6f77e/go.mod h1:Oj5A6Qs/Ao1SP17i3uKroyhz49q/ehagSXRAlvwaI5Y= github.com/ethereum-optimism/optimism/l2geth v0.0.0-20220820030939-de38b6f6f77e/go.mod h1:Oj5A6Qs/Ao1SP17i3uKroyhz49q/ehagSXRAlvwaI5Y=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 h1:QeYLhgZP0QkDLxyXhkWLj/iHDFkMNI18abgrHL4I9TE= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg= github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg=
github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
......
package e2eutils package e2eutils
import (
"context"
"testing"
"time"
)
// TestingBase is an interface used for standard Go testing. // TestingBase is an interface used for standard Go testing.
// This interface is used for unit tests, benchmarks, and fuzz tests and also emulated in Hive. // This interface is used for unit tests, benchmarks, and fuzz tests and also emulated in Hive.
// //
...@@ -24,3 +30,9 @@ type TestingBase interface { ...@@ -24,3 +30,9 @@ type TestingBase interface {
Skipped() bool Skipped() bool
TempDir() string TempDir() string
} }
func TimeoutCtx(t *testing.T, timeout time.Duration) context.Context {
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
return ctx
}
package e2eutils
import (
"context"
"errors"
"fmt"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
)
func WaitReceiptOK(ctx context.Context, client *ethclient.Client, hash common.Hash) (*types.Receipt, error) {
return WaitReceipt(ctx, client, hash, types.ReceiptStatusSuccessful)
}
func WaitReceiptFail(ctx context.Context, client *ethclient.Client, hash common.Hash) (*types.Receipt, error) {
return WaitReceipt(ctx, client, hash, types.ReceiptStatusFailed)
}
func WaitReceipt(ctx context.Context, client *ethclient.Client, hash common.Hash, status uint64) (*types.Receipt, error) {
ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop()
for {
receipt, err := client.TransactionReceipt(ctx, hash)
if errors.Is(err, ethereum.NotFound) {
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-ticker.C:
continue
}
}
if err != nil {
return nil, err
}
if receipt.Status != status {
return receipt, fmt.Errorf("expected status %d, but got %d", status, receipt.Status)
}
return receipt, nil
}
}
func WaitBlock(ctx context.Context, client *ethclient.Client, n uint64) error {
for {
height, err := client.BlockNumber(ctx)
if err != nil {
return err
}
if height < n {
time.Sleep(500 * time.Millisecond)
continue
}
break
}
return nil
}
func WaitFor(ctx context.Context, rate time.Duration, cb func() (bool, error)) error {
tick := time.NewTicker(rate)
defer tick.Stop()
for {
select {
case <-ctx.Done():
return ctx.Err()
case <-tick.C:
done, err := cb()
if err != nil {
return err
}
if done {
return nil
}
}
}
}
...@@ -155,6 +155,8 @@ func initL2Geth(name string, l2ChainID *big.Int, genesis *core.Genesis, jwtPath ...@@ -155,6 +155,8 @@ func initL2Geth(name string, l2ChainID *big.Int, genesis *core.Genesis, jwtPath
WSPort: 0, WSPort: 0,
AuthAddr: "127.0.0.1", AuthAddr: "127.0.0.1",
AuthPort: 0, AuthPort: 0,
HTTPHost: "127.0.0.1",
HTTPPort: 0,
WSModules: []string{"debug", "admin", "eth", "txpool", "net", "rpc", "web3", "personal", "engine"}, WSModules: []string{"debug", "admin", "eth", "txpool", "net", "rpc", "web3", "personal", "engine"},
HTTPModules: []string{"debug", "admin", "eth", "txpool", "net", "rpc", "web3", "personal", "engine"}, HTTPModules: []string{"debug", "admin", "eth", "txpool", "net", "rpc", "web3", "personal", "engine"},
JWTSecret: jwtPath, JWTSecret: jwtPath,
......
...@@ -3,12 +3,12 @@ module github.com/ethereum-optimism/optimism/op-e2e ...@@ -3,12 +3,12 @@ module github.com/ethereum-optimism/optimism/op-e2e
go 1.18 go 1.18
require ( require (
github.com/ethereum-optimism/optimism/op-batcher v0.8.9 github.com/ethereum-optimism/optimism/op-batcher v0.8.10
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 github.com/ethereum-optimism/optimism/op-bindings v0.8.10
github.com/ethereum-optimism/optimism/op-chain-ops v0.8.9 github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10
github.com/ethereum-optimism/optimism/op-node v0.8.9 github.com/ethereum-optimism/optimism/op-node v0.8.10
github.com/ethereum-optimism/optimism/op-proposer v0.8.9 github.com/ethereum-optimism/optimism/op-proposer v0.8.10
github.com/ethereum-optimism/optimism/op-service v0.8.9 github.com/ethereum-optimism/optimism/op-service v0.8.10
github.com/ethereum/go-ethereum v1.10.23 github.com/ethereum/go-ethereum v1.10.23
github.com/libp2p/go-libp2p v0.21.0 github.com/libp2p/go-libp2p v0.21.0
github.com/libp2p/go-libp2p-core v0.19.1 github.com/libp2p/go-libp2p-core v0.19.1
......
...@@ -241,18 +241,18 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m ...@@ -241,18 +241,18 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-batcher v0.8.9 h1:toKo/4yjwLX7J/C/Fi9hH3jd2TYAWwxUc9VPpR/Dv+A= github.com/ethereum-optimism/optimism/op-batcher v0.8.10 h1:nnC6Xs6XH/GHb/hDN+SGzDRed+PxsImPRzk6IZKiX6o=
github.com/ethereum-optimism/optimism/op-batcher v0.8.9/go.mod h1:iRw9zIuH0mV+zg7gpUeMHGuGsAWcFdIqzQdRMkW1fvQ= github.com/ethereum-optimism/optimism/op-batcher v0.8.10/go.mod h1:W7QUdBkKsDm09KVUmBSVww/DiCCglBBNuvcayWnedbc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 h1:QeYLhgZP0QkDLxyXhkWLj/iHDFkMNI18abgrHL4I9TE= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum-optimism/optimism/op-chain-ops v0.8.9 h1:Z8174lRVnvw1r8w0OS0vOrFXcAg6635WuqHObZSJzKs= github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10 h1:ErDuEO7Dsd7+XXlTWToBN/388IgC8eXjAPgiHoXviw4=
github.com/ethereum-optimism/optimism/op-chain-ops v0.8.9/go.mod h1:Y+on77cEP5Kn6Jc2aX24d3zk2lvT76KaUlTQSn7zesU= github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10/go.mod h1:a9/PrzVU8EHKlLr6yz4YXw2VhEHYrbVogX56r26VUrY=
github.com/ethereum-optimism/optimism/op-node v0.8.9 h1:wUxvjeHB1nQtnsxbNxqHthSS+Uune7Xb17NWXDBdSXI= github.com/ethereum-optimism/optimism/op-node v0.8.10 h1:1Gc4FtR5B+HgfQ+byNn3P+tiJarpMZSYjj5iLvA3YtU=
github.com/ethereum-optimism/optimism/op-node v0.8.9/go.mod h1:ETNw9UP6sy/pWf6aoNHEgQKrXN2ca0Fm0OqIbCEghYk= github.com/ethereum-optimism/optimism/op-node v0.8.10/go.mod h1:6NkgIThuQbPY6fA9lI2A52DaeLM2FvrcwGCBVEY2fS8=
github.com/ethereum-optimism/optimism/op-proposer v0.8.9 h1:affd05NB0zxYJA/aCXEwDtaH1kcZfu3b3mnJTn94v74= github.com/ethereum-optimism/optimism/op-proposer v0.8.10 h1:dLzbYmaoMBViqCPlIUFB+bagSuwsd173P8kDhUMbBTQ=
github.com/ethereum-optimism/optimism/op-proposer v0.8.9/go.mod h1:00UGw9VkWSv/0TyltXqU2NGsp4QaWVPzLZ4zvpUGbhU= github.com/ethereum-optimism/optimism/op-proposer v0.8.10/go.mod h1:tdUw40bNis2G1uDT3jNv7BWWM+FzTar+fS5zv6o2YPA=
github.com/ethereum-optimism/optimism/op-service v0.8.9 h1:YdMBcgXi+NHqX3pKR6UhjGHtBeF8AQK6kLmwpv7LzJM= github.com/ethereum-optimism/optimism/op-service v0.8.10 h1:K3IABHI1b0MDrDXALvTKTbzy6IogGD6NgmbqfKEcEwM=
github.com/ethereum-optimism/optimism/op-service v0.8.9/go.mod h1:K0uybOhICTc2yfhrRj0cD1m7aPkOf5C9e6bUmvf4rGA= github.com/ethereum-optimism/optimism/op-service v0.8.10/go.mod h1:K0uybOhICTc2yfhrRj0cD1m7aPkOf5C9e6bUmvf4rGA=
github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg= github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
......
...@@ -190,27 +190,27 @@ type System struct { ...@@ -190,27 +190,27 @@ type System struct {
RollupConfig *rollup.Config RollupConfig *rollup.Config
// Connections to running nodes // Connections to running nodes
nodes map[string]*node.Node Nodes map[string]*node.Node
backends map[string]*geth_eth.Ethereum Backends map[string]*geth_eth.Ethereum
Clients map[string]*ethclient.Client Clients map[string]*ethclient.Client
rollupNodes map[string]*rollupNode.OpNode RollupNodes map[string]*rollupNode.OpNode
l2OutputSubmitter *l2os.L2OutputSubmitter L2OutputSubmitter *l2os.L2OutputSubmitter
batchSubmitter *bss.BatchSubmitter BatchSubmitter *bss.BatchSubmitter
Mocknet mocknet.Mocknet Mocknet mocknet.Mocknet
} }
func (sys *System) Close() { func (sys *System) Close() {
if sys.l2OutputSubmitter != nil { if sys.L2OutputSubmitter != nil {
sys.l2OutputSubmitter.Stop() sys.L2OutputSubmitter.Stop()
} }
if sys.batchSubmitter != nil { if sys.BatchSubmitter != nil {
sys.batchSubmitter.Stop() sys.BatchSubmitter.Stop()
} }
for _, node := range sys.rollupNodes { for _, node := range sys.RollupNodes {
node.Close() node.Close()
} }
for _, node := range sys.nodes { for _, node := range sys.Nodes {
node.Close() node.Close()
} }
sys.Mocknet.Close() sys.Mocknet.Close()
...@@ -219,18 +219,18 @@ func (sys *System) Close() { ...@@ -219,18 +219,18 @@ func (sys *System) Close() {
func (cfg SystemConfig) Start() (*System, error) { func (cfg SystemConfig) Start() (*System, error) {
sys := &System{ sys := &System{
cfg: cfg, cfg: cfg,
nodes: make(map[string]*node.Node), Nodes: make(map[string]*node.Node),
backends: make(map[string]*geth_eth.Ethereum), Backends: make(map[string]*geth_eth.Ethereum),
Clients: make(map[string]*ethclient.Client), Clients: make(map[string]*ethclient.Client),
rollupNodes: make(map[string]*rollupNode.OpNode), RollupNodes: make(map[string]*rollupNode.OpNode),
} }
didErrAfterStart := false didErrAfterStart := false
defer func() { defer func() {
if didErrAfterStart { if didErrAfterStart {
for _, node := range sys.rollupNodes { for _, node := range sys.RollupNodes {
node.Close() node.Close()
} }
for _, node := range sys.nodes { for _, node := range sys.Nodes {
node.Close() node.Close()
} }
} }
...@@ -302,16 +302,16 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -302,16 +302,16 @@ func (cfg SystemConfig) Start() (*System, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
sys.nodes["l1"] = l1Node sys.Nodes["l1"] = l1Node
sys.backends["l1"] = l1Backend sys.Backends["l1"] = l1Backend
for name := range cfg.Nodes { for name := range cfg.Nodes {
node, backend, err := initL2Geth(name, big.NewInt(int64(cfg.DeployConfig.L2ChainID)), l2Genesis, cfg.JWTFilePath) node, backend, err := initL2Geth(name, big.NewInt(int64(cfg.DeployConfig.L2ChainID)), l2Genesis, cfg.JWTFilePath)
if err != nil { if err != nil {
return nil, err return nil, err
} }
sys.nodes[name] = node sys.Nodes[name] = node
sys.backends[name] = backend sys.Backends[name] = backend
} }
// Start // Start
...@@ -325,7 +325,7 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -325,7 +325,7 @@ func (cfg SystemConfig) Start() (*System, error) {
didErrAfterStart = true didErrAfterStart = true
return nil, err return nil, err
} }
for name, node := range sys.nodes { for name, node := range sys.Nodes {
if name == "l1" { if name == "l1" {
continue continue
} }
...@@ -347,9 +347,9 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -347,9 +347,9 @@ func (cfg SystemConfig) Start() (*System, error) {
} }
for name, rollupCfg := range cfg.Nodes { for name, rollupCfg := range cfg.Nodes {
l2EndpointConfig := sys.nodes[name].WSAuthEndpoint() l2EndpointConfig := sys.Nodes[name].WSAuthEndpoint()
if useHTTP { if useHTTP {
l2EndpointConfig = sys.nodes[name].HTTPAuthEndpoint() l2EndpointConfig = sys.Nodes[name].HTTPAuthEndpoint()
} }
rollupCfg.L1 = &rollupNode.L1EndpointConfig{ rollupCfg.L1 = &rollupNode.L1EndpointConfig{
L1NodeAddr: l1EndpointConfig, L1NodeAddr: l1EndpointConfig,
...@@ -371,7 +371,7 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -371,7 +371,7 @@ func (cfg SystemConfig) Start() (*System, error) {
} }
l1Client := ethclient.NewClient(rpc.DialInProc(l1Srv)) l1Client := ethclient.NewClient(rpc.DialInProc(l1Srv))
sys.Clients["l1"] = l1Client sys.Clients["l1"] = l1Client
for name, node := range sys.nodes { for name, node := range sys.Nodes {
client, err := ethclient.DialContext(ctx, node.WSEndpoint()) client, err := ethclient.DialContext(ctx, node.WSEndpoint())
if err != nil { if err != nil {
didErrAfterStart = true didErrAfterStart = true
...@@ -459,7 +459,7 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -459,7 +459,7 @@ func (cfg SystemConfig) Start() (*System, error) {
didErrAfterStart = true didErrAfterStart = true
return nil, err return nil, err
} }
sys.rollupNodes[name] = node sys.RollupNodes[name] = node
} }
if cfg.P2PTopology != nil { if cfg.P2PTopology != nil {
...@@ -484,10 +484,10 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -484,10 +484,10 @@ func (cfg SystemConfig) Start() (*System, error) {
} }
// L2Output Submitter // L2Output Submitter
sys.l2OutputSubmitter, err = l2os.NewL2OutputSubmitter(l2os.Config{ sys.L2OutputSubmitter, err = l2os.NewL2OutputSubmitter(l2os.Config{
L1EthRpc: sys.nodes["l1"].WSEndpoint(), L1EthRpc: sys.Nodes["l1"].WSEndpoint(),
L2EthRpc: sys.nodes["sequencer"].WSEndpoint(), L2EthRpc: sys.Nodes["sequencer"].WSEndpoint(),
RollupRpc: sys.rollupNodes["sequencer"].HTTPEndpoint(), RollupRpc: sys.RollupNodes["sequencer"].HTTPEndpoint(),
L2OOAddress: predeploys.DevL2OutputOracleAddr.String(), L2OOAddress: predeploys.DevL2OutputOracleAddr.String(),
PollInterval: 50 * time.Millisecond, PollInterval: 50 * time.Millisecond,
NumConfirmations: 1, NumConfirmations: 1,
...@@ -503,15 +503,15 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -503,15 +503,15 @@ func (cfg SystemConfig) Start() (*System, error) {
return nil, fmt.Errorf("unable to setup l2 output submitter: %w", err) return nil, fmt.Errorf("unable to setup l2 output submitter: %w", err)
} }
if err := sys.l2OutputSubmitter.Start(); err != nil { if err := sys.L2OutputSubmitter.Start(); err != nil {
return nil, fmt.Errorf("unable to start l2 output submitter: %w", err) return nil, fmt.Errorf("unable to start l2 output submitter: %w", err)
} }
// Batch Submitter // Batch Submitter
sys.batchSubmitter, err = bss.NewBatchSubmitter(bss.Config{ sys.BatchSubmitter, err = bss.NewBatchSubmitter(bss.Config{
L1EthRpc: sys.nodes["l1"].WSEndpoint(), L1EthRpc: sys.Nodes["l1"].WSEndpoint(),
L2EthRpc: sys.nodes["sequencer"].WSEndpoint(), L2EthRpc: sys.Nodes["sequencer"].WSEndpoint(),
RollupRpc: sys.rollupNodes["sequencer"].HTTPEndpoint(), RollupRpc: sys.RollupNodes["sequencer"].HTTPEndpoint(),
MinL1TxSize: 1, MinL1TxSize: 1,
MaxL1TxSize: 120000, MaxL1TxSize: 120000,
ChannelTimeout: cfg.DeployConfig.ChannelTimeout, ChannelTimeout: cfg.DeployConfig.ChannelTimeout,
...@@ -530,7 +530,7 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -530,7 +530,7 @@ func (cfg SystemConfig) Start() (*System, error) {
return nil, fmt.Errorf("failed to setup batch submitter: %w", err) return nil, fmt.Errorf("failed to setup batch submitter: %w", err)
} }
if err := sys.batchSubmitter.Start(); err != nil { if err := sys.BatchSubmitter.Start(); err != nil {
return nil, fmt.Errorf("unable to start batch submitter: %w", err) return nil, fmt.Errorf("unable to start batch submitter: %w", err)
} }
......
...@@ -55,7 +55,7 @@ func TestL2OutputSubmitter(t *testing.T) { ...@@ -55,7 +55,7 @@ func TestL2OutputSubmitter(t *testing.T) {
l1Client := sys.Clients["l1"] l1Client := sys.Clients["l1"]
rollupRPCClient, err := rpc.DialContext(context.Background(), sys.rollupNodes["sequencer"].HTTPEndpoint()) rollupRPCClient, err := rpc.DialContext(context.Background(), sys.RollupNodes["sequencer"].HTTPEndpoint())
require.Nil(t, err) require.Nil(t, err)
rollupClient := sources.NewRollupClient(rollupRPCClient) rollupClient := sources.NewRollupClient(rollupRPCClient)
...@@ -210,7 +210,7 @@ func TestSystemE2E(t *testing.T) { ...@@ -210,7 +210,7 @@ func TestSystemE2E(t *testing.T) {
require.Equal(t, verifBlock.ParentHash(), seqBlock.ParentHash(), "Verifier and sequencer blocks parent hashes not the same after including a batch tx") require.Equal(t, verifBlock.ParentHash(), seqBlock.ParentHash(), "Verifier and sequencer blocks parent hashes not the same after including a batch tx")
require.Equal(t, verifBlock.Hash(), seqBlock.Hash(), "Verifier and sequencer blocks not the same after including a batch tx") require.Equal(t, verifBlock.Hash(), seqBlock.Hash(), "Verifier and sequencer blocks not the same after including a batch tx")
rollupRPCClient, err := rpc.DialContext(context.Background(), sys.rollupNodes["sequencer"].HTTPEndpoint()) rollupRPCClient, err := rpc.DialContext(context.Background(), sys.RollupNodes["sequencer"].HTTPEndpoint())
require.Nil(t, err) require.Nil(t, err)
rollupClient := sources.NewRollupClient(rollupRPCClient) rollupClient := sources.NewRollupClient(rollupRPCClient)
// basic check that sync status works // basic check that sync status works
...@@ -317,7 +317,7 @@ func TestMintOnRevertedDeposit(t *testing.T) { ...@@ -317,7 +317,7 @@ func TestMintOnRevertedDeposit(t *testing.T) {
// Find deposit contract // Find deposit contract
depositContract, err := bindings.NewOptimismPortal(predeploys.DevOptimismPortalAddr, l1Client) depositContract, err := bindings.NewOptimismPortal(predeploys.DevOptimismPortalAddr, l1Client)
require.Nil(t, err) require.Nil(t, err)
l1Node := sys.nodes["l1"] l1Node := sys.Nodes["l1"]
// create signer // create signer
ks := l1Node.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore) ks := l1Node.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
...@@ -790,7 +790,7 @@ func TestWithdrawals(t *testing.T) { ...@@ -790,7 +790,7 @@ func TestWithdrawals(t *testing.T) {
header, err = l2Verif.HeaderByNumber(ctx, new(big.Int).SetUint64(blockNumber)) header, err = l2Verif.HeaderByNumber(ctx, new(big.Int).SetUint64(blockNumber))
require.Nil(t, err) require.Nil(t, err)
rpc, err := rpc.Dial(sys.nodes["verifier"].WSEndpoint()) rpc, err := rpc.Dial(sys.Nodes["verifier"].WSEndpoint())
require.Nil(t, err) require.Nil(t, err)
l2client := withdrawals.NewClient(rpc) l2client := withdrawals.NewClient(rpc)
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"regexp" "regexp"
"github.com/ethereum-optimism/optimism/op-node/backoff" "github.com/ethereum-optimism/optimism/op-service/backoff"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
......
...@@ -5,8 +5,9 @@ go 1.18 ...@@ -5,8 +5,9 @@ go 1.18
require ( require (
github.com/btcsuite/btcd/btcec/v2 v2.2.0 github.com/btcsuite/btcd/btcec/v2 v2.2.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 github.com/ethereum-optimism/optimism/op-bindings v0.8.10
github.com/ethereum-optimism/optimism/op-chain-ops v0.8.9 github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10
github.com/ethereum-optimism/optimism/op-service v0.8.10
github.com/ethereum/go-ethereum v1.10.23 github.com/ethereum/go-ethereum v1.10.23
github.com/golang/snappy v0.0.4 github.com/golang/snappy v0.0.4
github.com/google/go-cmp v0.5.8 github.com/google/go-cmp v0.5.8
......
...@@ -190,10 +190,12 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m ...@@ -190,10 +190,12 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 h1:QeYLhgZP0QkDLxyXhkWLj/iHDFkMNI18abgrHL4I9TE= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum-optimism/optimism/op-chain-ops v0.8.9 h1:Z8174lRVnvw1r8w0OS0vOrFXcAg6635WuqHObZSJzKs= github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10 h1:ErDuEO7Dsd7+XXlTWToBN/388IgC8eXjAPgiHoXviw4=
github.com/ethereum-optimism/optimism/op-chain-ops v0.8.9/go.mod h1:Y+on77cEP5Kn6Jc2aX24d3zk2lvT76KaUlTQSn7zesU= github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10/go.mod h1:a9/PrzVU8EHKlLr6yz4YXw2VhEHYrbVogX56r26VUrY=
github.com/ethereum-optimism/optimism/op-service v0.8.10 h1:K3IABHI1b0MDrDXALvTKTbzy6IogGD6NgmbqfKEcEwM=
github.com/ethereum-optimism/optimism/op-service v0.8.10/go.mod h1:K0uybOhICTc2yfhrRj0cD1m7aPkOf5C9e6bUmvf4rGA=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ= github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ=
github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
......
...@@ -8,15 +8,16 @@ import ( ...@@ -8,15 +8,16 @@ import (
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/client" "github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/metrics" "github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/p2p" "github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver" "github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/sources" "github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
) )
type OpNode struct { type OpNode struct {
...@@ -220,11 +221,8 @@ func (n *OpNode) initP2PSigner(ctx context.Context, cfg *Config) error { ...@@ -220,11 +221,8 @@ func (n *OpNode) initP2PSigner(ctx context.Context, cfg *Config) error {
func (n *OpNode) Start(ctx context.Context) error { func (n *OpNode) Start(ctx context.Context) error {
n.log.Info("Starting execution engine driver") n.log.Info("Starting execution engine driver")
// Request initial head update, default to genesis otherwise
reqCtx, reqCancel := context.WithTimeout(ctx, time.Second*10)
// start driving engine: sync blocks by deriving them from L1 and driving them into the engine // start driving engine: sync blocks by deriving them from L1 and driving them into the engine
err := n.l2Driver.Start(reqCtx) err := n.l2Driver.Start()
reqCancel()
if err != nil { if err != nil {
n.log.Error("Could not start a rollup node", "err", err) n.log.Error("Could not start a rollup node", "err", err)
return err return err
......
...@@ -3,7 +3,6 @@ package derive ...@@ -3,7 +3,6 @@ package derive
import ( import (
"context" "context"
"fmt" "fmt"
"io"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
...@@ -15,7 +14,7 @@ import ( ...@@ -15,7 +14,7 @@ import (
// L1ReceiptsFetcher fetches L1 header info and receipts for the payload attributes derivation (the info tx and deposits) // L1ReceiptsFetcher fetches L1 header info and receipts for the payload attributes derivation (the info tx and deposits)
type L1ReceiptsFetcher interface { type L1ReceiptsFetcher interface {
InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error) InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
Fetch(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Transactions, eth.ReceiptsFetcher, error) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
} }
// PreparePayloadAttributes prepares a PayloadAttributes template that is ready to build a L2 block with deposits only, on top of the given l2Parent, with the given epoch as L1 origin. // PreparePayloadAttributes prepares a PayloadAttributes template that is ready to build a L2 block with deposits only, on top of the given l2Parent, with the given epoch as L1 origin.
...@@ -32,7 +31,7 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece ...@@ -32,7 +31,7 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece
// case we need to fetch all transaction receipts from the L1 origin block so we can scan for // case we need to fetch all transaction receipts from the L1 origin block so we can scan for
// user deposits. // user deposits.
if l2Parent.L1Origin.Number != epoch.Number { if l2Parent.L1Origin.Number != epoch.Number {
info, _, receiptsFetcher, err := dl.Fetch(ctx, epoch.Hash) info, receipts, err := dl.FetchReceipts(ctx, epoch.Hash)
if err != nil { if err != nil {
return nil, NewTemporaryError(fmt.Errorf("failed to fetch L1 block info and receipts: %w", err)) return nil, NewTemporaryError(fmt.Errorf("failed to fetch L1 block info and receipts: %w", err))
} }
...@@ -41,17 +40,7 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece ...@@ -41,17 +40,7 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece
fmt.Errorf("cannot create new block with L1 origin %s (parent %s) on top of L1 origin %s", fmt.Errorf("cannot create new block with L1 origin %s (parent %s) on top of L1 origin %s",
epoch, info.ParentHash(), l2Parent.L1Origin)) epoch, info.ParentHash(), l2Parent.L1Origin))
} }
for {
if err := receiptsFetcher.Fetch(ctx); err == io.EOF {
break
} else if err != nil {
return nil, NewTemporaryError(fmt.Errorf("failed to fetch more receipts: %w", err))
}
}
receipts, err := receiptsFetcher.Result()
if err != nil {
return nil, NewResetError(fmt.Errorf("fetched bad receipt data: %w", err))
}
deposits, err := DeriveDeposits(receipts, cfg.DepositContractAddress) deposits, err := DeriveDeposits(receipts, cfg.DepositContractAddress)
if err != nil { if err != nil {
// deposits may never be ignored. Failing to process them is a critical error. // deposits may never be ignored. Failing to process them is a critical error.
......
...@@ -36,7 +36,7 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Info := testutils.RandomBlockInfo(rng) l1Info := testutils.RandomBlockInfo(rng)
l1Info.InfoNum = l2Parent.L1Origin.Number + 1 l1Info.InfoNum = l2Parent.L1Origin.Number + 1
epoch := l1Info.ID() epoch := l1Info.ID()
l1Fetcher.ExpectFetch(epoch.Hash, l1Info, nil, nil, nil) l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, nil, nil)
_, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) _, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch)
require.NotNil(t, err, "inconsistent L1 origin error expected") require.NotNil(t, err, "inconsistent L1 origin error expected")
require.ErrorIs(t, err, ErrReset, "inconsistent L1 origin transition must be handled like a critical error with reorg") require.ErrorIs(t, err, ErrReset, "inconsistent L1 origin transition must be handled like a critical error with reorg")
...@@ -63,7 +63,7 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -63,7 +63,7 @@ func TestPreparePayloadAttributes(t *testing.T) {
epoch := l2Parent.L1Origin epoch := l2Parent.L1Origin
epoch.Number += 1 epoch.Number += 1
mockRPCErr := errors.New("mock rpc error") mockRPCErr := errors.New("mock rpc error")
l1Fetcher.ExpectFetch(epoch.Hash, nil, nil, nil, mockRPCErr) l1Fetcher.ExpectFetchReceipts(epoch.Hash, nil, nil, mockRPCErr)
_, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) _, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch)
require.ErrorIs(t, err, mockRPCErr, "mock rpc error expected") require.ErrorIs(t, err, mockRPCErr, "mock rpc error expected")
require.ErrorIs(t, err, ErrTemporary, "rpc errors should not be critical, it is not necessary to reorg") require.ErrorIs(t, err, ErrTemporary, "rpc errors should not be critical, it is not necessary to reorg")
...@@ -93,7 +93,7 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -93,7 +93,7 @@ func TestPreparePayloadAttributes(t *testing.T) {
epoch := l1Info.ID() epoch := l1Info.ID()
l1InfoTx, err := L1InfoDepositBytes(0, l1Info) l1InfoTx, err := L1InfoDepositBytes(0, l1Info)
require.NoError(t, err) require.NoError(t, err)
l1Fetcher.ExpectFetch(epoch.Hash, l1Info, nil, nil, nil) l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, nil, nil)
attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, attrs) require.NotNil(t, attrs)
...@@ -129,9 +129,7 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -129,9 +129,7 @@ func TestPreparePayloadAttributes(t *testing.T) {
l2Txs := append(append(make([]eth.Data, 0), l1InfoTx), usedDepositTxs...) l2Txs := append(append(make([]eth.Data, 0), l1InfoTx), usedDepositTxs...)
// txs are ignored, API is a bit bloated to previous approach. Only l1Info and receipts matter. l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, receipts, nil)
l1Txs := make(types.Transactions, len(receipts))
l1Fetcher.ExpectFetch(epoch.Hash, l1Info, l1Txs, receipts, nil)
attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, attrs) require.NotNil(t, attrs)
......
...@@ -3,18 +3,14 @@ package driver ...@@ -3,18 +3,14 @@ package driver
import ( import (
"context" "context"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive" "github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
) )
type Driver struct {
s *state
}
type Metrics interface { type Metrics interface {
RecordPipelineReset() RecordPipelineReset()
RecordSequencingError() RecordSequencingError()
...@@ -34,11 +30,6 @@ type Metrics interface { ...@@ -34,11 +30,6 @@ type Metrics interface {
CountSequencedTxs(count int) CountSequencedTxs(count int)
} }
type Downloader interface {
InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
Fetch(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Transactions, eth.ReceiptsFetcher, error)
}
type L1Chain interface { type L1Chain interface {
derive.L1Fetcher derive.L1Fetcher
L1BlockRefByLabel(context.Context, eth.BlockLabel) (eth.L1BlockRef, error) L1BlockRefByLabel(context.Context, eth.BlockLabel) (eth.L1BlockRef, error)
...@@ -62,58 +53,61 @@ type DerivationPipeline interface { ...@@ -62,58 +53,61 @@ type DerivationPipeline interface {
Origin() eth.L1BlockRef Origin() eth.L1BlockRef
} }
type outputInterface interface { type L1StateIface interface {
// createNewBlock builds a new block based on the L2 Head, L1 Origin, and the current mempool. HandleNewL1HeadBlock(head eth.L1BlockRef)
createNewBlock(ctx context.Context, l2Head eth.L2BlockRef, l2SafeHead eth.BlockID, l2Finalized eth.BlockID, l1Origin eth.L1BlockRef) (eth.L2BlockRef, *eth.ExecutionPayload, error) HandleNewL1SafeBlock(safe eth.L1BlockRef)
} HandleNewL1FinalizedBlock(finalized eth.L1BlockRef)
type Network interface {
// PublishL2Payload is called by the driver whenever there is a new payload to publish, synchronously with the driver main loop.
PublishL2Payload(ctx context.Context, payload *eth.ExecutionPayload) error
}
func NewDriver(driverCfg *Config, cfg *rollup.Config, l2 L2Chain, l1 L1Chain, network Network, log log.Logger, snapshotLog log.Logger, metrics Metrics) *Driver {
output := &outputImpl{
Config: cfg,
dl: l1,
l2: l2,
log: log,
}
var state *state
verifConfDepth := NewConfDepth(driverCfg.VerifierConfDepth, func() eth.L1BlockRef { return state.l1Head }, l1)
derivationPipeline := derive.NewDerivationPipeline(log, cfg, verifConfDepth, l2, metrics)
state = NewState(driverCfg, log, snapshotLog, cfg, l1, l2, output, derivationPipeline, network, metrics)
return &Driver{s: state}
}
func (d *Driver) OnL1Head(ctx context.Context, head eth.L1BlockRef) error { L1Head() eth.L1BlockRef
return d.s.OnL1Head(ctx, head) L1Safe() eth.L1BlockRef
L1Finalized() eth.L1BlockRef
} }
func (d *Driver) OnL1Safe(ctx context.Context, safe eth.L1BlockRef) error { type L1OriginSelectorIface interface {
return d.s.OnL1Safe(ctx, safe) FindL1Origin(ctx context.Context, l1Head eth.L1BlockRef, l2Head eth.L2BlockRef) (eth.L1BlockRef, error)
} }
func (d *Driver) OnL1Finalized(ctx context.Context, finalized eth.L1BlockRef) error { type SequencerIface interface {
return d.s.OnL1Finalized(ctx, finalized) StartBuildingBlock(ctx context.Context, l2Head eth.L2BlockRef, l2SafeHead eth.BlockID, l2Finalized eth.BlockID, l1Origin eth.L1BlockRef) error
} CompleteBuildingBlock(ctx context.Context) (*eth.ExecutionPayload, error)
func (d *Driver) OnUnsafeL2Payload(ctx context.Context, payload *eth.ExecutionPayload) error { // createNewBlock builds a new block based on the L2 Head, L1 Origin, and the current mempool.
return d.s.OnUnsafeL2Payload(ctx, payload) CreateNewBlock(ctx context.Context, l2Head eth.L2BlockRef, l2SafeHead eth.BlockID, l2Finalized eth.BlockID, l1Origin eth.L1BlockRef) (eth.L2BlockRef, *eth.ExecutionPayload, error)
} }
func (d *Driver) ResetDerivationPipeline(ctx context.Context) error { type Network interface {
return d.s.ResetDerivationPipeline(ctx) // PublishL2Payload is called by the driver whenever there is a new payload to publish, synchronously with the driver main loop.
PublishL2Payload(ctx context.Context, payload *eth.ExecutionPayload) error
} }
func (d *Driver) SyncStatus(ctx context.Context) (*eth.SyncStatus, error) { // NewDriver composes an events handler that tracks L1 state, triggers L2 derivation, and optionally sequences new L2 blocks.
return d.s.SyncStatus(ctx) func NewDriver(driverCfg *Config, cfg *rollup.Config, l2 L2Chain, l1 L1Chain, network Network, log log.Logger, snapshotLog log.Logger, metrics Metrics) *Driver {
} sequencer := NewSequencer(log, cfg, l1, l2)
l1State := NewL1State(log, metrics)
findL1Origin := NewL1OriginSelector(log, cfg, l1, driverCfg.SequencerConfDepth)
verifConfDepth := NewConfDepth(driverCfg.VerifierConfDepth, l1State.L1Head, l1)
derivationPipeline := derive.NewDerivationPipeline(log, cfg, verifConfDepth, l2, metrics)
func (d *Driver) Start(ctx context.Context) error { return &Driver{
return d.s.Start(ctx) l1State: l1State,
} derivation: derivationPipeline,
func (d *Driver) Close() error { idleDerivation: false,
return d.s.Close() syncStatusReq: make(chan chan eth.SyncStatus, 10),
forceReset: make(chan chan struct{}, 10),
config: cfg,
driverConfig: driverCfg,
done: make(chan struct{}),
log: log,
snapshotLog: snapshotLog,
l1: l1,
l2: l2,
l1OriginSelector: findL1Origin,
sequencer: sequencer,
network: network,
metrics: metrics,
l1HeadSig: make(chan eth.L1BlockRef, 10),
l1SafeSig: make(chan eth.L1BlockRef, 10),
l1FinalizedSig: make(chan eth.L1BlockRef, 10),
unsafeL2Payloads: make(chan *eth.ExecutionPayload, 10),
}
} }
package driver
import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
)
type L1Metrics interface {
RecordL1ReorgDepth(d uint64)
RecordL1Ref(name string, ref eth.L1BlockRef)
}
// L1State tracks L1 head, safe and finalized blocks. It is not safe to write and read concurrently.
type L1State struct {
log log.Logger
metrics L1Metrics
// Latest recorded head, safe block and finalized block of the L1 Chain, independent of derivation work
l1Head eth.L1BlockRef
l1Safe eth.L1BlockRef
l1Finalized eth.L1BlockRef
}
func NewL1State(log log.Logger, metrics L1Metrics) *L1State {
return &L1State{
log: log,
metrics: metrics,
}
}
func (s *L1State) HandleNewL1HeadBlock(head eth.L1BlockRef) {
// We don't need to do anything if the head hasn't changed.
if s.l1Head == (eth.L1BlockRef{}) {
s.log.Info("Received first L1 head signal", "l1_head", head)
} else if s.l1Head.Hash == head.Hash {
s.log.Trace("Received L1 head signal that is the same as the current head", "l1_head", head)
} else if s.l1Head.Hash == head.ParentHash {
// We got a new L1 block whose parent hash is the same as the current L1 head. Means we're
// dealing with a linear extension (new block is the immediate child of the old one).
s.log.Debug("L1 head moved forward", "l1_head", head)
} else {
if s.l1Head.Number >= head.Number {
s.metrics.RecordL1ReorgDepth(s.l1Head.Number - head.Number)
}
// New L1 block is not the same as the current head or a single step linear extension.
// This could either be a long L1 extension, or a reorg, or we simply missed a head update.
s.log.Warn("L1 head signal indicates a possible L1 re-org", "old_l1_head", s.l1Head, "new_l1_head_parent", head.ParentHash, "new_l1_head", head)
}
s.metrics.RecordL1Ref("l1_head", head)
s.l1Head = head
}
func (s *L1State) HandleNewL1SafeBlock(safe eth.L1BlockRef) {
s.log.Info("New L1 safe block", "l1_safe", safe)
s.metrics.RecordL1Ref("l1_safe", safe)
s.l1Safe = safe
}
func (s *L1State) HandleNewL1FinalizedBlock(finalized eth.L1BlockRef) {
s.log.Info("New L1 finalized block", "l1_finalized", finalized)
s.metrics.RecordL1Ref("l1_finalized", finalized)
s.l1Finalized = finalized
}
func (s *L1State) L1Head() eth.L1BlockRef {
return s.l1Head
}
func (s *L1State) L1Safe() eth.L1BlockRef {
return s.l1Safe
}
func (s *L1State) L1Finalized() eth.L1BlockRef {
return s.l1Finalized
}
package driver
import (
"context"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
)
type L1Blocks interface {
derive.L1BlockRefByHashFetcher
derive.L1BlockRefByNumberFetcher
}
type L1OriginSelector struct {
log log.Logger
cfg *rollup.Config
l1 L1Blocks
sequencingConfDepth uint64
}
func NewL1OriginSelector(log log.Logger, cfg *rollup.Config, l1 L1Blocks, sequencingConfDepth uint64) *L1OriginSelector {
return &L1OriginSelector{
log: log,
cfg: cfg,
l1: l1,
sequencingConfDepth: sequencingConfDepth,
}
}
// FindL1Origin determines what the next L1 Origin should be.
// The L1 Origin is either the L2 Head's Origin, or the following L1 block
// if the next L2 block's time is greater than or equal to the L2 Head's Origin.
func (los *L1OriginSelector) FindL1Origin(ctx context.Context, l1Head eth.L1BlockRef, l2Head eth.L2BlockRef) (eth.L1BlockRef, error) {
// If we are at the head block, don't do a lookup.
if l2Head.L1Origin.Hash == l1Head.Hash {
return l1Head, nil
}
// Grab a reference to the current L1 origin block.
currentOrigin, err := los.l1.L1BlockRefByHash(ctx, l2Head.L1Origin.Hash)
if err != nil {
return eth.L1BlockRef{}, err
}
if currentOrigin.Number+1+los.sequencingConfDepth > l1Head.Number {
// TODO: we can decide to ignore confirmation depth if we would be forced
// to make an empty block (only deposits) by staying on the current origin.
log.Info("sequencing with old origin to preserve conf depth",
"current", currentOrigin, "current_time", currentOrigin.Time,
"l1_head", l1Head, "l1_head_time", l1Head.Time,
"l2_head", l2Head, "l2_head_time", l2Head.Time,
"depth", los.sequencingConfDepth)
return currentOrigin, nil
}
// Attempt to find the next L1 origin block, where the next origin is the immediate child of
// the current origin block.
nextOrigin, err := los.l1.L1BlockRefByNumber(ctx, currentOrigin.Number+1)
if err != nil {
log.Error("Failed to get next origin. Falling back to current origin", "err", err)
return currentOrigin, nil
}
// If the next L2 block time is greater than the next origin block's time, we can choose to
// start building on top of the next origin. Sequencer implementation has some leeway here and
// could decide to continue to build on top of the previous origin until the Sequencer runs out
// of slack. For simplicity, we implement our Sequencer to always start building on the latest
// L1 block when we can.
if l2Head.Time+los.cfg.BlockTime >= nextOrigin.Time {
return nextOrigin, nil
}
return currentOrigin, nil
}
package driver
import (
"context"
"fmt"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
)
type Downloader interface {
InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
}
// Sequencer implements the sequencing interface of the driver: it starts and completes block building jobs.
type Sequencer struct {
log log.Logger
config *rollup.Config
l1 Downloader
l2 derive.Engine
buildingOnto eth.ForkchoiceState
buildingID eth.PayloadID
}
func NewSequencer(log log.Logger, cfg *rollup.Config, l1 Downloader, l2 derive.Engine) *Sequencer {
return &Sequencer{
log: log,
config: cfg,
l1: l1,
l2: l2,
}
}
// StartBuildingBlock initiates a block building job on top of the given L2 head, safe and finalized blocks, and using the provided l1Origin.
func (d *Sequencer) StartBuildingBlock(ctx context.Context, l2Head eth.L2BlockRef, l2SafeHead eth.BlockID, l2Finalized eth.BlockID, l1Origin eth.L1BlockRef) error {
d.log.Info("creating new block", "parent", l2Head, "l1Origin", l1Origin)
if d.buildingID != (eth.PayloadID{}) { // This may happen when we decide to build a different block in response to a reorg. Or when previous block building failed.
d.log.Warn("did not finish previous block building, starting new building now", "prev_onto", d.buildingOnto.HeadBlockHash, "prev_payload_id", d.buildingID, "new_onto", l2Head)
}
fetchCtx, cancel := context.WithTimeout(ctx, time.Second*20)
defer cancel()
attrs, err := derive.PreparePayloadAttributes(fetchCtx, d.config, d.l1, l2Head, l2Head.Time+d.config.BlockTime, l1Origin.ID())
if err != nil {
return err
}
// If our next L2 block timestamp is beyond the Sequencer drift threshold, then we must produce
// empty blocks (other than the L1 info deposit and any user deposits). We handle this by
// setting NoTxPool to true, which will cause the Sequencer to not include any transactions
// from the transaction pool.
attrs.NoTxPool = uint64(attrs.Timestamp) >= l1Origin.Time+d.config.MaxSequencerDrift
// And construct our fork choice state. This is our current fork choice state and will be
// updated as a result of executing the block based on the attributes described above.
fc := eth.ForkchoiceState{
HeadBlockHash: l2Head.Hash,
SafeBlockHash: l2SafeHead.Hash,
FinalizedBlockHash: l2Finalized.Hash,
}
// Start a payload building process.
id, errTyp, err := derive.StartPayload(ctx, d.l2, fc, attrs)
if err != nil {
return fmt.Errorf("failed to start building on top of L2 chain %s, error (%d): %w", l2Head, errTyp, err)
}
d.buildingOnto = fc
d.buildingID = id
return nil
}
// CompleteBuildingBlock takes the current block that is being built, and asks the engine to complete the building, seal the block, and persist it as canonical.
// Warning: the safe and finalized L2 blocks as viewed during the initiation of the block building are reused for completion of the block building.
// The Execution engine should not change the safe and finalized blocks between start and completion of block building.
func (d *Sequencer) CompleteBuildingBlock(ctx context.Context) (*eth.ExecutionPayload, error) {
if d.buildingID == (eth.PayloadID{}) {
return nil, fmt.Errorf("cannot complete payload building: not currently building a payload")
}
// Actually execute the block and add it to the head of the chain.
payload, errTyp, err := derive.ConfirmPayload(ctx, d.log, d.l2, d.buildingOnto, d.buildingID, false)
if err != nil {
return nil, fmt.Errorf("failed to complete building on top of L2 chain %s, error (%d): %w", d.buildingOnto.HeadBlockHash, errTyp, err)
}
return payload, nil
}
// CreateNewBlock sequences a L2 block with immediate building and sealing.
func (d *Sequencer) CreateNewBlock(ctx context.Context, l2Head eth.L2BlockRef, l2SafeHead eth.BlockID, l2Finalized eth.BlockID, l1Origin eth.L1BlockRef) (eth.L2BlockRef, *eth.ExecutionPayload, error) {
if err := d.StartBuildingBlock(ctx, l2Head, l2SafeHead, l2Finalized, l1Origin); err != nil {
return l2Head, nil, err
}
payload, err := d.CompleteBuildingBlock(ctx)
if err != nil {
return l2Head, nil, err
}
d.buildingID = eth.PayloadID{}
// Generate an L2 block ref from the payload.
ref, err := derive.PayloadToBlockRef(payload, &d.config.Genesis)
return ref, payload, err
}
This diff is collapsed.
package driver
import (
"context"
"fmt"
"time"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/log"
)
type outputImpl struct {
dl Downloader
l2 derive.Engine
log log.Logger
Config *rollup.Config
}
func (d *outputImpl) createNewBlock(ctx context.Context, l2Head eth.L2BlockRef, l2SafeHead eth.BlockID, l2Finalized eth.BlockID, l1Origin eth.L1BlockRef) (eth.L2BlockRef, *eth.ExecutionPayload, error) {
d.log.Info("creating new block", "parent", l2Head, "l1Origin", l1Origin)
fetchCtx, cancel := context.WithTimeout(ctx, time.Second*20)
defer cancel()
attrs, err := derive.PreparePayloadAttributes(fetchCtx, d.Config, d.dl, l2Head, l2Head.Time+d.Config.BlockTime, l1Origin.ID())
if err != nil {
return l2Head, nil, err
}
// If our next L2 block timestamp is beyond the Sequencer drift threshold, then we must produce
// empty blocks (other than the L1 info deposit and any user deposits). We handle this by
// setting NoTxPool to true, which will cause the Sequencer to not include any transactions
// from the transaction pool.
attrs.NoTxPool = uint64(attrs.Timestamp) >= l1Origin.Time+d.Config.MaxSequencerDrift
// And construct our fork choice state. This is our current fork choice state and will be
// updated as a result of executing the block based on the attributes described above.
fc := eth.ForkchoiceState{
HeadBlockHash: l2Head.Hash,
SafeBlockHash: l2SafeHead.Hash,
FinalizedBlockHash: l2Finalized.Hash,
}
// Actually execute the block and add it to the head of the chain.
payload, errType, err := derive.InsertHeadBlock(ctx, d.log, d.l2, fc, attrs, false)
if err != nil {
return l2Head, nil, fmt.Errorf("failed to extend L2 chain, error (%d): %w", errType, err)
}
// Generate an L2 block ref from the payload.
ref, err := derive.PayloadToBlockRef(payload, &d.Config.Genesis)
return ref, payload, err
}
...@@ -3,6 +3,7 @@ package sources ...@@ -3,6 +3,7 @@ package sources
import ( import (
"context" "context"
"fmt" "fmt"
"io"
"github.com/ethereum-optimism/optimism/op-node/client" "github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
...@@ -80,7 +81,8 @@ type EthClient struct { ...@@ -80,7 +81,8 @@ type EthClient struct {
log log.Logger log log.Logger
// cache receipts in bundles per block hash // cache receipts in bundles per block hash
// common.Hash -> types.Receipts // We cache the receipts fetcher to not lose progress when we have to retry the `Fetch` call
// common.Hash -> eth.ReceiptsFetcher
receiptsCache *caching.LRUCache receiptsCache *caching.LRUCache
// cache transactions in bundles per block hash // cache transactions in bundles per block hash
...@@ -230,21 +232,42 @@ func (s *EthClient) PayloadByLabel(ctx context.Context, label eth.BlockLabel) (* ...@@ -230,21 +232,42 @@ func (s *EthClient) PayloadByLabel(ctx context.Context, label eth.BlockLabel) (*
return s.payloadCall(ctx, "eth_getBlockByNumber", string(label)) return s.payloadCall(ctx, "eth_getBlockByNumber", string(label))
} }
func (s *EthClient) Fetch(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Transactions, eth.ReceiptsFetcher, error) { // FetchReceipts returns a block info and all of the receipts associated with transactions in the block.
// It verifies the receipt hash in the block header against the receipt hash of the fetched receipts
// to ensure that the execution engine did not fail to return any receipts.
func (s *EthClient) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error) {
info, txs, err := s.InfoAndTxsByHash(ctx, blockHash) info, txs, err := s.InfoAndTxsByHash(ctx, blockHash)
if err != nil { if err != nil {
return nil, nil, nil, err return nil, nil, err
} }
// Try to reuse the receipts fetcher because is caches the results of intermediate calls. This means
// that if just one of many calls fail, we only retry the failed call rather than all of the calls.
// The underlying fetcher uses the receipts hash to verify receipt integrity.
var fetcher eth.ReceiptsFetcher
if v, ok := s.receiptsCache.Get(blockHash); ok { if v, ok := s.receiptsCache.Get(blockHash); ok {
return info, txs, v.(eth.ReceiptsFetcher), nil fetcher = v.(eth.ReceiptsFetcher)
} else {
txHashes := make([]common.Hash, len(txs))
for i := 0; i < len(txs); i++ {
txHashes[i] = txs[i].Hash()
}
fetcher = NewReceiptsFetcher(info.ID(), info.ReceiptHash(), txHashes, s.client.BatchCallContext, s.maxBatchSize)
s.receiptsCache.Add(blockHash, fetcher)
} }
txHashes := make([]common.Hash, len(txs)) // Fetch all receipts
for i := 0; i < len(txs); i++ { for {
txHashes[i] = txs[i].Hash() if err := fetcher.Fetch(ctx); err == io.EOF {
break
} else if err != nil {
return nil, nil, err
}
} }
r := NewReceiptsFetcher(info.ID(), info.ReceiptHash(), txHashes, s.client.BatchCallContext, s.maxBatchSize) receipts, err := fetcher.Result()
s.receiptsCache.Add(blockHash, r) if err != nil {
return info, txs, r, nil return nil, nil, err
}
return info, receipts, nil
} }
func (s *EthClient) GetProof(ctx context.Context, address common.Address, blockTag string) (*eth.AccountResult, error) { func (s *EthClient) GetProof(ctx context.Context, address common.Address, blockTag string) (*eth.AccountResult, error) {
......
...@@ -105,13 +105,13 @@ func (m *MockEthClient) ExpectPayloadByLabel(label eth.BlockLabel, payload *eth. ...@@ -105,13 +105,13 @@ func (m *MockEthClient) ExpectPayloadByLabel(label eth.BlockLabel, payload *eth.
m.Mock.On("PayloadByLabel", label).Once().Return(payload, &err) m.Mock.On("PayloadByLabel", label).Once().Return(payload, &err)
} }
func (m *MockEthClient) Fetch(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Transactions, eth.ReceiptsFetcher, error) { func (m *MockEthClient) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error) {
out := m.Mock.MethodCalled("Fetch", blockHash) out := m.Mock.MethodCalled("FetchReceipts", blockHash)
return *out[0].(*eth.BlockInfo), out[1].(types.Transactions), out[2].(eth.ReceiptsFetcher), *out[3].(*error) return *out[0].(*eth.BlockInfo), out[1].(types.Receipts), *out[2].(*error)
} }
func (m *MockEthClient) ExpectFetch(hash common.Hash, info eth.BlockInfo, transactions types.Transactions, receipts types.Receipts, err error) { func (m *MockEthClient) ExpectFetchReceipts(hash common.Hash, info eth.BlockInfo, receipts types.Receipts, err error) {
m.Mock.On("Fetch", hash).Once().Return(&info, transactions, eth.FetchedReceipts(receipts), &err) m.Mock.On("FetchReceipts", hash).Once().Return(&info, receipts, &err)
} }
func (m *MockEthClient) GetProof(ctx context.Context, address common.Address, blockTag string) (*eth.AccountResult, error) { func (m *MockEthClient) GetProof(ctx context.Context, address common.Address, blockTag string) (*eth.AccountResult, error) {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
{ {
"address": "0x4200000000000000000000000000000000000016", "address": "0x4200000000000000000000000000000000000016",
"topics": [ "topics": [
"0x87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a6136", "0x7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d72",
"0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000004200000000000000000000000000000000000007", "0x0000000000000000000000004200000000000000000000000000000000000007",
"0x0000000000000000000000006900000000000000000000000000000000000002" "0x0000000000000000000000006900000000000000000000000000000000000002"
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
{ {
"address": "0x4200000000000000000000000000000000000016", "address": "0x4200000000000000000000000000000000000016",
"topics": [ "topics": [
"0x2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb", "0xedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c",
"0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285" "0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"
], ],
"data": "0x", "data": "0x",
...@@ -131,4 +131,4 @@ ...@@ -131,4 +131,4 @@
"blockHash": "0xfdd4ad8a984b45687aca0463db491cbd0e85273d970019a3f8bf618b614938df", "blockHash": "0xfdd4ad8a984b45687aca0463db491cbd0e85273d970019a3f8bf618b614938df",
"blockNumber": "0x36", "blockNumber": "0x36",
"transactionIndex": "0x1" "transactionIndex": "0x1"
} }
\ No newline at end of file
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
) )
var WithdrawalInitiatedTopic = crypto.Keccak256Hash([]byte("WithdrawalInitiated(uint256,address,address,uint256,uint256,bytes)")) var MessagePassedTopic = crypto.Keccak256Hash([]byte("MessagePassed(uint256,address,address,uint256,uint256,bytes)"))
var WithdrawalInitiatedExtension1Topic = crypto.Keccak256Hash([]byte("WithdrawalInitiatedExtension1(bytes32)")) var MessagePassedExtension1Topic = crypto.Keccak256Hash([]byte("MessagePassedExtension1(bytes32)"))
// WaitForFinalizationPeriod waits until there is OutputProof for an L2 block number larger than the supplied l2BlockNumber // WaitForFinalizationPeriod waits until there is OutputProof for an L2 block number larger than the supplied l2BlockNumber
// and that the output is finalized. // and that the output is finalized.
...@@ -172,11 +172,11 @@ func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txH ...@@ -172,11 +172,11 @@ func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txH
return FinalizedWithdrawalParameters{}, err return FinalizedWithdrawalParameters{}, err
} }
// Parse the receipt // Parse the receipt
ev, err := ParseWithdrawalInitiated(receipt) ev, err := ParseMessagePassed(receipt)
if err != nil { if err != nil {
return FinalizedWithdrawalParameters{}, err return FinalizedWithdrawalParameters{}, err
} }
ev1, err := ParseWithdrawalInitiatedExtension1(receipt) ev1, err := ParseMessagePassedExtension1(receipt)
if err != nil { if err != nil {
return FinalizedWithdrawalParameters{}, err return FinalizedWithdrawalParameters{}, err
} }
...@@ -244,7 +244,7 @@ var ( ...@@ -244,7 +244,7 @@ var (
// - I don't like having to use the ABI Generated struct // - I don't like having to use the ABI Generated struct
// - There should be a better way to run the ABI encoding // - There should be a better way to run the ABI encoding
// - These needs to be fuzzed against the solidity // - These needs to be fuzzed against the solidity
func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common.Hash, error) { func WithdrawalHash(ev *bindings.L2ToL1MessagePasserMessagePassed) (common.Hash, error) {
// abi.encode(nonce, msg.sender, _target, msg.value, _gasLimit, _data) // abi.encode(nonce, msg.sender, _target, msg.value, _gasLimit, _data)
args := abi.Arguments{ args := abi.Arguments{
{Name: "nonce", Type: Uint256Type}, {Name: "nonce", Type: Uint256Type},
...@@ -261,50 +261,50 @@ func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common ...@@ -261,50 +261,50 @@ func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common
return crypto.Keccak256Hash(enc), nil return crypto.Keccak256Hash(enc), nil
} }
// ParseWithdrawalInitiated parses WithdrawalInitiated events from // ParseMessagePassed parses MessagePassed events from
// a transaction receipt. It does not support multiple withdrawals // a transaction receipt. It does not support multiple withdrawals
// per receipt. // per receipt.
func ParseWithdrawalInitiated(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserWithdrawalInitiated, error) { func ParseMessagePassed(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserMessagePassed, error) {
contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil) contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, log := range receipt.Logs { for _, log := range receipt.Logs {
if len(log.Topics) == 0 || log.Topics[0] != WithdrawalInitiatedTopic { if len(log.Topics) == 0 || log.Topics[0] != MessagePassedTopic {
continue continue
} }
ev, err := contract.ParseWithdrawalInitiated(*log) ev, err := contract.ParseMessagePassed(*log)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse log: %w", err) return nil, fmt.Errorf("failed to parse log: %w", err)
} }
return ev, nil return ev, nil
} }
return nil, errors.New("Unable to find WithdrawalInitiated event") return nil, errors.New("Unable to find MessagePassed event")
} }
// ParseWithdrawalInitiatedExtension1 parses WithdrawalInitiatedExtension1 events // ParseMessagePassedExtension1 parses MessagePassedExtension1 events
// from a transaction receipt. It does not support multiple withdrawals per // from a transaction receipt. It does not support multiple withdrawals per
// receipt. // receipt.
func ParseWithdrawalInitiatedExtension1(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1, error) { func ParseMessagePassedExtension1(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserMessagePassedExtension1, error) {
contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil) contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, log := range receipt.Logs { for _, log := range receipt.Logs {
if len(log.Topics) == 0 || log.Topics[0] != WithdrawalInitiatedExtension1Topic { if len(log.Topics) == 0 || log.Topics[0] != MessagePassedExtension1Topic {
continue continue
} }
ev, err := contract.ParseWithdrawalInitiatedExtension1(*log) ev, err := contract.ParseMessagePassedExtension1(*log)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse log: %w", err) return nil, fmt.Errorf("failed to parse log: %w", err)
} }
return ev, nil return ev, nil
} }
return nil, errors.New("Unable to find WithdrawalInitiatedExtension1 event") return nil, errors.New("Unable to find MessagePassedExtension1 event")
} }
// StorageSlotOfWithdrawalHash determines the storage slot of the Withdrawer contract to look at // StorageSlotOfWithdrawalHash determines the storage slot of the Withdrawer contract to look at
......
...@@ -15,16 +15,16 @@ import ( ...@@ -15,16 +15,16 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestParseWithdrawalInitiated(t *testing.T) { func TestParseMessagePassed(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
file string file string
expected *bindings.L2ToL1MessagePasserWithdrawalInitiated expected *bindings.L2ToL1MessagePasserMessagePassed
}{ }{
{ {
"withdrawal through bridge", "withdrawal through bridge",
"bridge-withdrawal.json", "bridge-withdrawal.json",
&bindings.L2ToL1MessagePasserWithdrawalInitiated{ &bindings.L2ToL1MessagePasserMessagePassed{
Nonce: new(big.Int), Nonce: new(big.Int),
Sender: common.HexToAddress("0x4200000000000000000000000000000000000007"), Sender: common.HexToAddress("0x4200000000000000000000000000000000000007"),
Target: common.HexToAddress("0x6900000000000000000000000000000000000002"), Target: common.HexToAddress("0x6900000000000000000000000000000000000002"),
...@@ -51,7 +51,7 @@ func TestParseWithdrawalInitiated(t *testing.T) { ...@@ -51,7 +51,7 @@ func TestParseWithdrawalInitiated(t *testing.T) {
Raw: types.Log{ Raw: types.Log{
Address: common.HexToAddress("0x4200000000000000000000000000000000000016"), Address: common.HexToAddress("0x4200000000000000000000000000000000000016"),
Topics: []common.Hash{ Topics: []common.Hash{
common.HexToHash("0x87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a6136"), common.HexToHash("0x7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d72"),
common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
common.HexToHash("0x0000000000000000000000004200000000000000000000000000000000000007"), common.HexToHash("0x0000000000000000000000004200000000000000000000000000000000000007"),
common.HexToHash("0x0000000000000000000000006900000000000000000000000000000000000002"), common.HexToHash("0x0000000000000000000000006900000000000000000000000000000000000002"),
...@@ -95,7 +95,7 @@ func TestParseWithdrawalInitiated(t *testing.T) { ...@@ -95,7 +95,7 @@ func TestParseWithdrawalInitiated(t *testing.T) {
dec := json.NewDecoder(f) dec := json.NewDecoder(f)
receipt := new(types.Receipt) receipt := new(types.Receipt)
require.NoError(t, dec.Decode(receipt)) require.NoError(t, dec.Decode(receipt))
parsed, err := ParseWithdrawalInitiated(receipt) parsed, err := ParseMessagePassed(receipt)
require.NoError(t, err) require.NoError(t, err)
// Have to do this weird thing to compare zero bigints. // Have to do this weird thing to compare zero bigints.
...@@ -117,21 +117,21 @@ func TestParseWithdrawalInitiated(t *testing.T) { ...@@ -117,21 +117,21 @@ func TestParseWithdrawalInitiated(t *testing.T) {
} }
} }
func TestParseWithdrawalInitiatedExtension1(t *testing.T) { func TestParseMessagePassedExtension1(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
file string file string
expected *bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1 expected *bindings.L2ToL1MessagePasserMessagePassedExtension1
}{ }{
{ {
"withdrawal through bridge", "withdrawal through bridge",
"bridge-withdrawal.json", "bridge-withdrawal.json",
&bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1{ &bindings.L2ToL1MessagePasserMessagePassedExtension1{
Hash: common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"), Hash: common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"),
Raw: types.Log{ Raw: types.Log{
Address: common.HexToAddress("0x4200000000000000000000000000000000000016"), Address: common.HexToAddress("0x4200000000000000000000000000000000000016"),
Topics: []common.Hash{ Topics: []common.Hash{
common.HexToHash("0x2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb"), common.HexToHash("0xedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c"),
common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"), common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"),
}, },
Data: []byte{}, Data: []byte{},
...@@ -152,7 +152,7 @@ func TestParseWithdrawalInitiatedExtension1(t *testing.T) { ...@@ -152,7 +152,7 @@ func TestParseWithdrawalInitiatedExtension1(t *testing.T) {
dec := json.NewDecoder(f) dec := json.NewDecoder(f)
receipt := new(types.Receipt) receipt := new(types.Receipt)
require.NoError(t, dec.Decode(receipt)) require.NoError(t, dec.Decode(receipt))
parsed, err := ParseWithdrawalInitiatedExtension1(receipt) parsed, err := ParseMessagePassedExtension1(receipt)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, test.expected, parsed) require.EqualValues(t, test.expected, parsed)
}) })
......
...@@ -3,9 +3,9 @@ module github.com/ethereum-optimism/optimism/op-proposer ...@@ -3,9 +3,9 @@ module github.com/ethereum-optimism/optimism/op-proposer
go 1.18 go 1.18
require ( require (
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 github.com/ethereum-optimism/optimism/op-bindings v0.8.10
github.com/ethereum-optimism/optimism/op-node v0.8.9 github.com/ethereum-optimism/optimism/op-node v0.8.10
github.com/ethereum-optimism/optimism/op-service v0.8.9 github.com/ethereum-optimism/optimism/op-service v0.8.10
github.com/ethereum/go-ethereum v1.10.23 github.com/ethereum/go-ethereum v1.10.23
github.com/miguelmota/go-ethereum-hdwallet v0.1.1 github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/stretchr/testify v1.8.0 github.com/stretchr/testify v1.8.0
......
...@@ -150,12 +150,12 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m ...@@ -150,12 +150,12 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd h1:NchOnosWOkH9wlix8QevGHE+6vuRa+OMGvDNsczv2kQ=
github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20220926184707-53d23c240afd/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9 h1:QeYLhgZP0QkDLxyXhkWLj/iHDFkMNI18abgrHL4I9TE= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.9/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum-optimism/optimism/op-node v0.8.9 h1:wUxvjeHB1nQtnsxbNxqHthSS+Uune7Xb17NWXDBdSXI= github.com/ethereum-optimism/optimism/op-node v0.8.10 h1:1Gc4FtR5B+HgfQ+byNn3P+tiJarpMZSYjj5iLvA3YtU=
github.com/ethereum-optimism/optimism/op-node v0.8.9/go.mod h1:ETNw9UP6sy/pWf6aoNHEgQKrXN2ca0Fm0OqIbCEghYk= github.com/ethereum-optimism/optimism/op-node v0.8.10/go.mod h1:6NkgIThuQbPY6fA9lI2A52DaeLM2FvrcwGCBVEY2fS8=
github.com/ethereum-optimism/optimism/op-service v0.8.9 h1:YdMBcgXi+NHqX3pKR6UhjGHtBeF8AQK6kLmwpv7LzJM= github.com/ethereum-optimism/optimism/op-service v0.8.10 h1:K3IABHI1b0MDrDXALvTKTbzy6IogGD6NgmbqfKEcEwM=
github.com/ethereum-optimism/optimism/op-service v0.8.9/go.mod h1:K0uybOhICTc2yfhrRj0cD1m7aPkOf5C9e6bUmvf4rGA= github.com/ethereum-optimism/optimism/op-service v0.8.10/go.mod h1:K0uybOhICTc2yfhrRj0cD1m7aPkOf5C9e6bUmvf4rGA=
github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg= github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
......
package backoff package backoff
import ( import (
"context"
"fmt" "fmt"
"time" "time"
) )
...@@ -24,21 +25,37 @@ func (e *ErrFailedPermanently) Error() string { ...@@ -24,21 +25,37 @@ func (e *ErrFailedPermanently) Error() string {
// with delays in between each retry according to the provided // with delays in between each retry according to the provided
// Strategy. // Strategy.
func Do(maxAttempts int, strategy Strategy, op Operation) error { func Do(maxAttempts int, strategy Strategy, op Operation) error {
return DoCtx(context.Background(), maxAttempts, strategy, op)
}
func DoCtx(ctx context.Context, maxAttempts int, strategy Strategy, op Operation) error {
var attempt int var attempt int
reattemptCh := make(chan struct{}, 1)
doReattempt := func() {
reattemptCh <- struct{}{}
}
doReattempt()
for { for {
attempt++ select {
err := op() case <-ctx.Done():
if err == nil { return ctx.Err()
return nil case <-reattemptCh:
} attempt++
err := op()
if err == nil {
return nil
}
if attempt == maxAttempts { if attempt == maxAttempts {
return &ErrFailedPermanently{ return &ErrFailedPermanently{
attempts: maxAttempts, attempts: maxAttempts,
LastErr: err, LastErr: err,
}
} }
time.AfterFunc(strategy.Duration(attempt-1), doReattempt)
} }
time.Sleep(strategy.Duration(attempt - 1))
} }
} }
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
"ops/docker/ci-builder", "ops/docker/ci-builder",
"ops/docker/foundry", "ops/docker/foundry",
"proxyd", "proxyd",
"teleportr" "teleportr",
"endpoint-monitor"
], ],
"nohoist": [ "nohoist": [
"**/typechain/*", "**/typechain/*",
......
...@@ -9,6 +9,8 @@ GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (g ...@@ -9,6 +9,8 @@ GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (g
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 68671) GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 68671)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 74964) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 74964)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 35777) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 35777)
CrossDomainMessenger_Test:testFuzz_baseGas(uint32) (runs: 256, μ: 20263, ~: 20263)
CrossDomainMessenger_Test:test_baseGas() (gas: 20100)
CrossDomainOwnableThroughPortal_Test:test_depositTransaction_crossDomainOwner() (gas: 61850) CrossDomainOwnableThroughPortal_Test:test_depositTransaction_crossDomainOwner() (gas: 61850)
CrossDomainOwnable_Test:test_onlyOwner() (gas: 34945) CrossDomainOwnable_Test:test_onlyOwner() (gas: 34945)
CrossDomainOwnable_Test:test_revertOnlyOwner() (gas: 10619) CrossDomainOwnable_Test:test_revertOnlyOwner() (gas: 10619)
...@@ -61,7 +63,7 @@ L1CrossDomainMessenger_Test:test_L1MessengerRelayMessageToSystemContract() (gas: ...@@ -61,7 +63,7 @@ L1CrossDomainMessenger_Test:test_L1MessengerRelayMessageToSystemContract() (gas:
L1CrossDomainMessenger_Test:test_L1MessengerRelayMessageV0Fails() (gas: 33258) L1CrossDomainMessenger_Test:test_L1MessengerRelayMessageV0Fails() (gas: 33258)
L1CrossDomainMessenger_Test:test_L1MessengerRelayShouldRevertIfPaused() (gas: 60526) L1CrossDomainMessenger_Test:test_L1MessengerRelayShouldRevertIfPaused() (gas: 60526)
L1CrossDomainMessenger_Test:test_L1MessengerReplayMessageWithValue() (gas: 38193) L1CrossDomainMessenger_Test:test_L1MessengerReplayMessageWithValue() (gas: 38193)
L1CrossDomainMessenger_Test:test_L1MessengerSendMessage() (gas: 299481) L1CrossDomainMessenger_Test:test_L1MessengerSendMessage() (gas: 299487)
L1CrossDomainMessenger_Test:test_L1MessengerTwiceSendMessage() (gas: 1490366) L1CrossDomainMessenger_Test:test_L1MessengerTwiceSendMessage() (gas: 1490366)
L1CrossDomainMessenger_Test:test_L1MessengerUnpause() (gas: 41003) L1CrossDomainMessenger_Test:test_L1MessengerUnpause() (gas: 41003)
L1CrossDomainMessenger_Test:test_L1MessengerXDomainSenderReverts() (gas: 24283) L1CrossDomainMessenger_Test:test_L1MessengerXDomainSenderReverts() (gas: 24283)
...@@ -91,7 +93,7 @@ L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageSucceeds() (gas: 53115) ...@@ -91,7 +93,7 @@ L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageSucceeds() (gas: 53115)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageToSystemContract() (gas: 36217) L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageToSystemContract() (gas: 36217)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageV0Fails() (gas: 18871) L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageV0Fails() (gas: 18871)
L2CrossDomainMessenger_Test:test_L2MessengerRelayShouldRevertIfPaused() (gas: 41637) L2CrossDomainMessenger_Test:test_L2MessengerRelayShouldRevertIfPaused() (gas: 41637)
L2CrossDomainMessenger_Test:test_L2MessengerSendMessage() (gas: 120636) L2CrossDomainMessenger_Test:test_L2MessengerSendMessage() (gas: 120648)
L2CrossDomainMessenger_Test:test_L2MessengerTwiceSendMessage() (gas: 136338) L2CrossDomainMessenger_Test:test_L2MessengerTwiceSendMessage() (gas: 136338)
L2CrossDomainMessenger_Test:test_L2MessengerXDomainSenderReverts() (gas: 10576) L2CrossDomainMessenger_Test:test_L2MessengerXDomainSenderReverts() (gas: 10576)
L2CrossDomainMessenger_Test:test_L2MessengerxDomainMessageSenderResets() (gas: 50459) L2CrossDomainMessenger_Test:test_L2MessengerxDomainMessageSenderResets() (gas: 50459)
......
...@@ -40,7 +40,7 @@ contract L2ToL1MessagePasser is Semver { ...@@ -40,7 +40,7 @@ contract L2ToL1MessagePasser is Semver {
* @param gasLimit The minimum amount of gas that must be provided when withdrawing on L1. * @param gasLimit The minimum amount of gas that must be provided when withdrawing on L1.
* @param data The data to be forwarded to the target on L1. * @param data The data to be forwarded to the target on L1.
*/ */
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, uint256 indexed nonce,
address indexed sender, address indexed sender,
address indexed target, address indexed target,
...@@ -51,11 +51,11 @@ contract L2ToL1MessagePasser is Semver { ...@@ -51,11 +51,11 @@ contract L2ToL1MessagePasser is Semver {
/** /**
* @notice Emitted any time a withdrawal is initiated. An extension to * @notice Emitted any time a withdrawal is initiated. An extension to
* WithdrawalInitiated so that the interface is maintained. * MessagePassed to allow for a 4th indexed argument.
* *
* @param hash The hash of the withdrawal * @param hash The hash of the withdrawal
*/ */
event WithdrawalInitiatedExtension1(bytes32 indexed hash); event MessagePassedExtension1(bytes32 indexed hash);
/** /**
* @notice Emitted when the balance of this contract is burned. * @notice Emitted when the balance of this contract is burned.
...@@ -113,8 +113,8 @@ contract L2ToL1MessagePasser is Semver { ...@@ -113,8 +113,8 @@ contract L2ToL1MessagePasser is Semver {
sentMessages[withdrawalHash] = true; sentMessages[withdrawalHash] = true;
emit WithdrawalInitiated(nonce, msg.sender, _target, msg.value, _gasLimit, _data); emit MessagePassed(nonce, msg.sender, _target, msg.value, _gasLimit, _data);
emit WithdrawalInitiatedExtension1(withdrawalHash); emit MessagePassedExtension1(withdrawalHash);
unchecked { unchecked {
++nonce; ++nonce;
......
...@@ -190,7 +190,7 @@ contract Messenger_Initializer is L2OutputOracle_Initializer { ...@@ -190,7 +190,7 @@ contract Messenger_Initializer is L2OutputOracle_Initializer {
uint256 value uint256 value
); );
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, uint256 indexed nonce,
address indexed sender, address indexed sender,
address indexed target, address indexed target,
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { Messenger_Initializer, Reverter, CallerCaller } from "./CommonTest.t.sol";
// CrossDomainMessenger_Test is for testing functionality which is common to both the L1 and L2
// CrossDomainMessenger contracts. For simplicity, we use the L1 Messenger as the test contract.
contract CrossDomainMessenger_Test is Messenger_Initializer {
// Ensure that baseGas passes for the max value of _minGasLimit,
// this is about 4 Billion.
function test_baseGas() external {
L1Messenger.baseGas(hex"ff", type(uint32).max);
}
// Fuzz for other values which might cause a revert in baseGas.
function testFuzz_baseGas(uint32 _minGasLimit) external {
L1Messenger.baseGas(hex"ff", _minGasLimit);
}
}
...@@ -56,9 +56,9 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer { ...@@ -56,9 +56,9 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
) )
); );
// WithdrawalInitiated event // MessagePassed event
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
messagePasser.nonce(), messagePasser.nonce(),
address(L2Messenger), address(L2Messenger),
address(L1Messenger), address(L1Messenger),
......
...@@ -9,7 +9,7 @@ import { Hashing } from "../libraries/Hashing.sol"; ...@@ -9,7 +9,7 @@ import { Hashing } from "../libraries/Hashing.sol";
contract L2ToL1MessagePasserTest is CommonTest { contract L2ToL1MessagePasserTest is CommonTest {
L2ToL1MessagePasser messagePasser; L2ToL1MessagePasser messagePasser;
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, uint256 indexed nonce,
address indexed sender, address indexed sender,
address indexed target, address indexed target,
...@@ -18,7 +18,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -18,7 +18,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
bytes data bytes data
); );
event WithdrawalInitiatedExtension1(bytes32 indexed hash); event MessagePassedExtension1(bytes32 indexed hash);
event WithdrawerBalanceBurnt(uint256 indexed amount); event WithdrawerBalanceBurnt(uint256 indexed amount);
...@@ -36,7 +36,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -36,7 +36,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
uint256 nonce = messagePasser.nonce(); uint256 nonce = messagePasser.nonce();
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
nonce, nonce,
_sender, _sender,
_target, _target,
...@@ -57,7 +57,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -57,7 +57,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
); );
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiatedExtension1(withdrawalHash); emit MessagePassedExtension1(withdrawalHash);
vm.deal(_sender, _value); vm.deal(_sender, _value);
vm.prank(_sender); vm.prank(_sender);
...@@ -86,7 +86,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -86,7 +86,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
// Test: initiateWithdrawal should emit the correct log when called by a contract // Test: initiateWithdrawal should emit the correct log when called by a contract
function test_initiateWithdrawal_fromContract() external { function test_initiateWithdrawal_fromContract() external {
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
messagePasser.nonce(), messagePasser.nonce(),
address(this), address(this),
address(4), address(4),
...@@ -107,7 +107,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -107,7 +107,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
); );
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiatedExtension1(withdrawalHash); emit MessagePassedExtension1(withdrawalHash);
vm.deal(address(this), 2**64); vm.deal(address(this), 2**64);
messagePasser.initiateWithdrawal{ value: 100 }( messagePasser.initiateWithdrawal{ value: 100 }(
...@@ -129,7 +129,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -129,7 +129,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
vm.prank(alice, alice); vm.prank(alice, alice);
vm.deal(alice, 2**64); vm.deal(alice, 2**64);
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
nonce, nonce,
alice, alice,
target, target,
......
...@@ -53,22 +53,22 @@ abstract contract CrossDomainMessenger is ...@@ -53,22 +53,22 @@ abstract contract CrossDomainMessenger is
/** /**
* @notice Constant overhead added to the base gas for a message. * @notice Constant overhead added to the base gas for a message.
*/ */
uint32 public constant MIN_GAS_CONSTANT_OVERHEAD = 200_000; uint64 public constant MIN_GAS_CONSTANT_OVERHEAD = 200_000;
/** /**
* @notice Numerator for dynamic overhead added to the base gas for a message. * @notice Numerator for dynamic overhead added to the base gas for a message.
*/ */
uint32 public constant MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR = 1016; uint64 public constant MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR = 1016;
/** /**
* @notice Denominator for dynamic overhead added to the base gas for a message. * @notice Denominator for dynamic overhead added to the base gas for a message.
*/ */
uint32 public constant MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR = 1000; uint64 public constant MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR = 1000;
/** /**
* @notice Extra gas added to base gas for each byte of calldata in a message. * @notice Extra gas added to base gas for each byte of calldata in a message.
*/ */
uint32 public constant MIN_GAS_CALLDATA_OVERHEAD = 16; uint64 public constant MIN_GAS_CALLDATA_OVERHEAD = 16;
/** /**
* @notice Minimum amount of gas required to relay a message. * @notice Minimum amount of gas required to relay a message.
...@@ -369,13 +369,16 @@ abstract contract CrossDomainMessenger is ...@@ -369,13 +369,16 @@ abstract contract CrossDomainMessenger is
* *
* @return Amount of gas required to guarantee message receipt. * @return Amount of gas required to guarantee message receipt.
*/ */
function baseGas(bytes calldata _message, uint32 _minGasLimit) public pure returns (uint32) { function baseGas(bytes calldata _message, uint32 _minGasLimit) public pure returns (uint64) {
// We peform the following math on uint64s to avoid overflow errors. Multiplying the
// by MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR would otherwise limit the _mingasLimit to
// approximately 4.2 MM.
return return
// Dynamic overhead // Dynamic overhead
((_minGasLimit * MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR) / ((uint64(_minGasLimit) * MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR) /
MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR) + MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR) +
// Calldata overhead // Calldata overhead
(uint32(_message.length) * MIN_GAS_CALLDATA_OVERHEAD) + (uint64(_message.length) * MIN_GAS_CALLDATA_OVERHEAD) +
// Constant overhead // Constant overhead
MIN_GAS_CONSTANT_OVERHEAD; MIN_GAS_CONSTANT_OVERHEAD;
} }
......
...@@ -24,6 +24,7 @@ export const isTargetL2Network = (network: string): boolean => { ...@@ -24,6 +24,7 @@ export const isTargetL2Network = (network: string): boolean => {
export const isTargetL1Network = (network: string): boolean => { export const isTargetL1Network = (network: string): boolean => {
switch (network) { switch (network) {
case 'mainnet': case 'mainnet':
case 'ethereum':
case 'goerli': case 'goerli':
case 'ops-l1': case 'ops-l1':
case 'kovan': case 'kovan':
...@@ -38,6 +39,7 @@ export const getProxyAdmin = (network: string): string => { ...@@ -38,6 +39,7 @@ export const getProxyAdmin = (network: string): string => {
case 'optimism': case 'optimism':
return l2MainnetMultisig return l2MainnetMultisig
case 'mainnet': case 'mainnet':
case 'ethereum':
return l1MainnetMultisig return l1MainnetMultisig
case 'kovan': case 'kovan':
case 'optimism-kovan': case 'optimism-kovan':
......
...@@ -1212,30 +1212,30 @@ export class CrossChainMessenger { ...@@ -1212,30 +1212,30 @@ export class CrossChainMessenger {
) )
interface WithdrawalEntry { interface WithdrawalEntry {
withdrawalInitiated: any MessagePassed: any
withdrawalInitiatedExtension1: any MessagePassedExtension1: any
} }
// Handle multiple withdrawals in the same tx and be backwards // Handle multiple withdrawals in the same tx and be backwards
// compatible without WithdrawalInitiatedExtension1 // compatible without MessagePassedExtension1
const logs: Partial<{ number: WithdrawalEntry }> = {} const logs: Partial<{ number: WithdrawalEntry }> = {}
for (const [i, log] of Object.entries(receipt.logs)) { for (const [i, log] of Object.entries(receipt.logs)) {
if (log.address === this.contracts.l2.BedrockMessagePasser.address) { if (log.address === this.contracts.l2.BedrockMessagePasser.address) {
const decoded = const decoded =
this.contracts.l2.L2ToL1MessagePasser.interface.parseLog(log) this.contracts.l2.L2ToL1MessagePasser.interface.parseLog(log)
// Find the withdrawal initiated events // Find the withdrawal initiated events
if (decoded.name === 'WithdrawalInitiated') { if (decoded.name === 'MessagePassed') {
logs[log.logIndex] = { logs[log.logIndex] = {
withdrawalInitiated: decoded.args, MessagePassed: decoded.args,
withdrawalInitiatedExtension1: null, MessagePassedExtension1: null,
} }
if (receipt.logs[i + 1]) { if (receipt.logs[i + 1]) {
const next = const next =
this.contracts.l2.L2ToL1MessagePasser.interface.parseLog( this.contracts.l2.L2ToL1MessagePasser.interface.parseLog(
receipt.logs[i + 1] receipt.logs[i + 1]
) )
if (next.name === 'WithdrawalInitiatedExtension1') { if (next.name === 'MessagePassedExtension1') {
logs[log.logIndex].withdrawalInitiatedExtension1 = next.args logs[log.logIndex].MessagePassedExtension1 = next.args
} }
} }
} }
...@@ -1252,17 +1252,17 @@ export class CrossChainMessenger { ...@@ -1252,17 +1252,17 @@ export class CrossChainMessenger {
} }
const withdrawalHash = hashWithdrawal( const withdrawalHash = hashWithdrawal(
withdrawal.withdrawalInitiated.nonce, withdrawal.MessagePassed.nonce,
withdrawal.withdrawalInitiated.sender, withdrawal.MessagePassed.sender,
withdrawal.withdrawalInitiated.target, withdrawal.MessagePassed.target,
withdrawal.withdrawalInitiated.value, withdrawal.MessagePassed.value,
withdrawal.withdrawalInitiated.gasLimit, withdrawal.MessagePassed.gasLimit,
withdrawal.withdrawalInitiated.data withdrawal.MessagePassed.data
) )
// Sanity check // Sanity check
if (withdrawal.withdrawalInitiatedExtension1) { if (withdrawal.MessagePassedExtension1) {
if (withdrawal.withdrawalInitiatedExtension1.hash !== withdrawalHash) { if (withdrawal.MessagePassedExtension1.hash !== withdrawalHash) {
throw new Error(`Mismatched withdrawal hashes`) throw new Error(`Mismatched withdrawal hashes`)
} }
} }
...@@ -1314,12 +1314,12 @@ export class CrossChainMessenger { ...@@ -1314,12 +1314,12 @@ export class CrossChainMessenger {
output, output,
// TODO(tynes): use better type, typechain? // TODO(tynes): use better type, typechain?
{ {
messageNonce: withdrawal.withdrawalInitiated.nonce, messageNonce: withdrawal.MessagePassed.nonce,
sender: withdrawal.withdrawalInitiated.sender, sender: withdrawal.MessagePassed.sender,
target: withdrawal.withdrawalInitiated.target, target: withdrawal.MessagePassed.target,
value: withdrawal.withdrawalInitiated.value, value: withdrawal.MessagePassed.value,
minGasLimit: withdrawal.withdrawalInitiated.gasLimit, minGasLimit: withdrawal.MessagePassed.gasLimit,
message: withdrawal.withdrawalInitiated.data, message: withdrawal.MessagePassed.data,
}, },
] ]
} }
......
...@@ -30,6 +30,7 @@ export enum L2ChainID { ...@@ -30,6 +30,7 @@ export enum L2ChainID {
OPTIMISM_HARDHAT_LOCAL = 31337, OPTIMISM_HARDHAT_LOCAL = 31337,
OPTIMISM_HARDHAT_DEVNET = 17, OPTIMISM_HARDHAT_DEVNET = 17,
OPTIMISM_BEDROCK_LOCAL_DEVNET = 901, OPTIMISM_BEDROCK_LOCAL_DEVNET = 901,
OPTIMISM_BEDROCK_ALPHA_TESTNET = 28528,
} }
/** /**
......
...@@ -23,6 +23,7 @@ export const DEPOSIT_CONFIRMATION_BLOCKS: { ...@@ -23,6 +23,7 @@ export const DEPOSIT_CONFIRMATION_BLOCKS: {
[L2ChainID.OPTIMISM_HARDHAT_LOCAL]: 2 as const, [L2ChainID.OPTIMISM_HARDHAT_LOCAL]: 2 as const,
[L2ChainID.OPTIMISM_HARDHAT_DEVNET]: 2 as const, [L2ChainID.OPTIMISM_HARDHAT_DEVNET]: 2 as const,
[L2ChainID.OPTIMISM_BEDROCK_LOCAL_DEVNET]: 2 as const, [L2ChainID.OPTIMISM_BEDROCK_LOCAL_DEVNET]: 2 as const,
[L2ChainID.OPTIMISM_BEDROCK_ALPHA_TESTNET]: 12 as const,
} }
export const CHAIN_BLOCK_TIMES: { export const CHAIN_BLOCK_TIMES: {
...@@ -146,6 +147,22 @@ export const CONTRACT_ADDRESSES: { ...@@ -146,6 +147,22 @@ export const CONTRACT_ADDRESSES: {
}, },
l2: DEFAULT_L2_CONTRACT_ADDRESSES, l2: DEFAULT_L2_CONTRACT_ADDRESSES,
}, },
[L2ChainID.OPTIMISM_BEDROCK_ALPHA_TESTNET]: {
l1: {
AddressManager: '0xb4e08DcE1F323608229265c9d4125E22a4B9dbAF' as const,
L1CrossDomainMessenger:
'0x838a6DC4E37CA45D4Ef05bb776bf05eEf50798De' as const,
L1StandardBridge: '0xFf94B6C486350aD92561Ba09bad3a59df764Da92' as const,
StateCommitmentChain:
'0x0000000000000000000000000000000000000000' as const,
CanonicalTransactionChain:
'0x0000000000000000000000000000000000000000' as const,
BondManager: '0x0000000000000000000000000000000000000000' as const,
OptimismPortal: '0xA581Ca3353DB73115C4625FFC7aDF5dB379434A8' as const,
L2OutputOracle: '0x3A234299a14De50027eA65dCdf1c0DaC729e04A6' as const,
},
l2: DEFAULT_L2_CONTRACT_ADDRESSES,
},
} }
/** /**
......
...@@ -78,7 +78,7 @@ which stores messages to be withdrawn. ...@@ -78,7 +78,7 @@ which stores messages to be withdrawn.
```js ```js
interface L2ToL1MessagePasser { interface L2ToL1MessagePasser {
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, // this is a global nonce value for all withdrawal messages uint256 indexed nonce, // this is a global nonce value for all withdrawal messages
address indexed sender, address indexed sender,
address indexed target, address indexed target,
...@@ -87,7 +87,7 @@ interface L2ToL1MessagePasser { ...@@ -87,7 +87,7 @@ interface L2ToL1MessagePasser {
bytes data bytes data
); );
event WithdrawalInitiatedExtension1(bytes32 indexed hash); event MessagePassedExtension1(bytes32 indexed hash);
event WithdrawerBalanceBurnt(uint256 indexed amount); event WithdrawerBalanceBurnt(uint256 indexed amount);
...@@ -102,8 +102,8 @@ interface L2ToL1MessagePasser { ...@@ -102,8 +102,8 @@ interface L2ToL1MessagePasser {
``` ```
The `WithdrawalInitiated` event includes all of the data that is hashed and The `MessagePassed` event includes all of the data that is hashed and
stored in the `sentMessages` mapping. The `WithdrawalInitiatedExtension1` emits stored in the `sentMessages` mapping. The `MessagePassedExtension1` emits
the hash that was computed and used as part of the storage proof used to the hash that was computed and used as part of the storage proof used to
finalize the withdrawal on L1. finalize the withdrawal on L1.
......
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