Commit 60e171b0 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into willc/help-ori-feedback

parents d4aa9dca cf02d753
......@@ -2,4 +2,4 @@
'@eth-optimism/atst': minor
---
Make type parsing more intuitive
Remove broken allowFailures as option
---
"@eth-optimism/l2geth-exporter": patch
---
build(deps): bump golang.org/x/crypto from 0.0.0-20220307211146-efcb8507fb70 to 0.1.0 in /l2geth-exporter
---
"@eth-optimism/gas-oracle": patch
---
build(deps): bump golang.org/x/net from 0.0.0-20211112202133-69e39bad7dc2 to 0.7.0 in /gas-oracle
---
"@eth-optimism/gas-oracle": patch
---
build(deps): bump golang.org/x/sys from 0.0.0-20220310020820-b874c991c1a5 to 0.1.0 in /gas-oracle
---
'@eth-optimism/sdk': major
'@eth-optimism/contracts-bedrock': minor
---
Moves `FINALIZATION_PERIOD_SECONDS` from the `OptimismPortal` to the `L2OutputOracle` & ensures the `CHALLENGER` key cannot delete finalized outputs.
---
"@eth-optimism/l2geth-exporter": patch
---
build(deps): bump golang.org/x/sys from 0.0.0-20220310020820-b874c991c1a5 to 0.1.0 in /l2geth-exporter
......@@ -2,4 +2,4 @@
'@eth-optimism/atst': minor
---
Fix string type that should be `0x${string}`
Deprecate parseAttestationBytes and createRawKey in favor for createKey, createValue
---
'@eth-optimism/chain-mon': minor
---
Added a withdrawal monitoring service
---
'@eth-optimism/atst': patch
---
Add new atst package
---
"@eth-optimism/batch-submitter-service": patch
---
build(deps): bump golang.org/x/crypto from 0.0.0-20220307211146-efcb8507fb70 to 0.1.0 in /batch-submitter
---
'@eth-optimism/atst': patch
---
Release ATST
......@@ -147,6 +147,8 @@ jobs:
- "."
docker-publish:
environment:
DOCKER_BUILDKIT: 1
parameters:
docker_name:
description: Docker image name
......@@ -154,6 +156,13 @@ jobs:
docker_tags:
description: Docker image tags as csv
type: string
docker_file:
description: Path to Dockerfile
type: string
docker_context:
description: Docker build context
type: string
default: "."
registry:
description: Docker registry
type: string
......@@ -162,17 +171,14 @@ jobs:
description: Docker repo
type: string
default: "oplabs-tools-artifacts/images"
platforms:
description: Platforms to build for
type: string
default: "linux/amd64"
machine:
image: ubuntu-2204:2022.07.1
resource_class: xlarge
steps:
- attach_workspace:
at: /tmp/docker_images
- run:
name: Docker load
command: |
DOCKER_LABELS=$(echo -ne <<parameters.docker_tags>> | sed "s/,/\n/g" | sed "s/[^a-zA-Z0-9\n]/-/g")
echo -ne $DOCKER_LABELS | tr ' ' '\n' | xargs -I {} docker load -i /tmp/docker_images/<<parameters.docker_name>>_{}.tar
- gcp-oidc-authenticate
# Below is CircleCI recommended way of specifying nameservers on an Ubuntu box:
# https://support.circleci.com/hc/en-us/articles/7323511028251-How-to-set-custom-DNS-on-Ubuntu-based-images-using-netplan
......@@ -181,13 +187,19 @@ jobs:
- run: sudo sed -i "s/addresses:/ addresses":" [8.8.8.8, 8.8.4.4] /g" /etc/netplan/50-cloud-init.yaml
- run: cat /etc/netplan/50-cloud-init.yaml
- run: sudo netplan apply
- checkout
- run:
name: Publish
name: Build & Publish
command: |
gcloud auth configure-docker <<parameters.registry>>
IMAGE_BASE="<<parameters.registry>>/<<parameters.repo>>/<<parameters.docker_name>>"
DOCKER_TAGS=$(echo -ne <<parameters.docker_tags>> | sed "s/,/\n/g" | sed "s/[^a-zA-Z0-9\n]/-/g" | sed -e "s|^|${IMAGE_BASE}:|")
echo -ne $DOCKER_TAGS | tr ' ' '\n' | xargs -L1 docker push
DOCKER_TAGS=$(echo -ne <<parameters.docker_tags>> | sed "s/,/\n/g" | sed "s/[^a-zA-Z0-9\n]/-/g" | sed -e "s|^|-t ${IMAGE_BASE}:|")
docker context create buildx-build
docker buildx create --use buildx-build
docker buildx build --platform=<<parameters.platforms>> --push \
$(echo -ne $DOCKER_TAGS | tr '\n' ' ') \
-f <<parameters.docker_file>> \
<<parameters.docker_context>>
docker-release:
environment:
......@@ -213,6 +225,10 @@ jobs:
description: Docker repo
type: string
default: "oplabs-tools-artifacts/images"
platforms:
description: Platforms to build for
type: string
default: "linux/amd64"
machine:
image: ubuntu-2204:2022.07.1
resource_class: xlarge
......@@ -220,26 +236,21 @@ jobs:
- gcp-cli/install
- gcp-oidc-authenticate
- checkout
- run:
name: Build
command: |
IMAGE_BASE="<<parameters.registry>>/<<parameters.repo>>/<<parameters.docker_name>>"
DOCKER_TAGS=$(echo -ne <<parameters.docker_tags>> | sed "s/,/\n/g" | sed "s/[^a-zA-Z0-9\n]/-/g" | sed -e "s|^|-t ${IMAGE_BASE}:|")
docker build \
$(echo -ne $DOCKER_TAGS | tr '\n' ' ') \
-f <<parameters.docker_file>> \
--build-arg VERSION=$CIRCLE_TAG \
<<parameters.docker_context>>
- run:
name: Configure Docker
command: |
gcloud auth configure-docker <<parameters.registry>>
- run:
name: Publish
name: Build & Publish
command: |
IMAGE_BASE="<<parameters.registry>>/<<parameters.repo>>/<<parameters.docker_name>>"
DOCKER_TAGS=$(echo -ne <<parameters.docker_tags>> | sed "s/,/\n/g" | sed "s/[^a-zA-Z0-9\n]/-/g" | sed -e "s|^|${IMAGE_BASE}:|")
echo -ne $DOCKER_TAGS | tr ' ' '\n' | xargs -L1 docker push
DOCKER_TAGS=$(echo -ne <<parameters.docker_tags>> | sed "s/,/\n/g" | sed "s/[^a-zA-Z0-9\n]/-/g" | sed -e "s|^|-t ${IMAGE_BASE}:|")
docker context create buildx-build
docker buildx create --use buildx-build
docker buildx build --platform=<<parameters.platforms>> --push \
$(echo -ne $DOCKER_TAGS | tr '\n' ' ') \
-f <<parameters.docker_file>> \
<<parameters.docker_context>>
- run:
name: Tag
command: |
......@@ -1062,11 +1073,11 @@ workflows:
- docker-publish:
name: op-node-docker-publish
docker_name: op-node
docker_file: op-node/Dockerfile
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
context:
- oplabs-gcr
requires:
- op-node-docker-build
platforms: "linux/amd64,linux/arm64"
- docker-build:
name: op-batcher-docker-build
docker_file: op-batcher/Dockerfile
......@@ -1075,12 +1086,12 @@ workflows:
docker_context: .
- docker-publish:
name: op-batcher-docker-publish
docker_file: op-batcher/Dockerfile
docker_name: op-batcher
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
context:
- oplabs-gcr
requires:
- op-batcher-docker-build
platforms: "linux/amd64,linux/arm64"
- docker-build:
name: op-proposer-docker-build
docker_file: op-proposer/Dockerfile
......@@ -1089,12 +1100,12 @@ workflows:
docker_context: .
- docker-publish:
name: op-proposer-docker-publish
docker_file: op-proposer/Dockerfile
docker_name: op-proposer
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
context:
- oplabs-gcr
requires:
- op-proposer-docker-build
platforms: "linux/amd64,linux/arm64"
- docker-build:
name: op-heartbeat-docker-build
docker_file: op-heartbeat/Dockerfile
......@@ -1103,12 +1114,11 @@ workflows:
docker_context: .
- docker-publish:
name: op-heartbeat-docker-publish
docker_file: op-heartbeat/Dockerfile
docker_name: op-heartbeat
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
context:
- oplabs-gcr
requires:
- op-heartbeat-docker-build
- docker-build:
name: indexer-docker-build
docker_file: indexer/Dockerfile
......@@ -1117,12 +1127,11 @@ workflows:
docker_context: .
- docker-publish:
name: indexer-docker-publish
docker_file: indexer/Dockerfile
docker_name: indexer
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
context:
- oplabs-gcr
requires:
- indexer-docker-build
- hive-test:
name: hive-test-rpc
version: <<pipeline.git.revision>>
......@@ -1167,6 +1176,7 @@ workflows:
docker_name: op-node
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: .
platforms: "linux/amd64,linux/arm64"
context:
- oplabs-gcr-release
requires:
......@@ -1182,6 +1192,7 @@ workflows:
docker_name: op-batcher
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: .
platforms: "linux/amd64,linux/arm64"
context:
- oplabs-gcr-release
requires:
......@@ -1197,6 +1208,7 @@ workflows:
docker_name: op-proposer
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: .
platforms: "linux/amd64,linux/arm64"
context:
- oplabs-gcr-release
requires:
......
# @eth-optimism/batch-submitter-service
## 0.1.15
### Patch Changes
- 1d8d50c42: build(deps): bump golang.org/x/crypto from 0.0.0-20220307211146-efcb8507fb70 to 0.1.0 in /batch-submitter
## 0.1.14
### Patch Changes
......
{
"name": "@eth-optimism/batch-submitter-service",
"version": "0.1.14",
"version": "0.1.15",
"private": true,
"devDependencies": {}
}
# @eth-optimism/gas-oracle
## 0.1.13
### Patch Changes
- 9b61c84c9: build(deps): bump golang.org/x/net from 0.0.0-20211112202133-69e39bad7dc2 to 0.7.0 in /gas-oracle
- f13b31e04: build(deps): bump golang.org/x/sys from 0.0.0-20220310020820-b874c991c1a5 to 0.1.0 in /gas-oracle
## 0.1.12
### Patch Changes
......
{
"name": "@eth-optimism/gas-oracle",
"version": "0.1.12",
"version": "0.1.13",
"private": true,
"devDependencies": {}
}
......@@ -191,6 +191,6 @@ require (
nhooyr.io/websocket v1.8.7 // indirect
)
replace github.com/ethereum/go-ethereum v1.11.2 => github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230227230209-0705cf1b7df9
replace github.com/ethereum/go-ethereum v1.11.2 => github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230301232322-c407b2a217b7
//replace github.com/ethereum/go-ethereum v1.11.2 => ../go-ethereum
......@@ -217,8 +217,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230227230209-0705cf1b7df9 h1:O13fqCZYW+HiGVs+UFKtMUHnCMpWR7XcyTPijm9IAiY=
github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230227230209-0705cf1b7df9/go.mod h1:/tjlXxOaovIyuF0l6+wCzr6AtDb3lYWTymmpQAQcqu8=
github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230301232322-c407b2a217b7 h1:bkttBXCRDv2Mp4VoGBglr4BjS7icIuN8HS5ZFpeKfvE=
github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230301232322-c407b2a217b7/go.mod h1:/tjlXxOaovIyuF0l6+wCzr6AtDb3lYWTymmpQAQcqu8=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
......
......@@ -4,7 +4,7 @@ go 1.17
replace (
github.com/ethereum/go-ethereum v1.10.26 => github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b
github.com/ethereum/go-ethereum v1.11.2 => github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230227230209-0705cf1b7df9
github.com/ethereum/go-ethereum v1.11.2 => github.com/ethereum-optimism/op-geth v1.11.2-aea0402.0.20230301232322-c407b2a217b7
)
require (
......
......@@ -30,10 +30,10 @@
"devDependencies": {
"@babel/eslint-parser": "^7.5.4",
"@eth-optimism/contracts": "^0.5.40",
"@eth-optimism/contracts-bedrock": "0.12.1",
"@eth-optimism/contracts-bedrock": "0.13.0",
"@eth-optimism/contracts-periphery": "^1.0.7",
"@eth-optimism/core-utils": "0.12.0",
"@eth-optimism/sdk": "1.10.4",
"@eth-optimism/sdk": "2.0.0",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/providers": "^5.7.0",
"@ethersproject/transactions": "^5.7.0",
......
# @eth-optimism/l2geth-exporter
## 0.0.8
### Patch Changes
- e085354a8: build(deps): bump golang.org/x/crypto from 0.0.0-20220307211146-efcb8507fb70 to 0.1.0 in /l2geth-exporter
- 9bee5c8cc: build(deps): bump golang.org/x/sys from 0.0.0-20220310020820-b874c991c1a5 to 0.1.0 in /l2geth-exporter
## 0.0.7
### Patch Changes
......
{
"name": "@eth-optimism/l2geth-exporter",
"version": "0.0.7",
"version": "0.0.8",
"private": true,
"devDependencies": {}
}
FROM golang:1.18.0-alpine3.15 as builder
FROM --platform=$BUILDPLATFORM golang:1.18.0-alpine3.15 as builder
ARG VERSION=v0.0.0
......@@ -17,7 +17,11 @@ COPY ./.git /app/.git
WORKDIR /app/op-batcher
RUN make op-batcher VERSION="$VERSION"
RUN go mod download
ARG TARGETOS TARGETARCH
RUN make op-batcher VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.15
......
......@@ -8,7 +8,7 @@ LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
op-batcher:
env GO111MODULE=on go build -v $(LDFLAGS) -o ./bin/op-batcher ./cmd
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-batcher ./cmd
clean:
rm bin/op-batcher
......
package batcher_test
import (
"io"
"math/big"
"testing"
"github.com/ethereum-optimism/optimism/op-batcher/batcher"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie"
"github.com/stretchr/testify/require"
)
// TestChannelManagerReturnsErrReorg ensures that the channel manager
// detects a reorg when it has cached L1 blocks.
func TestChannelManagerReturnsErrReorg(t *testing.T) {
log := testlog.Logger(t, log.LvlCrit)
m := batcher.NewChannelManager(log, batcher.ChannelConfig{})
a := types.NewBlock(&types.Header{
Number: big.NewInt(0),
}, nil, nil, nil, nil)
b := types.NewBlock(&types.Header{
Number: big.NewInt(1),
ParentHash: a.Hash(),
}, nil, nil, nil, nil)
c := types.NewBlock(&types.Header{
Number: big.NewInt(2),
ParentHash: b.Hash(),
}, nil, nil, nil, nil)
x := types.NewBlock(&types.Header{
Number: big.NewInt(2),
ParentHash: common.Hash{0xff},
}, nil, nil, nil, nil)
err := m.AddL2Block(a)
require.NoError(t, err)
err = m.AddL2Block(b)
require.NoError(t, err)
err = m.AddL2Block(c)
require.NoError(t, err)
err = m.AddL2Block(x)
require.ErrorIs(t, err, batcher.ErrReorg)
}
// TestChannelManagerReturnsErrReorgWhenDrained ensures that the channel manager
// detects a reorg even if it does not have any blocks inside it.
func TestChannelManagerReturnsErrReorgWhenDrained(t *testing.T) {
log := testlog.Logger(t, log.LvlCrit)
m := batcher.NewChannelManager(log, batcher.ChannelConfig{
TargetFrameSize: 0,
MaxFrameSize: 100,
ApproxComprRatio: 1.0,
})
lBlock := types.NewBlock(&types.Header{
BaseFee: big.NewInt(10),
Difficulty: common.Big0,
Number: big.NewInt(100),
}, nil, nil, nil, trie.NewStackTrie(nil))
l1InfoTx, err := derive.L1InfoDeposit(0, lBlock, eth.SystemConfig{}, false)
require.NoError(t, err)
txs := []*types.Transaction{types.NewTx(l1InfoTx)}
a := types.NewBlock(&types.Header{
Number: big.NewInt(0),
}, txs, nil, nil, trie.NewStackTrie(nil))
x := types.NewBlock(&types.Header{
Number: big.NewInt(1),
ParentHash: common.Hash{0xff},
}, txs, nil, nil, trie.NewStackTrie(nil))
err = m.AddL2Block(a)
require.NoError(t, err)
_, _, err = m.TxData(eth.BlockID{})
require.NoError(t, err)
_, _, err = m.TxData(eth.BlockID{})
require.ErrorIs(t, err, io.EOF)
err = m.AddL2Block(x)
require.ErrorIs(t, err, batcher.ErrReorg)
}
FROM golang:1.18.0-alpine3.15 as builder
FROM --platform=$BUILDPLATFORM golang:1.18.0-alpine3.15 as builder
ARG VERSION=v0.0.0
......@@ -15,7 +15,11 @@ COPY ./.git /app/.git
WORKDIR /app/op-node
RUN make op-node VERSION="$VERSION"
RUN go mod download
ARG TARGETOS TARGETARCH
RUN make op-node VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.15
......
......@@ -9,7 +9,7 @@ LDFLAGSSTRING +=-X github.com/ethereum-optimism/optimism/op-node/version.Meta=$(
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
op-node:
env GO111MODULE=on go build -v $(LDFLAGS) -o ./bin/op-node ./cmd/main.go
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-node ./cmd/main.go
clean:
rm bin/op-node
......
......@@ -66,6 +66,7 @@ var Goerli = rollup.Config{
BatchInboxAddress: common.HexToAddress("0xff00000000000000000000000000000000000420"),
DepositContractAddress: common.HexToAddress("0x5b47E1A08Ea6d985D6649300584e6722Ec4B1383"),
L1SystemConfigAddress: common.HexToAddress("0xAe851f927Ee40dE99aaBb7461C00f9622ab91d60"),
RegolithTime: u64Ptr(1679079600),
}
var NetworksByName = map[string]rollup.Config{
......@@ -97,3 +98,7 @@ func GetRollupConfig(name string) (rollup.Config, error) {
return network, nil
}
func u64Ptr(v uint64) *uint64 {
return &v
}
FROM golang:1.18.0-alpine3.15 as builder
FROM --platform=$BUILDPLATFORM golang:1.18.0-alpine3.15 as builder
ARG VERSION=v0.0.0
......@@ -16,7 +16,11 @@ COPY ./.git /app/.git
WORKDIR /app/op-proposer
RUN make op-proposer VERSION="$VERSION"
RUN go mod download
ARG TARGETOS TARGETARCH
RUN make op-proposer VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.15
......
......@@ -8,7 +8,7 @@ LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
op-proposer:
env GO111MODULE=on go build -v $(LDFLAGS) -o ./bin/op-proposer ./cmd
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-proposer ./cmd
clean:
rm bin/op-proposer
......
# @eth-optimism/actor-tests
## 0.0.22
### Patch Changes
- Updated dependencies [cb19e2f9c]
- @eth-optimism/sdk@2.0.0
- @eth-optimism/contracts-bedrock@0.13.0
## 0.0.21
### Patch Changes
......
{
"name": "@eth-optimism/actor-tests",
"version": "0.0.21",
"version": "0.0.22",
"description": "A library and suite of tests to stress test Optimism Bedrock.",
"license": "MIT",
"author": "",
......@@ -18,9 +18,9 @@
"test:coverage": "yarn test"
},
"dependencies": {
"@eth-optimism/contracts-bedrock": "0.12.1",
"@eth-optimism/contracts-bedrock": "0.13.0",
"@eth-optimism/core-utils": "^0.12.0",
"@eth-optimism/sdk": "^1.10.4",
"@eth-optimism/sdk": "^2.0.0",
"@types/chai": "^4.2.18",
"@types/chai-as-promised": "^7.1.4",
"async-mutex": "^0.3.2",
......
# @eth-optimism/atst
## 0.1.0
### Minor Changes
- a312af15d: Make type parsing more intuitive
- 82a033fed: Fix string type that should be `0x${string}`
### Patch Changes
- 11bb01851: Add new atst package
- 7c37d262a: Release ATST
......@@ -44,7 +44,9 @@ TODO put a gif here of using it
For react hooks we recomend using the [wagmi cli](https://wagmi.sh/cli/getting-started) with the [etherscan plugin](https://wagmi.sh/cli/plugins/etherscan) and [react plugin](https://wagmi.sh/cli/plugins/react) to automatically generate react hooks around the attestation station.
Use `parseAttestationBytes` and `stringifyAttestationBytes` to parse and stringify attestations before passing them into wagmi hooks.
Use `createKey` and `createValue` to convert your raw keys and values into bytes that can be used in the attestation station contract calls
Use `parseString`, `parseBool`, `parseAddress` and `parseNumber` to convert values returned by attestation station to their correct data type.
For convenience we also export the hooks here.
......
......@@ -171,11 +171,6 @@ const attestation = await readAttestations({
* @defaults defaults to the create2 address
*/
contractAddress,
/**
* Boolean: Whether to allow some of the calls to fail
* Defaults to false
*/
allowFailures,
})
```
......@@ -207,10 +202,10 @@ const attestation = parseAttestationBytes(
### attestation keys
Attestation keys are limited to 32 bytes. To support keys longer than 32 bytes, you can use the `encodeRawKey` function
Attestation keys are limited to 32 bytes. To support keys longer than 32 bytes, you can use the `createKey` function
```typescript
const key = await encodeRawKey(
const key = await createKey(
about,
key,
'i.am.a.key.much.longer.than.32.bytes.long'
......@@ -218,7 +213,7 @@ const key = await encodeRawKey(
await writeAttestation(preparedTx)
```
encodeRawKey will keep the key as is if it is shorter than 32 bytes and otherwise run it through kekkak256
createKey will keep the key as is if it is shorter than 32 bytes and otherwise run it through kekkak256
### prepareWriteAttestation
......
{
"name": "@eth-optimism/atst",
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",
......
// constants
export { ATTESTATION_STATION_ADDRESS } from './constants/attestationStationAddress'
// lib
export { encodeRawKey } from './lib/encodeRawKey'
export { encodeRawKey, createKey } from './lib/createKey'
export { createValue, stringifyAttestationBytes } from './lib/createValue'
export {
readAttestation,
readAttestationAddress,
......@@ -15,7 +16,6 @@ export { prepareWriteAttestation } from './lib/prepareWriteAttestation'
export { prepareWriteAttestations } from './lib/prepareWriteAttestations'
export { writeAttestation } from './lib/writeAttestation'
export { abi } from './lib/abi'
export { stringifyAttestationBytes } from './lib/stringifyAttestationBytes'
export {
parseAttestationBytes,
parseAddress,
......
import { describe, expect, it } from 'vitest'
import { encodeRawKey } from './encodeRawKey'
import { encodeRawKey } from './createKey'
describe(encodeRawKey.name, () => {
it('should return just the raw key if it is less than 32 bytes', () => {
......
......@@ -2,10 +2,24 @@ import { ethers } from 'ethers'
import { WagmiBytes } from '../types/WagmiBytes'
export const encodeRawKey = (rawKey: string): WagmiBytes => {
/**
* Creates an attesation key from a raw string
* Converts to bytes32 if key is less than 32 bytes
* Hashes key if key is greater than 32 bytes
*/
export const createKey = (rawKey: string): WagmiBytes => {
if (rawKey.length < 32) {
return ethers.utils.formatBytes32String(rawKey) as WagmiBytes
}
const hash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(rawKey))
return (hash.slice(0, 64) + 'ff') as WagmiBytes
}
/**
* @deprecated use createKey instead
* Will be removed in v1.0.0
*/
export const encodeRawKey: typeof createKey = (rawKey) => {
console.warn('encodeRawKey is deprecated, use createKey instead')
return createKey(rawKey)
}
......@@ -9,7 +9,16 @@ import {
import { WagmiBytes } from '../types/WagmiBytes'
export const stringifyAttestationBytes = (
/**
* Turns a value into bytes to make an attestation
*
* @example
* createValue('hello world') // '0x68656c6c6f20776f726c64'
* createValue(123) // '0x7b'
* createValue(true) // '0x1'
* createValue(BigNumber.from(10)) // '0xa'
*/
export const createValue = (
bytes: WagmiBytes | string | Address | number | boolean | BigNumber
): WagmiBytes => {
bytes = bytes === '0x' ? '0x0' : bytes
......@@ -33,3 +42,14 @@ export const stringifyAttestationBytes = (
}
throw new Error(`unrecognized bytes type ${bytes satisfies never}`)
}
/**
* @deprecated use createValue instead
* Will be removed in v1.0.0
*/
export const stringifyAttestationBytes: typeof createValue = (bytes) => {
console.warn(
'stringifyAttestationBytes is deprecated, use createValue instead'
)
return createValue(bytes)
}
......@@ -4,7 +4,7 @@ import { Address } from 'wagmi'
import { ATTESTATION_STATION_ADDRESS } from '../constants/attestationStationAddress'
import { abi } from '../lib/abi'
import { AttestationCreatedEvent } from '../types/AttestationCreatedEvent'
import { encodeRawKey } from './encodeRawKey'
import { encodeRawKey } from './createKey'
export const getEvents = async ({
creator = null,
......
......@@ -41,6 +41,9 @@ export const parseAddress = (rawAttestation: WagmiBytes): Address => {
}
/**
* @deprecated use parseString, parseBool, parseNumber, or parseAddress instead
* Will be removed in v1.0.0
* @internal
* Parses a raw attestation
*/
export const parseAttestationBytes = <TDataType extends DataTypeOption>(
......
......@@ -4,7 +4,7 @@ import { formatBytes32String } from 'ethers/lib/utils.js'
import { ATTESTATION_STATION_ADDRESS } from '../constants/attestationStationAddress'
import { WagmiBytes } from '../types/WagmiBytes'
import { abi } from './abi'
import { stringifyAttestationBytes } from './stringifyAttestationBytes'
import { createValue } from './createValue'
export const prepareWriteAttestation = async (
about: Address,
......@@ -27,6 +27,6 @@ export const prepareWriteAttestation = async (
abi,
functionName: 'attest',
chainId,
args: [about, formattedKey, stringifyAttestationBytes(value) as WagmiBytes],
args: [about, formattedKey, createValue(value) as WagmiBytes],
})
}
......@@ -4,7 +4,7 @@ import { formatBytes32String } from 'ethers/lib/utils.js'
import { ATTESTATION_STATION_ADDRESS } from '../constants/attestationStationAddress'
import { WagmiBytes } from '../types/WagmiBytes'
import { abi } from './abi'
import { stringifyAttestationBytes } from './stringifyAttestationBytes'
import { createValue } from './createValue'
type Attestation = {
about: Address
......@@ -27,7 +27,7 @@ export const prepareWriteAttestations = async (
`key is longer than 32 bytes: ${attestation.key}. Try using a shorter key or using 'encodeRawKey' to encode the key into 32 bytes first`
)
}
const formattedValue = stringifyAttestationBytes(
const formattedValue = createValue(
attestation.value
) as WagmiBytes
return {
......
......@@ -19,7 +19,6 @@ import { parseAttestationBytes } from './parseAttestationBytes'
* creator: creatorAddress,
* about: aboutAddress,
* key: 'my_key',
* allowFailure: false,
* },
* {
* creator: creatorAddress2,
......@@ -27,7 +26,6 @@ import { parseAttestationBytes } from './parseAttestationBytes'
* key: 'my_key',
* dataType: 'number',
* contractAddress: '0x1234',
* allowFailure: false,
* },
* )
*/
......@@ -40,7 +38,6 @@ export const readAttestations = async (
about,
key,
contractAddress = ATTESTATION_STATION_ADDRESS,
allowFailure = false,
} = attestation
if (key.length > 32) {
throw new Error(
......@@ -52,7 +49,6 @@ export const readAttestations = async (
abi,
functionName: 'attestations',
args: [creator, about, formatBytes32String(key) as WagmiBytes],
allowFailure,
} as const
})
......
......@@ -11,5 +11,4 @@ export interface AttestationReadParams {
key: string
dataType?: DataTypeOption
contractAddress?: Address
allowFailure?: boolean
}
# @eth-optimism/drippie-mon
## 0.2.0
### Minor Changes
- 282bda091: Added a withdrawal monitoring service
### Patch Changes
- Updated dependencies [cb19e2f9c]
- @eth-optimism/sdk@2.0.0
## 0.1.3
### Patch Changes
......
{
"private": true,
"name": "@eth-optimism/chain-mon",
"version": "0.1.3",
"version": "0.2.0",
"description": "[Optimism] Chain monitoring services",
"main": "dist/index",
"types": "dist/index",
......@@ -35,7 +35,7 @@
"@eth-optimism/common-ts": "0.8.0",
"@eth-optimism/contracts-periphery": "1.0.7",
"@eth-optimism/core-utils": "0.12.0",
"@eth-optimism/sdk": "1.10.4",
"@eth-optimism/sdk": "2.0.0",
"ethers": "^5.7.0",
"@types/dateformat": "^5.0.0",
"chai-as-promised": "^7.1.1",
......
# @eth-optimism/contracts-bedrock
## 0.13.0
### Minor Changes
- cb19e2f9c: Moves `FINALIZATION_PERIOD_SECONDS` from the `OptimismPortal` to the `L2OutputOracle` & ensures the `CHALLENGER` key cannot delete finalized outputs.
## 0.12.1
### Patch Changes
......
{
"name": "@eth-optimism/contracts-bedrock",
"version": "0.12.1",
"version": "0.13.0",
"description": "Contracts for Optimism Specs",
"main": "dist/index",
"types": "dist/index",
......
......@@ -53,7 +53,7 @@
"url": "https://github.com/ethereum-optimism/optimism.git"
},
"devDependencies": {
"@eth-optimism/contracts-bedrock": "0.12.1",
"@eth-optimism/contracts-bedrock": "0.13.0",
"@eth-optimism/core-utils": "^0.12.0",
"@eth-optimism/hardhat-deploy-config": "^0.2.5",
"@ethersproject/hardware-wallets": "^5.7.0",
......
# @eth-optimism/fault-detector
## 0.6.1
### Patch Changes
- Updated dependencies [cb19e2f9c]
- @eth-optimism/sdk@2.0.0
## 0.6.0
### Minor Changes
......
{
"private": true,
"name": "@eth-optimism/fault-detector",
"version": "0.6.0",
"version": "0.6.1",
"description": "[Optimism] Service for detecting faulty L2 output proposals",
"main": "dist/index",
"types": "dist/index",
......@@ -50,7 +50,7 @@
"@eth-optimism/common-ts": "^0.8.0",
"@eth-optimism/contracts": "^0.5.40",
"@eth-optimism/core-utils": "^0.12.0",
"@eth-optimism/sdk": "^1.10.2",
"@eth-optimism/sdk": "^2.0.0",
"@ethersproject/abstract-provider": "^5.7.0"
}
}
# @eth-optimism/message-relayer
## 0.5.31
### Patch Changes
- Updated dependencies [cb19e2f9c]
- @eth-optimism/sdk@2.0.0
## 0.5.30
### Patch Changes
......
{
"private": true,
"name": "@eth-optimism/message-relayer",
"version": "0.5.30",
"version": "0.5.31",
"description": "[Optimism] Service for automatically relaying L2 to L1 transactions",
"main": "dist/index",
"types": "dist/index",
......@@ -33,7 +33,7 @@
"dependencies": {
"@eth-optimism/common-ts": "0.8.0",
"@eth-optimism/core-utils": "0.12.0",
"@eth-optimism/sdk": "1.10.4",
"@eth-optimism/sdk": "2.0.0",
"ethers": "^5.7.0"
},
"devDependencies": {
......
# @eth-optimism/sdk
## 2.0.0
### Major Changes
- cb19e2f9c: Moves `FINALIZATION_PERIOD_SECONDS` from the `OptimismPortal` to the `L2OutputOracle` & ensures the `CHALLENGER` key cannot delete finalized outputs.
### Patch Changes
- Updated dependencies [cb19e2f9c]
- @eth-optimism/contracts-bedrock@0.13.0
## 1.10.4
### Patch Changes
......
{
"name": "@eth-optimism/sdk",
"version": "1.10.4",
"version": "2.0.0",
"description": "[Optimism] Tools for working with Optimism",
"main": "dist/index",
"types": "dist/index",
......@@ -50,7 +50,7 @@
"dependencies": {
"@eth-optimism/contracts": "0.5.40",
"@eth-optimism/core-utils": "0.12.0",
"@eth-optimism/contracts-bedrock": "0.12.1",
"@eth-optimism/contracts-bedrock": "0.13.0",
"lodash": "^4.17.21",
"merkletreejs": "^0.2.27",
"rlp": "^2.2.7"
......
......@@ -14,6 +14,10 @@ that maintains 1:1 compatibility with Ethereum.
- [L2 Output Root Proposals](proposals.md)
- [Rollup Node](rollup-node.md)
- [Rollup Node P2p](rollup-node-p2p.md)
- [L2 Chain Derivation](derivation.md)
- [Network Upgrades](network-upgrades.md)
- [System Config](system_config.md)
- [Batch Submitter](batcher.md)
- [Guaranteed Gas Market](guaranteed-gas-market.md)
- [Messengers](messengers.md)
- [Bridges](bridges.md)
......
# Network Upgrades
Network upgrades, also known as forks or hardforks, implement consensus-breaking changes.
These changes are transitioned into deterministically across all nodes through an activation rule.
This document lists the network upgrades of the OP Stack, starting after the Bedrock upgrade.
Prospective upgrades may be listed as proposals, but are not governed through these specifications.
Activation rule parameters of network upgrades are configured in respective chain configurations,
and not part of this specification.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**
- [Activation rules](#activation-rules)
- [L2 Block-number based activation](#l2-block-number-based-activation)
- [L2 Block-timestamp based activation](#l2-block-timestamp-based-activation)
- [Post-Bedrock Network upgrades](#post-bedrock-network-upgrades)
- [Regolith](#regolith)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Activation rules
The below L2-block based activation rules may be applied in two contexts:
- The rollup node, specified through the rollup configuration (known as `rollup.json`),
referencing L2 blocks (or block input-attributes) that pass through the derivation pipeline.
- The execution engine, specified through the chain configuration (known as the `config` part of `genesis.json`),
referencing blocks or input-attributes that are part of, or applied to, the L2 chain.
### L2 Block-number based activation
Activation rule: `x != null && x >= upgradeNumber`
Starting at, and including, the L2 `block` with `block.number == x`, the upgrade rules apply.
If the upgrade block-number `x` is not specified in the configuration, the upgrade is ignored.
This applies to the L2 block number, not to the L1-origin block number.
This means that an L2 upgrade may be inactive, and then active, without changing the L1-origin.
This block number based method has commonly been used in L1 up until the Bellatrix/Paris upgrade, a.k.a. The Merge,
which was upgraded through special rules.
### L2 Block-timestamp based activation
Activation rule: `x != null && x >= upgradeTime`
Starting at, and including, the L2 `block` with `block.timestamp == x`, the upgrade rules apply.
If the upgrade block-timestamp `x` is not specified in the configuration, the upgrade is ignored.
This applies to the L2 block timestamp, not to the L1-origin block timestamp.
This means that an L2 upgrade may be inactive, and then active, without changing the L1-origin.
This timestamp based method has become the default on L1 after the Bellatrix/Paris upgrade, a.k.a. The Merge,
because it can be planned in accordance with beacon-chain epochs and slots.
Note that the L2 version is not limited to timestamps that match L1 beacon-chain slots or epochs.
A timestamp may be chosen to be synchronous with a specific slot or epoch on L1,
but the matching L1-origin information may not be present at the time of activation on L2.
## Post-Bedrock Network upgrades
### Regolith
The Regolith upgrade, named after a material best described as "deposited dust on top of a layer of bedrock",
implements minor changes to deposit processing, based on reports of the Sherlock Audit-contest and findings in
the Bedrock Optimism Goerli testnet.
Summary of changes:
- The `isSystemTx` boolean is disabled, system transactions now use the same gas accounting rules as regular deposits.
- The actual deposit gas-usage is recorded in the receipt of the deposit transaction,
and subtracted from the L2 block gas-pool.
Unused gas of deposits is not refunded with ETH however, as it is burned on L1.
- The `nonce` value of the deposit sender account, before the transaction state-transition, is recorded in a new
optional field (`depositNonce`), extending the transaction receipt (i.e. not present in pre-Regolith receipts).
- The recorded deposit `nonce` is used to correct the transaction and receipt metadata in RPC responses,
including the `contractAddress` field of deposits that deploy contracts.
- The `gas` and `depositNonce` data is committed to as part of the consensus-representation of the receipt,
enabling the data to be safely synced between independent L2 nodes.
The [deposit specification](./deposits.md) specifies the changes of the Regolith upgrade in more detail.
The Regolith upgrade uses a *L2 block-timestamp* activation-rule, and is specified in both the
rollup-node (`regolith_time`) and execution engine (`config.regolithTime`).
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