mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
feat(rollup-sync-service): support codecv2 (#726)
* feat(codecv1): support zstd compression * revert .gitignore changes * change dependency * add zstd compression * bump golang version to 1.21.x * use codecv2 * remove an invalid command * tweak * tweak * remove libzstd, use .so files in da-codec release instead * fix CI * fix CI * try fix CI * fix CI * tweak * fix * fix CI * tweak * tweak * address comments * tweak * remove cp to /usr/local/lib * fix CI * remove cp to /usr/local/lib in CI * try fix * fix * fix * fix * remove env GO111MODULE=on * add .so files to Dockerfiles * revert make geth changes * fix Dockerfile changes * tweak * revert changes * tweak * trigger ci * update Dockerfiles * fix * add codecv2 in decode block ranges from encoded chunks * address comment * nit * update dependencies * use /scroll/lib/ in testing * trigger ci * add unit tests * chore: auto version bump [bot] * remove zkp-builder in Dockerfile.mockccc * fix Dockerfile * Update Makefile Co-authored-by: Péter Garamvölgyi <peter@scroll.io> * use -Wl,-rpath,/scroll/lib/ * change some static values to env var * update dependency * change pwd to scroll_lib_path * fix * add sudo in mkdir * add sudo * update da-codec dependency * chore: auto version bump [bot] * chore: auto version bump [bot] * chore: auto version bump [bot] * update zstd dependency * update libscroll_zstd.so and remove libzktrie.so related to zstd * chore: auto version bump [bot] * uncomment ./rollup tests * fix CI * fix CI * upgrade libzkp to v0.11.0rc2 (#773) * upgrade libzkp * remove zktrie.so * done * fix build --------- Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com> --------- Co-authored-by: colinlyguo <colinlyguo@users.noreply.github.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io> Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
This commit is contained in:
parent
e6cc960f2f
commit
b091e4f9c9
20 changed files with 691 additions and 1712 deletions
12
.github/workflows/l2geth_ci.yml
vendored
12
.github/workflows/l2geth_ci.yml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
go-version: 1.21.x
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Build
|
||||
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
go-version: 1.21.x
|
||||
- name: Install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
|
|
@ -46,7 +46,6 @@ jobs:
|
|||
run: |
|
||||
make libzkp
|
||||
sudo cp ./rollup/circuitcapacitychecker/libzkp/libzkp.so /usr/local/lib/
|
||||
sudo cp ./rollup/circuitcapacitychecker/libzkp/libzktrie.so /usr/local/lib/
|
||||
make geth
|
||||
check:
|
||||
if: github.event.pull_request.draft == false
|
||||
|
|
@ -55,7 +54,7 @@ jobs:
|
|||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
go-version: 1.21.x
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Lint
|
||||
|
|
@ -88,7 +87,7 @@ jobs:
|
|||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
go-version: 1.21.x
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- run: go mod tidy
|
||||
|
|
@ -105,12 +104,11 @@ jobs:
|
|||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
go-version: 1.21.x
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
run: |
|
||||
go get ./...
|
||||
make test
|
||||
- name: Upload coverage report
|
||||
run: bash <(curl -s https://codecov.io/bash)
|
||||
|
|
|
|||
34
Dockerfile
34
Dockerfile
|
|
@ -2,6 +2,8 @@
|
|||
ARG COMMIT=""
|
||||
ARG VERSION=""
|
||||
ARG BUILDNUM=""
|
||||
ARG LIBSCROLL_ZSTD_VERSION=v0.1.0-rc0-ubuntu20.04
|
||||
ARG SCROLL_LIB_PATH=/scroll/lib
|
||||
|
||||
# Build libzkp dependency
|
||||
FROM scrolltech/go-rust-builder:go-1.20-rust-nightly-2022-12-10 as chef
|
||||
|
|
@ -19,27 +21,43 @@ RUN cargo chef cook --release --recipe-path recipe.json
|
|||
COPY ./rollup/circuitcapacitychecker/libzkp .
|
||||
RUN cargo clean
|
||||
RUN cargo build --release
|
||||
RUN find ./ | grep libzktrie.so | xargs -I{} cp {} /app/target/release/
|
||||
|
||||
# Build Geth in a stock Go builder container
|
||||
FROM scrolltech/go-rust-builder:go-1.20-rust-nightly-2022-12-10 as builder
|
||||
|
||||
ADD . /go-ethereum
|
||||
COPY --from=zkp-builder /app/target/release/libzkp.so /usr/local/lib/
|
||||
COPY --from=zkp-builder /app/target/release/libzktrie.so /usr/local/lib/
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
|
||||
|
||||
ARG LIBSCROLL_ZSTD_VERSION
|
||||
ARG SCROLL_LIB_PATH
|
||||
|
||||
RUN mkdir -p $SCROLL_LIB_PATH
|
||||
|
||||
COPY --from=zkp-builder /app/target/release/libzkp.so $SCROLL_LIB_PATH
|
||||
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so
|
||||
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
|
||||
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
|
||||
|
||||
RUN cd /go-ethereum && env GO111MODULE=on go run build/ci.go install -buildtags circuit_capacity_checker ./cmd/geth
|
||||
|
||||
# Pull Geth into a second stage deploy alpine container
|
||||
FROM ubuntu:20.04
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates wget
|
||||
|
||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
||||
COPY --from=zkp-builder /app/target/release/libzkp.so /usr/local/lib/
|
||||
COPY --from=zkp-builder /app/target/release/libzktrie.so /usr/local/lib/
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
|
||||
|
||||
ARG LIBSCROLL_ZSTD_VERSION
|
||||
ARG SCROLL_LIB_PATH
|
||||
|
||||
RUN mkdir -p $SCROLL_LIB_PATH
|
||||
|
||||
COPY --from=zkp-builder /app/target/release/libzkp.so $SCROLL_LIB_PATH
|
||||
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so
|
||||
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
|
||||
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
|
||||
|
||||
EXPOSE 8545 8546 30303 30303/udp
|
||||
ENTRYPOINT ["geth"]
|
||||
|
|
|
|||
|
|
@ -2,18 +2,41 @@
|
|||
ARG COMMIT=""
|
||||
ARG VERSION=""
|
||||
ARG BUILDNUM=""
|
||||
ARG LIBSCROLL_ZSTD_VERSION=v0.1.0-rc0-ubuntu20.04
|
||||
ARG SCROLL_LIB_PATH=/scroll/lib
|
||||
|
||||
# Build Geth in a stock Go builder container
|
||||
FROM scrolltech/go-rust-builder:go-1.20-rust-nightly-2022-12-10 as builder
|
||||
|
||||
ADD . /go-ethereum
|
||||
RUN cd /go-ethereum && env GO111MODULE=on go run build/ci.go install ./cmd/geth
|
||||
|
||||
ARG LIBSCROLL_ZSTD_VERSION
|
||||
ARG SCROLL_LIB_PATH
|
||||
|
||||
RUN mkdir -p $SCROLL_LIB_PATH
|
||||
|
||||
RUN apt-get -qq update && apt-get -qq install -y wget
|
||||
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so
|
||||
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
|
||||
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
|
||||
|
||||
# Pull Geth into a second stage deploy alpine container
|
||||
FROM ubuntu:20.04
|
||||
|
||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
||||
|
||||
ARG LIBSCROLL_ZSTD_VERSION
|
||||
ARG SCROLL_LIB_PATH
|
||||
|
||||
RUN mkdir -p $SCROLL_LIB_PATH
|
||||
|
||||
RUN apt-get -qq update && apt-get -qq install -y wget
|
||||
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so
|
||||
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
|
||||
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
|
||||
|
||||
EXPOSE 8545 8546 30303 30303/udp
|
||||
ENTRYPOINT ["geth"]
|
||||
|
||||
|
|
|
|||
25
Makefile
25
Makefile
|
|
@ -2,21 +2,27 @@
|
|||
# with Go source code. If you know what GOPATH is then you probably
|
||||
# don't need to bother with make.
|
||||
|
||||
.PHONY: geth android ios evm all test clean libzkp
|
||||
.PHONY: geth android ios evm all test clean libzkp libzstd
|
||||
|
||||
GOBIN = ./build/bin
|
||||
GO ?= latest
|
||||
GORUN = env GO111MODULE=on go run
|
||||
GORUN = go run
|
||||
LIBSCROLL_ZSTD_VERSION = v0.1.0-rc0-ubuntu20.04
|
||||
SCROLL_LIB_PATH = /scroll/lib
|
||||
|
||||
libzkp:
|
||||
cd $(PWD)/rollup/circuitcapacitychecker/libzkp && make libzkp
|
||||
|
||||
nccc_geth: ## geth without circuit capacity checker
|
||||
$(GORUN) build/ci.go install ./cmd/geth
|
||||
libzstd:
|
||||
@sudo mkdir -p $(SCROLL_LIB_PATH)
|
||||
@sudo wget -O $(SCROLL_LIB_PATH)/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$(LIBSCROLL_ZSTD_VERSION)/libscroll_zstd.so
|
||||
|
||||
nccc_geth: libzstd ## geth without circuit capacity checker
|
||||
@LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(SCROLL_LIB_PATH)" CGO_LDFLAGS="-L$(SCROLL_LIB_PATH) -Wl,-rpath,$(SCROLL_LIB_PATH)" $(GORUN) build/ci.go install ./cmd/geth
|
||||
@echo "Done building."
|
||||
@echo "Run \"$(GOBIN)/geth\" to launch geth."
|
||||
|
||||
geth: libzkp
|
||||
geth: libzkp libzstd
|
||||
$(GORUN) build/ci.go install -buildtags circuit_capacity_checker ./cmd/geth
|
||||
@echo "Done building."
|
||||
@echo "Run \"$(GOBIN)/geth\" to launch geth."
|
||||
|
|
@ -36,17 +42,14 @@ ios:
|
|||
@echo "Done building."
|
||||
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
|
||||
|
||||
test: all
|
||||
# genesis test
|
||||
cd ${PWD}/cmd/geth; go test -test.run TestCustomGenesis
|
||||
# module test
|
||||
$(GORUN) build/ci.go test ./consensus ./core ./eth ./miner ./node ./trie ./rollup/fees
|
||||
test:
|
||||
./run_test.sh
|
||||
|
||||
lint: ## Run linters.
|
||||
$(GORUN) build/ci.go lint
|
||||
|
||||
clean:
|
||||
env GO111MODULE=on go clean -cache
|
||||
go clean -cache
|
||||
rm -fr build/_workspace/pkg/ $(GOBIN)/*
|
||||
|
||||
# The devtools target installs tools required for 'go generate'.
|
||||
|
|
|
|||
42
go.mod
42
go.mod
|
|
@ -1,10 +1,10 @@
|
|||
module github.com/scroll-tech/go-ethereum
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-storage-blob-go v0.7.0
|
||||
github.com/VictoriaMetrics/fastcache v1.6.0
|
||||
github.com/VictoriaMetrics/fastcache v1.12.1
|
||||
github.com/aws/aws-sdk-go-v2 v1.2.0
|
||||
github.com/aws/aws-sdk-go-v2/config v1.1.1
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.1.1
|
||||
|
|
@ -12,7 +12,7 @@ require (
|
|||
github.com/btcsuite/btcd v0.20.1-beta
|
||||
github.com/cespare/cp v0.1.0
|
||||
github.com/cloudflare/cloudflare-go v0.14.0
|
||||
github.com/consensys/gnark-crypto v0.10.0
|
||||
github.com/consensys/gnark-crypto v0.12.1
|
||||
github.com/crate-crypto/go-kzg-4844 v1.0.0
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea
|
||||
|
|
@ -23,9 +23,9 @@ require (
|
|||
github.com/fatih/color v1.7.0
|
||||
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5
|
||||
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
|
||||
github.com/go-stack/stack v1.8.0
|
||||
github.com/go-stack/stack v1.8.1
|
||||
github.com/golang/protobuf v1.4.3
|
||||
github.com/golang/snappy v0.0.4
|
||||
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
|
||||
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa
|
||||
github.com/google/uuid v1.1.5
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
|
|
@ -35,7 +35,7 @@ require (
|
|||
github.com/holiman/bloomfilter/v2 v2.0.3
|
||||
github.com/holiman/uint256 v1.2.4
|
||||
github.com/huin/goupnp v1.0.2
|
||||
github.com/iden3/go-iden3-crypto v0.0.12
|
||||
github.com/iden3/go-iden3-crypto v0.0.15
|
||||
github.com/influxdata/influxdb v1.8.3
|
||||
github.com/influxdata/influxdb-client-go/v2 v2.4.0
|
||||
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458
|
||||
|
|
@ -50,16 +50,17 @@ require (
|
|||
github.com/prometheus/tsdb v0.7.1
|
||||
github.com/rjeczalik/notify v0.9.1
|
||||
github.com/rs/cors v1.7.0
|
||||
github.com/scroll-tech/da-codec v0.0.0-20240516115958-db04f5e6772c
|
||||
github.com/scroll-tech/zktrie v0.8.4
|
||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
|
||||
github.com/stretchr/testify v1.8.2
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
|
||||
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef
|
||||
golang.org/x/crypto v0.14.0
|
||||
golang.org/x/sync v0.4.0
|
||||
golang.org/x/sys v0.13.0
|
||||
golang.org/x/text v0.13.0
|
||||
golang.org/x/crypto v0.17.0
|
||||
golang.org/x/sync v0.6.0
|
||||
golang.org/x/sys v0.17.0
|
||||
golang.org/x/text v0.14.0
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
|
||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
|
||||
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6
|
||||
|
|
@ -69,24 +70,23 @@ require (
|
|||
require (
|
||||
github.com/Azure/azure-pipeline-go v0.2.2 // indirect
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.23 // indirect
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.1.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.1.1 // indirect
|
||||
github.com/aws/smithy-go v1.1.0 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.5.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.12.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/consensys/bavard v0.1.13 // indirect
|
||||
github.com/deepmap/oapi-codegen v1.8.2 // indirect
|
||||
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
|
||||
github.com/go-ole/go-ole v1.2.1 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
|
||||
github.com/gotestyourself/gotestyourself v1.4.0 // indirect
|
||||
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
||||
github.com/mitchellh/pointerstructure v1.2.0 // indirect
|
||||
github.com/mmcloughlin/addchain v0.4.0 // indirect
|
||||
|
|
@ -94,11 +94,13 @@ require (
|
|||
github.com/opentracing/opentracing-go v1.1.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.10 // indirect
|
||||
github.com/tklauser/numcpus v0.4.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
||||
golang.org/x/net v0.16.0 // indirect
|
||||
golang.org/x/term v0.13.0 // indirect
|
||||
golang.org/x/term v0.15.0 // indirect
|
||||
google.golang.org/protobuf v1.23.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
|
|
|||
95
go.sum
95
go.sum
|
|
@ -38,10 +38,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
|
|||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||
github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o=
|
||||
github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw=
|
||||
github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40=
|
||||
github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
|
||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
|
|
@ -70,8 +68,8 @@ github.com/aws/smithy-go v1.1.0 h1:D6CSsM3gdxaGaqXnPgOBCeL6Mophqzu7KJOu7zW78sU=
|
|||
github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8=
|
||||
github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
|
||||
github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA=
|
||||
github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
|
||||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||
github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw=
|
||||
|
|
@ -88,8 +86,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA
|
|||
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
|
||||
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
|
|
@ -98,8 +96,8 @@ github.com/cloudflare/cloudflare-go v0.14.0 h1:gFqGlGl/5f9UGXAaKapCGUfaTCgRKKnzu
|
|||
github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304=
|
||||
github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ=
|
||||
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
|
||||
github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA=
|
||||
github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU=
|
||||
github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M=
|
||||
github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI=
|
||||
github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
|
||||
|
|
@ -110,7 +108,6 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2
|
|||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzhLMB92JI=
|
||||
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea h1:j4317fAZh7X6GqbFowYdYdI0L9bwxL07jyPZIdepyZ0=
|
||||
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
|
||||
github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M=
|
||||
|
|
@ -156,15 +153,17 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
|
|||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
|
||||
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU=
|
||||
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
|
||||
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
|
||||
github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
|
|
@ -190,9 +189,9 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
|
|||
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk=
|
||||
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
|
|
@ -239,8 +238,8 @@ github.com/huin/goupnp v1.0.2 h1:RfGLP+h3mvisuWEyybxNq5Eft3NWhHLPeUN72kpKZoI=
|
|||
github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM=
|
||||
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/iden3/go-iden3-crypto v0.0.12 h1:dXZF+R9iI07DK49LHX/EKC3jTa0O2z+TUyvxjGK7V38=
|
||||
github.com/iden3/go-iden3-crypto v0.0.12/go.mod h1:swXIv0HFbJKobbQBtsB50G7IHr6PbTowutSew/iBEoo=
|
||||
github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4=
|
||||
github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY=
|
||||
github.com/influxdata/influxdb v1.8.3 h1:WEypI1BQFTT4teLM+1qkEcvUi0dAvopAI/ir0vAiBg8=
|
||||
|
|
@ -286,8 +285,9 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
|
|||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
|
|
@ -316,8 +316,9 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y
|
|||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
|
|
@ -380,19 +381,26 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
|
|||
github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE=
|
||||
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
|
||||
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/scroll-tech/da-codec v0.0.0-20240516115958-db04f5e6772c h1:Vi1BGENMGO8yjmnJe6QP9Eb1OPPuEi4+wd8d/DxhJ6Q=
|
||||
github.com/scroll-tech/da-codec v0.0.0-20240516115958-db04f5e6772c/go.mod h1:1wWYii0OPwd5kw+xrz0PFgS420xNadrNF1x/ELJT+TM=
|
||||
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=
|
||||
github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
|
||||
github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
|
||||
github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
|
||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
|
|
@ -415,17 +423,18 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
|||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0=
|
||||
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
|
||||
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
|
||||
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
|
||||
github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=
|
||||
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
|
||||
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
|
||||
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
|
||||
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
|
||||
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
||||
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4=
|
||||
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
|
||||
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
||||
|
|
@ -435,6 +444,8 @@ github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+
|
|||
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||
github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
|
|
@ -452,10 +463,9 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
|||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
|
||||
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
|
|
@ -504,7 +514,6 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R
|
|||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos=
|
||||
|
|
@ -522,8 +531,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
||||
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
|
@ -540,6 +549,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
@ -554,22 +564,21 @@ golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
|
||||
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
|
|
@ -579,8 +588,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
package circuitcapacitychecker
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lm -ldl -lzkp -lzktrie
|
||||
#cgo LDFLAGS: -lm -ldl -lzkp
|
||||
#include <stdlib.h>
|
||||
#include "./libzkp/libzkp.h"
|
||||
*/
|
||||
|
|
|
|||
461
rollup/circuitcapacitychecker/libzkp/Cargo.lock
generated
461
rollup/circuitcapacitychecker/libzkp/Cargo.lock
generated
|
|
@ -31,13 +31,16 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "aggregator"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"ark-std 0.3.0",
|
||||
"bitstream-io",
|
||||
"c-kzg",
|
||||
"encoder",
|
||||
"env_logger 0.10.0",
|
||||
"eth-types",
|
||||
"ethers-core",
|
||||
"gadgets",
|
||||
"halo2-base",
|
||||
"halo2-ecc",
|
||||
"halo2_proofs",
|
||||
|
|
@ -48,11 +51,13 @@ dependencies = [
|
|||
"once_cell",
|
||||
"rand",
|
||||
"revm-precompile",
|
||||
"revm-primitives 3.1.0",
|
||||
"revm-primitives",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"snark-verifier",
|
||||
"snark-verifier-sdk",
|
||||
"strum 0.25.0",
|
||||
"strum_macros 0.25.3",
|
||||
"zkevm-circuits",
|
||||
]
|
||||
|
||||
|
|
@ -84,18 +89,18 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
|
|||
|
||||
[[package]]
|
||||
name = "alloy-primitives"
|
||||
version = "0.6.4"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "600d34d8de81e23b6d909c094e23b3d357e01ca36b78a8c5424c501eedbe86f0"
|
||||
checksum = "db8aa973e647ec336810a9356af8aea787249c9d00b1525359f3db29a68d231b"
|
||||
dependencies = [
|
||||
"alloy-rlp",
|
||||
"bytes",
|
||||
"cfg-if 1.0.0",
|
||||
"const-hex",
|
||||
"derive_more",
|
||||
"hex-literal 0.4.1",
|
||||
"hex-literal",
|
||||
"itoa",
|
||||
"k256 0.13.1",
|
||||
"k256",
|
||||
"keccak-asm",
|
||||
"proptest",
|
||||
"rand",
|
||||
|
|
@ -316,6 +321,16 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aurora-engine-modexp"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0aef7712851e524f35fbbb74fa6599c5cd8692056a1c36f9ca0d2001b670e7e5"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"num",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "auto_impl"
|
||||
version = "1.2.0"
|
||||
|
|
@ -348,12 +363,6 @@ dependencies = [
|
|||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base16ct"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce"
|
||||
|
||||
[[package]]
|
||||
name = "base16ct"
|
||||
version = "0.2.0"
|
||||
|
|
@ -420,6 +429,12 @@ version = "2.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
||||
|
||||
[[package]]
|
||||
name = "bitstream-io"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c12d1856e42f0d817a835fe55853957c85c8c8a470114029143d3f12671446e"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
|
|
@ -482,8 +497,8 @@ name = "bls12_381"
|
|||
version = "0.8.0"
|
||||
source = "git+https://github.com/scroll-tech/bls12_381?branch=feat/impl_scalar_field#2c515f73a2462fef8681c8e884edf1710f52b22a"
|
||||
dependencies = [
|
||||
"ff 0.13.0",
|
||||
"group 0.13.0",
|
||||
"ff",
|
||||
"group",
|
||||
"pairing",
|
||||
"pasta_curves",
|
||||
"rand_core",
|
||||
|
|
@ -521,12 +536,13 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
|
|||
[[package]]
|
||||
name = "bus-mapping"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"eth-types",
|
||||
"ethers-core",
|
||||
"ethers-providers",
|
||||
"ethers-signers",
|
||||
"external-tracer",
|
||||
"gadgets",
|
||||
"halo2_proofs",
|
||||
"hex",
|
||||
|
|
@ -567,9 +583,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "c-kzg"
|
||||
version = "1.0.0"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3130f3d8717cc02e668a896af24984d5d5d4e8bf12e278e982e0f1bd88a0f9af"
|
||||
checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df"
|
||||
dependencies = [
|
||||
"blst",
|
||||
"cc",
|
||||
|
|
@ -584,6 +600,10 @@ name = "cc"
|
|||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
|
@ -632,7 +652,7 @@ dependencies = [
|
|||
"coins-core",
|
||||
"digest 0.10.7",
|
||||
"hmac",
|
||||
"k256 0.13.1",
|
||||
"k256",
|
||||
"serde",
|
||||
"sha2",
|
||||
"thiserror",
|
||||
|
|
@ -793,18 +813,6 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-bigint"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-bigint"
|
||||
version = "0.5.3"
|
||||
|
|
@ -877,15 +885,6 @@ version = "2.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.7.8"
|
||||
|
|
@ -953,29 +952,17 @@ version = "1.0.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
||||
|
||||
[[package]]
|
||||
name = "ecdsa"
|
||||
version = "0.14.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c"
|
||||
dependencies = [
|
||||
"der 0.6.1",
|
||||
"elliptic-curve 0.12.3",
|
||||
"rfc6979 0.3.1",
|
||||
"signature 1.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ecdsa"
|
||||
version = "0.16.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4"
|
||||
dependencies = [
|
||||
"der 0.7.8",
|
||||
"der",
|
||||
"digest 0.10.7",
|
||||
"elliptic-curve 0.13.5",
|
||||
"rfc6979 0.4.0",
|
||||
"signature 2.1.0",
|
||||
"elliptic-curve",
|
||||
"rfc6979",
|
||||
"signature",
|
||||
"spki",
|
||||
]
|
||||
|
||||
|
|
@ -987,40 +974,29 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
|||
|
||||
[[package]]
|
||||
name = "elliptic-curve"
|
||||
version = "0.12.3"
|
||||
version = "0.13.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3"
|
||||
checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
|
||||
dependencies = [
|
||||
"base16ct 0.1.1",
|
||||
"crypto-bigint 0.4.9",
|
||||
"der 0.6.1",
|
||||
"base16ct",
|
||||
"crypto-bigint",
|
||||
"digest 0.10.7",
|
||||
"ff 0.12.1",
|
||||
"ff",
|
||||
"generic-array",
|
||||
"group 0.12.1",
|
||||
"group",
|
||||
"pkcs8",
|
||||
"rand_core",
|
||||
"sec1 0.3.0",
|
||||
"sec1",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "elliptic-curve"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b"
|
||||
name = "encoder"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/da-codec.git?tag=v0.1.0#5a28b752d4504bf0966734fe4a6a5433981c74c2"
|
||||
dependencies = [
|
||||
"base16ct 0.2.0",
|
||||
"crypto-bigint 0.5.3",
|
||||
"digest 0.10.7",
|
||||
"ff 0.13.0",
|
||||
"generic-array",
|
||||
"group 0.13.0",
|
||||
"pkcs8",
|
||||
"rand_core",
|
||||
"sec1 0.7.3",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1041,7 +1017,7 @@ dependencies = [
|
|||
"base64 0.13.1",
|
||||
"bytes",
|
||||
"hex",
|
||||
"k256 0.13.1",
|
||||
"k256",
|
||||
"log",
|
||||
"rand",
|
||||
"rlp",
|
||||
|
|
@ -1139,19 +1115,21 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "eth-types"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"ethers-core",
|
||||
"ethers-signers",
|
||||
"halo2-base",
|
||||
"halo2_proofs",
|
||||
"halo2curves",
|
||||
"hex",
|
||||
"itertools 0.11.0",
|
||||
"log",
|
||||
"num",
|
||||
"num-bigint",
|
||||
"poseidon-circuit",
|
||||
"poseidon-base",
|
||||
"regex",
|
||||
"revm-precompile",
|
||||
"revm-primitives",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
|
|
@ -1218,11 +1196,11 @@ dependencies = [
|
|||
"arrayvec",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"elliptic-curve 0.13.5",
|
||||
"elliptic-curve",
|
||||
"ethabi",
|
||||
"generic-array",
|
||||
"hex",
|
||||
"k256 0.13.1",
|
||||
"k256",
|
||||
"num_enum 0.6.1",
|
||||
"open-fastrlp",
|
||||
"rand",
|
||||
|
|
@ -1280,7 +1258,7 @@ dependencies = [
|
|||
"async-trait",
|
||||
"coins-bip32",
|
||||
"coins-bip39",
|
||||
"elliptic-curve 0.13.5",
|
||||
"elliptic-curve",
|
||||
"eth-keystore",
|
||||
"ethers-core",
|
||||
"hex",
|
||||
|
|
@ -1293,7 +1271,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "external-tracer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"eth-types",
|
||||
"geth-utils",
|
||||
|
|
@ -1320,16 +1298,6 @@ dependencies = [
|
|||
"bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ff"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ff"
|
||||
version = "0.13.0"
|
||||
|
|
@ -1485,7 +1453,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gadgets"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"eth-types",
|
||||
"halo2_proofs",
|
||||
|
|
@ -1507,7 +1475,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "geth-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"env_logger 0.10.0",
|
||||
"gobuild",
|
||||
|
|
@ -1579,24 +1547,13 @@ dependencies = [
|
|||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "group"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7"
|
||||
dependencies = [
|
||||
"ff 0.12.1",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "group"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
|
||||
dependencies = [
|
||||
"ff 0.13.0",
|
||||
"ff",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
|
@ -1625,7 +1582,7 @@ name = "halo2-base"
|
|||
version = "0.2.2"
|
||||
source = "git+https://github.com/scroll-tech/halo2-lib?branch=develop#817cace374a9f4b2eca682b1cc36f143255ea25f"
|
||||
dependencies = [
|
||||
"ff 0.13.0",
|
||||
"ff",
|
||||
"halo2_proofs",
|
||||
"itertools 0.10.5",
|
||||
"num-bigint",
|
||||
|
|
@ -1640,8 +1597,8 @@ name = "halo2-ecc"
|
|||
version = "0.2.2"
|
||||
source = "git+https://github.com/scroll-tech/halo2-lib?branch=develop#817cace374a9f4b2eca682b1cc36f143255ea25f"
|
||||
dependencies = [
|
||||
"ff 0.13.0",
|
||||
"group 0.13.0",
|
||||
"ff",
|
||||
"group",
|
||||
"halo2-base",
|
||||
"itertools 0.10.5",
|
||||
"num-bigint",
|
||||
|
|
@ -1673,9 +1630,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "halo2-mpt-circuits"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/mpt-circuit.git?branch=v0.7#6ba2b36271cbe1f6df1f794c3340763dd846f46f"
|
||||
source = "git+https://github.com/scroll-tech/mpt-circuit.git?branch=v0.7#daa3a06e2e96d00337188280ac43fa879e722804"
|
||||
dependencies = [
|
||||
"env_logger 0.10.0",
|
||||
"ethers-core",
|
||||
"halo2_proofs",
|
||||
"hex",
|
||||
|
|
@ -1701,8 +1657,8 @@ source = "git+https://github.com/scroll-tech/halo2.git?branch=v1.1#7179a60e4b4b1
|
|||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitvec",
|
||||
"ff 0.13.0",
|
||||
"group 0.13.0",
|
||||
"ff",
|
||||
"group",
|
||||
"halo2_proofs",
|
||||
"halo2curves",
|
||||
"lazy_static",
|
||||
|
|
@ -1714,14 +1670,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "halo2_proofs"
|
||||
version = "1.1.0"
|
||||
source = "git+https://github.com/scroll-tech/halo2.git?branch=v1.1#7179a60e4b4b1dafff084deac7b4bea235eecf5f"
|
||||
source = "git+https://github.com/scroll-tech/halo2.git?branch=v1.1#6c5e9eec5088dc8b4a23edcdd1eaf8705b5fc7dc"
|
||||
dependencies = [
|
||||
"ark-std 0.3.0",
|
||||
"blake2b_simd",
|
||||
"cfg-if 0.1.10",
|
||||
"crossbeam",
|
||||
"ff 0.13.0",
|
||||
"group 0.13.0",
|
||||
"ff",
|
||||
"group",
|
||||
"halo2curves",
|
||||
"log",
|
||||
"maybe-rayon",
|
||||
|
|
@ -1743,8 +1699,8 @@ source = "git+https://github.com/scroll-tech/halo2curves?branch=v0.1.0#112f5b9bf
|
|||
dependencies = [
|
||||
"blake2b_simd",
|
||||
"bls12_381",
|
||||
"ff 0.13.0",
|
||||
"group 0.13.0",
|
||||
"ff",
|
||||
"group",
|
||||
"lazy_static",
|
||||
"maybe-rayon",
|
||||
"num-bigint",
|
||||
|
|
@ -1820,12 +1776,6 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hex-literal"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
|
||||
|
||||
[[package]]
|
||||
name = "hex-literal"
|
||||
version = "0.4.1"
|
||||
|
|
@ -2084,6 +2034,15 @@ version = "1.0.9"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.64"
|
||||
|
|
@ -2095,29 +2054,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "k256"
|
||||
version = "0.11.6"
|
||||
version = "0.13.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b"
|
||||
checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"ecdsa 0.14.8",
|
||||
"elliptic-curve 0.12.3",
|
||||
"sha2",
|
||||
"sha3 0.10.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "k256"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"ecdsa 0.16.8",
|
||||
"elliptic-curve 0.13.5",
|
||||
"ecdsa",
|
||||
"elliptic-curve",
|
||||
"once_cell",
|
||||
"sha2",
|
||||
"signature 2.1.0",
|
||||
"signature",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2139,20 +2085,6 @@ dependencies = [
|
|||
"sha3-asm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "keccak256"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
dependencies = [
|
||||
"env_logger 0.10.0",
|
||||
"eth-types",
|
||||
"halo2_proofs",
|
||||
"itertools 0.11.0",
|
||||
"log",
|
||||
"num-bigint",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
|
|
@ -2292,7 +2224,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "mock"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"eth-types",
|
||||
"ethers-core",
|
||||
|
|
@ -2307,15 +2239,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "mpt-zktrie"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"eth-types",
|
||||
"halo2-mpt-circuits",
|
||||
"halo2_proofs",
|
||||
"halo2curves",
|
||||
"hex",
|
||||
"log",
|
||||
"num-bigint",
|
||||
"poseidon-circuit",
|
||||
"poseidon-base",
|
||||
"zktrie",
|
||||
]
|
||||
|
||||
|
|
@ -2354,6 +2285,17 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
|
|
@ -2501,7 +2443,7 @@ version = "0.23.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f"
|
||||
dependencies = [
|
||||
"group 0.13.0",
|
||||
"group",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2560,8 +2502,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d3e57598f73cc7e1b2ac63c79c517b31a0877cd7c402cdcaa311b5208de7a095"
|
||||
dependencies = [
|
||||
"blake2b_simd",
|
||||
"ff 0.13.0",
|
||||
"group 0.13.0",
|
||||
"ff",
|
||||
"group",
|
||||
"lazy_static",
|
||||
"rand",
|
||||
"static_assertions",
|
||||
|
|
@ -2658,10 +2600,16 @@ version = "0.10.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
|
||||
dependencies = [
|
||||
"der 0.7.8",
|
||||
"der",
|
||||
"spki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
|
||||
|
||||
[[package]]
|
||||
name = "poseidon"
|
||||
version = "0.2.0"
|
||||
|
|
@ -2672,15 +2620,24 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "poseidon-circuit"
|
||||
name = "poseidon-base"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/poseidon-circuit.git?branch=main#babf5f6a69bec40b2e6523df317c073dcd0b1f97"
|
||||
source = "git+https://github.com/scroll-tech/poseidon-circuit.git?branch=main#7b96835c6201afdbfaf3d13d641efbaaf5db2d20"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"ff 0.13.0",
|
||||
"halo2_proofs",
|
||||
"halo2curves",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "poseidon-circuit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/poseidon-circuit.git?branch=main#7b96835c6201afdbfaf3d13d641efbaaf5db2d20"
|
||||
dependencies = [
|
||||
"ff",
|
||||
"halo2_proofs",
|
||||
"log",
|
||||
"poseidon-base",
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"thiserror",
|
||||
|
|
@ -2754,7 +2711,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "prover"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"aggregator",
|
||||
"anyhow",
|
||||
|
|
@ -2987,43 +2944,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "revm-precompile"
|
||||
version = "2.0.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-fix#aebf2e591e622e6bcce2c5d4bf3336935a68cf11"
|
||||
version = "7.0.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v36#8543dd627348907773d8057807b6a310b276bb30"
|
||||
dependencies = [
|
||||
"k256 0.11.6",
|
||||
"num",
|
||||
"aurora-engine-modexp",
|
||||
"c-kzg",
|
||||
"k256",
|
||||
"once_cell",
|
||||
"revm-primitives 1.0.0",
|
||||
"revm-primitives",
|
||||
"ripemd",
|
||||
"secp256k1 0.26.0",
|
||||
"secp256k1 0.29.0",
|
||||
"sha2",
|
||||
"sha3 0.10.8",
|
||||
"substrate-bn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm-primitives"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-fix#aebf2e591e622e6bcce2c5d4bf3336935a68cf11"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"bytes",
|
||||
"derive_more",
|
||||
"enumn",
|
||||
"fixed-hash",
|
||||
"hashbrown 0.13.2",
|
||||
"hex",
|
||||
"hex-literal 0.3.4",
|
||||
"rlp",
|
||||
"ruint",
|
||||
"sha3 0.10.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm-primitives"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "323ad597cf75ac9cb1d161be29fcc3562426f0278a1d04741697fca556e1ceea"
|
||||
version = "4.0.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v36#8543dd627348907773d8057807b6a310b276bb30"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"auto_impl",
|
||||
|
|
@ -3034,9 +2972,11 @@ dependencies = [
|
|||
"derive_more",
|
||||
"dyn-clone",
|
||||
"enumn",
|
||||
"halo2curves",
|
||||
"hashbrown 0.14.0",
|
||||
"hex",
|
||||
"once_cell",
|
||||
"poseidon-base",
|
||||
"serde",
|
||||
]
|
||||
|
||||
|
|
@ -3058,17 +2998,6 @@ dependencies = [
|
|||
"substrate-bn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rfc6979"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb"
|
||||
dependencies = [
|
||||
"crypto-bigint 0.4.9",
|
||||
"hmac",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rfc6979"
|
||||
version = "0.4.0"
|
||||
|
|
@ -3330,27 +3259,14 @@ dependencies = [
|
|||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sec1"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928"
|
||||
dependencies = [
|
||||
"base16ct 0.1.1",
|
||||
"der 0.6.1",
|
||||
"generic-array",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sec1"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
|
||||
dependencies = [
|
||||
"base16ct 0.2.0",
|
||||
"der 0.7.8",
|
||||
"base16ct",
|
||||
"der",
|
||||
"generic-array",
|
||||
"pkcs8",
|
||||
"subtle",
|
||||
|
|
@ -3368,11 +3284,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "secp256k1"
|
||||
version = "0.26.0"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4124a35fe33ae14259c490fd70fa199a32b9ce9502f2ee6bc4f81ec06fa65894"
|
||||
checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3"
|
||||
dependencies = [
|
||||
"secp256k1-sys 0.8.1",
|
||||
"rand",
|
||||
"secp256k1-sys 0.10.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3386,9 +3303,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "secp256k1-sys"
|
||||
version = "0.8.1"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e"
|
||||
checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
|
@ -3567,16 +3484,6 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "1.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c"
|
||||
dependencies = [
|
||||
"digest 0.10.7",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "2.1.0"
|
||||
|
|
@ -3605,7 +3512,7 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
|||
[[package]]
|
||||
name = "snark-verifier"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/snark-verifier?branch=develop#114cea6cd025f7daf66b8f0038126a796653e207"
|
||||
source = "git+https://github.com/scroll-tech/snark-verifier?branch=develop#18715050bfd0fc55b51daa87a0ff1d5c692727b3"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"ethereum-types",
|
||||
|
|
@ -3628,11 +3535,11 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "snark-verifier-sdk"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/scroll-tech/snark-verifier?branch=develop#114cea6cd025f7daf66b8f0038126a796653e207"
|
||||
source = "git+https://github.com/scroll-tech/snark-verifier?branch=develop#18715050bfd0fc55b51daa87a0ff1d5c692727b3"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"ethereum-types",
|
||||
"ff 0.13.0",
|
||||
"ff",
|
||||
"halo2-base",
|
||||
"hex",
|
||||
"itertools 0.12.1",
|
||||
|
|
@ -3670,7 +3577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der 0.7.8",
|
||||
"der",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3754,9 +3661,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.4.1"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
|
|
@ -4420,9 +4327,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.6.0"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9"
|
||||
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
|
||||
dependencies = [
|
||||
"zeroize_derive",
|
||||
]
|
||||
|
|
@ -4441,7 +4348,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zkevm-circuits"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.10.5#30ed394f24c73a8d1537805f30a43877f1096f4d"
|
||||
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.0rc2#0bed35cd6f3a6d50f7bec3148271c1621f3d2036"
|
||||
dependencies = [
|
||||
"array-init",
|
||||
"bus-mapping",
|
||||
|
|
@ -4450,15 +4357,15 @@ dependencies = [
|
|||
"eth-types",
|
||||
"ethers-core",
|
||||
"ethers-signers",
|
||||
"ff 0.13.0",
|
||||
"ff",
|
||||
"gadgets",
|
||||
"halo2-base",
|
||||
"halo2-ecc",
|
||||
"halo2-mpt-circuits",
|
||||
"halo2_gadgets",
|
||||
"halo2_proofs",
|
||||
"hex",
|
||||
"itertools 0.11.0",
|
||||
"keccak256",
|
||||
"log",
|
||||
"misc-precompiled-circuit",
|
||||
"mock",
|
||||
|
|
@ -4498,8 +4405,48 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zktrie"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/scroll-tech/zktrie.git?tag=v0.7.1#a12f2f262ad3e82301e39ecdf9bfe235befc7074"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#23181f209e94137f74337b150179aeb80c72e7c8"
|
||||
dependencies = [
|
||||
"gobuild",
|
||||
"zktrie_rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zktrie_rust"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#23181f209e94137f74337b150179aeb80c72e7c8"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"lazy_static",
|
||||
"num",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"strum 0.24.1",
|
||||
"strum_macros 0.24.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/scroll-tech/zstd-rs?branch=hack/mul-block#5c0892b6567dab31394d701477183ce9d6a32aca"
|
||||
dependencies = [
|
||||
"zstd-safe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-safe"
|
||||
version = "7.0.0"
|
||||
source = "git+https://github.com/scroll-tech/zstd-rs?branch=hack/mul-block#5c0892b6567dab31394d701477183ce9d6a32aca"
|
||||
dependencies = [
|
||||
"zstd-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-sys"
|
||||
version = "2.0.9+zstd.1.5.5"
|
||||
source = "git+https://github.com/scroll-tech/zstd-rs?branch=hack/mul-block#5c0892b6567dab31394d701477183ce9d6a32aca"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ poseidon = { git = "https://github.com/scroll-tech/poseidon.git", branch = "main
|
|||
bls12_381 = { git = "https://github.com/scroll-tech/bls12_381", branch = "feat/impl_scalar_field" }
|
||||
|
||||
[dependencies]
|
||||
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.10.5", default-features = false, features = ["parallel_syn", "scroll", "shanghai", "strict-ccc"] }
|
||||
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.11.0rc2", default-features = false, features = ["parallel_syn", "scroll", "strict-ccc"] }
|
||||
|
||||
anyhow = "1.0"
|
||||
base64 = "0.13.0"
|
||||
|
|
|
|||
|
|
@ -7,4 +7,3 @@ clean:
|
|||
libzkp:
|
||||
cargo build --release
|
||||
cp $(PWD)/target/release/libzkp.so $(PWD)/
|
||||
find $(PWD)/target | grep libzktrie.so | xargs -I{} cp {} $(PWD)/
|
||||
|
|
|
|||
17
rollup/rollup_sync_service/README.md
Normal file
17
rollup/rollup_sync_service/README.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Running unit tests
|
||||
|
||||
Follow these steps to run unit tests, in the repo's root dir:
|
||||
|
||||
```
|
||||
docker pull scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 --platform linux/amd64
|
||||
docker run -it --rm -v "$(PWD):/workspace" -w /workspace scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03
|
||||
|
||||
export LIBSCROLL_ZSTD_VERSION=v0.1.0-rc0-ubuntu20.04
|
||||
export SCROLL_LIB_PATH=/scroll/lib
|
||||
|
||||
mkdir -p $SCROLL_LIB_PATH
|
||||
wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
|
||||
export CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
|
||||
go test -v -race ./rollup/rollup_sync_service/...
|
||||
```
|
||||
|
|
@ -8,6 +8,11 @@ import (
|
|||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/scroll-tech/da-codec/encoding"
|
||||
"github.com/scroll-tech/da-codec/encoding/codecv0"
|
||||
"github.com/scroll-tech/da-codec/encoding/codecv1"
|
||||
"github.com/scroll-tech/da-codec/encoding/codecv2"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/accounts/abi"
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/core"
|
||||
|
|
@ -20,9 +25,6 @@ import (
|
|||
|
||||
"github.com/scroll-tech/go-ethereum/rollup/rcfg"
|
||||
"github.com/scroll-tech/go-ethereum/rollup/sync_service"
|
||||
"github.com/scroll-tech/go-ethereum/rollup/types/encoding"
|
||||
"github.com/scroll-tech/go-ethereum/rollup/types/encoding/codecv0"
|
||||
"github.com/scroll-tech/go-ethereum/rollup/types/encoding/codecv1"
|
||||
"github.com/scroll-tech/go-ethereum/rollup/withdrawtrie"
|
||||
)
|
||||
|
||||
|
|
@ -325,6 +327,10 @@ func (s *RollupSyncService) getChunkRanges(batchIndex uint64, vLog *types.Log) (
|
|||
return nil, fmt.Errorf("failed to get block by hash, block number: %v, block hash: %v, err: %w", vLog.BlockNumber, vLog.BlockHash.Hex(), err)
|
||||
}
|
||||
|
||||
if block == nil {
|
||||
return nil, fmt.Errorf("failed to get block by hash, block not found, block number: %v, block hash: %v", vLog.BlockNumber, vLog.BlockHash.Hex())
|
||||
}
|
||||
|
||||
found := false
|
||||
for _, txInBlock := range block.Transactions() {
|
||||
if txInBlock.Hash() == vLog.TxHash {
|
||||
|
|
@ -421,12 +427,18 @@ func validateBatch(event *L1FinalizeBatchEvent, parentBatchMeta *rawdb.Finalized
|
|||
return 0, nil, fmt.Errorf("failed to create codecv0 DA batch, batch index: %v, err: %w", event.BatchIndex.Uint64(), err)
|
||||
}
|
||||
localBatchHash = daBatch.Hash()
|
||||
} else {
|
||||
} else if !chainCfg.IsCurie(startBlock.Header.Number) { // codecv1: batches after Bernoulli and before Curie
|
||||
daBatch, err := codecv1.NewDABatch(batch)
|
||||
if err != nil {
|
||||
return 0, nil, fmt.Errorf("failed to create codecv1 DA batch, batch index: %v, err: %w", event.BatchIndex.Uint64(), err)
|
||||
}
|
||||
localBatchHash = daBatch.Hash()
|
||||
} else { // codecv2: batches after Curie
|
||||
daBatch, err := codecv2.NewDABatch(batch)
|
||||
if err != nil {
|
||||
return 0, nil, fmt.Errorf("failed to create codecv1 DA batch, batch index: %v, err: %w", event.BatchIndex.Uint64(), err)
|
||||
}
|
||||
localBatchHash = daBatch.Hash()
|
||||
}
|
||||
|
||||
// Note: If the batch headers match, this ensures the consistency of blocks and transactions
|
||||
|
|
@ -474,11 +486,10 @@ func decodeBlockRangesFromEncodedChunks(codecVersion encoding.CodecVersion, chun
|
|||
for i := 0; i < numBlocks; i++ {
|
||||
startIdx := 1 + i*60 // add 1 to skip numBlocks byte
|
||||
endIdx := startIdx + 60
|
||||
daBlock, err := codecv0.DecodeDABlock(chunk[startIdx:endIdx])
|
||||
if err != nil {
|
||||
daBlocks[i] = &codecv0.DABlock{}
|
||||
if err := daBlocks[i].Decode(chunk[startIdx:endIdx]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
daBlocks[i] = daBlock
|
||||
}
|
||||
|
||||
chunkBlockRanges = append(chunkBlockRanges, &rawdb.ChunkBlockRange{
|
||||
|
|
@ -493,11 +504,28 @@ func decodeBlockRangesFromEncodedChunks(codecVersion encoding.CodecVersion, chun
|
|||
for i := 0; i < numBlocks; i++ {
|
||||
startIdx := 1 + i*60 // add 1 to skip numBlocks byte
|
||||
endIdx := startIdx + 60
|
||||
daBlock, err := codecv1.DecodeDABlock(chunk[startIdx:endIdx])
|
||||
if err != nil {
|
||||
daBlocks[i] = &codecv1.DABlock{}
|
||||
if err := daBlocks[i].Decode(chunk[startIdx:endIdx]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
chunkBlockRanges = append(chunkBlockRanges, &rawdb.ChunkBlockRange{
|
||||
StartBlockNumber: daBlocks[0].BlockNumber,
|
||||
EndBlockNumber: daBlocks[len(daBlocks)-1].BlockNumber,
|
||||
})
|
||||
case encoding.CodecV2:
|
||||
if len(chunk) != 1+numBlocks*60 {
|
||||
return nil, fmt.Errorf("invalid chunk byte length, expected: %v, got: %v", 1+numBlocks*60, len(chunk))
|
||||
}
|
||||
daBlocks := make([]*codecv2.DABlock, numBlocks)
|
||||
for i := 0; i < numBlocks; i++ {
|
||||
startIdx := 1 + i*60 // add 1 to skip numBlocks byte
|
||||
endIdx := startIdx + 60
|
||||
daBlocks[i] = &codecv2.DABlock{}
|
||||
if err := daBlocks[i].Decode(chunk[startIdx:endIdx]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
daBlocks[i] = daBlock
|
||||
}
|
||||
|
||||
chunkBlockRanges = append(chunkBlockRanges, &rawdb.ChunkBlockRange{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/scroll-tech/da-codec/encoding"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
|
|
@ -19,8 +20,6 @@ import (
|
|||
"github.com/scroll-tech/go-ethereum/ethdb/memorydb"
|
||||
"github.com/scroll-tech/go-ethereum/node"
|
||||
"github.com/scroll-tech/go-ethereum/params"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/rollup/types/encoding"
|
||||
)
|
||||
|
||||
func TestRollupSyncServiceStartAndStop(t *testing.T) {
|
||||
|
|
@ -159,6 +158,57 @@ func TestDecodeChunkRangesCodecv1(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestDecodeChunkRangesCodecv2(t *testing.T) {
|
||||
scrollChainABI, err := scrollChainMetaData.GetAbi()
|
||||
require.NoError(t, err)
|
||||
|
||||
service := &RollupSyncService{
|
||||
scrollChainABI: scrollChainABI,
|
||||
}
|
||||
|
||||
data, err := os.ReadFile("./testdata/commitBatch_input_codecv2.json")
|
||||
require.NoError(t, err, "Failed to read json file")
|
||||
|
||||
type tx struct {
|
||||
Input string `json:"input"`
|
||||
}
|
||||
var commitBatch tx
|
||||
err = json.Unmarshal(data, &commitBatch)
|
||||
require.NoError(t, err, "Failed to unmarshal transaction json")
|
||||
|
||||
testTxData, err := hex.DecodeString(commitBatch.Input[2:])
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to decode string: %v", err)
|
||||
}
|
||||
|
||||
ranges, err := service.decodeChunkBlockRanges(testTxData)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to decode chunk ranges: %v", err)
|
||||
}
|
||||
|
||||
expectedRanges := []*rawdb.ChunkBlockRange{
|
||||
{StartBlockNumber: 200, EndBlockNumber: 290},
|
||||
{StartBlockNumber: 291, EndBlockNumber: 381},
|
||||
{StartBlockNumber: 382, EndBlockNumber: 472},
|
||||
{StartBlockNumber: 473, EndBlockNumber: 563},
|
||||
{StartBlockNumber: 564, EndBlockNumber: 654},
|
||||
{StartBlockNumber: 655, EndBlockNumber: 745},
|
||||
{StartBlockNumber: 746, EndBlockNumber: 836},
|
||||
{StartBlockNumber: 837, EndBlockNumber: 927},
|
||||
{StartBlockNumber: 928, EndBlockNumber: 1018},
|
||||
}
|
||||
|
||||
if len(expectedRanges) != len(ranges) {
|
||||
t.Fatalf("Expected range length %v, got %v", len(expectedRanges), len(ranges))
|
||||
}
|
||||
|
||||
for i := range ranges {
|
||||
if *expectedRanges[i] != *ranges[i] {
|
||||
t.Errorf("Mismatch at index %d: expected %v, got %v", i, *expectedRanges[i], *ranges[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetChunkRangesCodecv0(t *testing.T) {
|
||||
genesisConfig := ¶ms.ChainConfig{
|
||||
Scroll: params.ScrollConfig{
|
||||
|
|
@ -261,7 +311,87 @@ func TestGetChunkRangesCodecv1(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetChunkRangesCodecv2(t *testing.T) {
|
||||
genesisConfig := ¶ms.ChainConfig{
|
||||
Scroll: params.ScrollConfig{
|
||||
L1Config: ¶ms.L1Config{
|
||||
L1ChainId: 11155111,
|
||||
ScrollChainAddress: common.HexToAddress("0x2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0"),
|
||||
},
|
||||
},
|
||||
}
|
||||
db := rawdb.NewDatabase(memorydb.New())
|
||||
|
||||
rlpData, err := os.ReadFile("./testdata/commitBatch_codecv2.rlp")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to read RLP data: %v", err)
|
||||
}
|
||||
l1Client := &mockEthClient{
|
||||
commitBatchRLP: rlpData,
|
||||
}
|
||||
bc := &core.BlockChain{}
|
||||
stack, err := node.New(&node.DefaultConfig)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to new P2P node: %v", err)
|
||||
}
|
||||
defer stack.Close()
|
||||
service, err := NewRollupSyncService(context.Background(), genesisConfig, db, l1Client, bc, stack)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to new rollup sync service: %v", err)
|
||||
}
|
||||
|
||||
vLog := &types.Log{
|
||||
TxHash: common.HexToHash("0x2"),
|
||||
}
|
||||
ranges, err := service.getChunkRanges(1, vLog)
|
||||
require.NoError(t, err)
|
||||
|
||||
expectedRanges := []*rawdb.ChunkBlockRange{
|
||||
{StartBlockNumber: 143, EndBlockNumber: 143},
|
||||
{StartBlockNumber: 144, EndBlockNumber: 144},
|
||||
{StartBlockNumber: 145, EndBlockNumber: 145},
|
||||
{StartBlockNumber: 146, EndBlockNumber: 146},
|
||||
{StartBlockNumber: 147, EndBlockNumber: 147},
|
||||
{StartBlockNumber: 148, EndBlockNumber: 148},
|
||||
{StartBlockNumber: 149, EndBlockNumber: 149},
|
||||
{StartBlockNumber: 150, EndBlockNumber: 150},
|
||||
{StartBlockNumber: 151, EndBlockNumber: 151},
|
||||
{StartBlockNumber: 152, EndBlockNumber: 152},
|
||||
{StartBlockNumber: 153, EndBlockNumber: 153},
|
||||
{StartBlockNumber: 154, EndBlockNumber: 154},
|
||||
{StartBlockNumber: 155, EndBlockNumber: 155},
|
||||
{StartBlockNumber: 156, EndBlockNumber: 156},
|
||||
{StartBlockNumber: 157, EndBlockNumber: 157},
|
||||
{StartBlockNumber: 158, EndBlockNumber: 158},
|
||||
{StartBlockNumber: 159, EndBlockNumber: 159},
|
||||
{StartBlockNumber: 160, EndBlockNumber: 160},
|
||||
{StartBlockNumber: 161, EndBlockNumber: 161},
|
||||
{StartBlockNumber: 162, EndBlockNumber: 162},
|
||||
{StartBlockNumber: 163, EndBlockNumber: 163},
|
||||
{StartBlockNumber: 164, EndBlockNumber: 164},
|
||||
{StartBlockNumber: 165, EndBlockNumber: 168},
|
||||
{StartBlockNumber: 169, EndBlockNumber: 169},
|
||||
{StartBlockNumber: 170, EndBlockNumber: 170},
|
||||
{StartBlockNumber: 171, EndBlockNumber: 171},
|
||||
{StartBlockNumber: 172, EndBlockNumber: 172},
|
||||
{StartBlockNumber: 173, EndBlockNumber: 173},
|
||||
{StartBlockNumber: 174, EndBlockNumber: 174},
|
||||
}
|
||||
|
||||
if len(expectedRanges) != len(ranges) {
|
||||
t.Fatalf("Expected range length %v, got %v", len(expectedRanges), len(ranges))
|
||||
}
|
||||
|
||||
for i := range ranges {
|
||||
if *expectedRanges[i] != *ranges[i] {
|
||||
t.Fatalf("Mismatch at index %d: expected %v, got %v", i, *expectedRanges[i], *ranges[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateBatchCodecv0(t *testing.T) {
|
||||
chainConfig := ¶ms.ChainConfig{}
|
||||
|
||||
block1 := readBlockFromJSON(t, "./testdata/blockTrace_02.json")
|
||||
chunk1 := &encoding.Chunk{Blocks: []*encoding.Block{block1}}
|
||||
|
||||
|
|
@ -279,7 +409,7 @@ func TestValidateBatchCodecv0(t *testing.T) {
|
|||
WithdrawRoot: chunk3.Blocks[len(chunk3.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
|
||||
endBlock1, finalizedBatchMeta1, err := validateBatch(event1, parentBatchMeta1, []*encoding.Chunk{chunk1, chunk2, chunk3}, ¶ms.ChainConfig{}, nil)
|
||||
endBlock1, finalizedBatchMeta1, err := validateBatch(event1, parentBatchMeta1, []*encoding.Chunk{chunk1, chunk2, chunk3}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(13), endBlock1)
|
||||
|
||||
|
|
@ -289,8 +419,8 @@ func TestValidateBatchCodecv0(t *testing.T) {
|
|||
parentBatchMeta2 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event1.BatchHash,
|
||||
TotalL1MessagePopped: 11,
|
||||
StateRoot: chunk3.Blocks[len(chunk3.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk3.Blocks[len(chunk3.Blocks)-1].WithdrawRoot,
|
||||
StateRoot: event1.StateRoot,
|
||||
WithdrawRoot: event1.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta2, finalizedBatchMeta1)
|
||||
event2 := &L1FinalizeBatchEvent{
|
||||
|
|
@ -299,20 +429,22 @@ func TestValidateBatchCodecv0(t *testing.T) {
|
|||
StateRoot: chunk4.Blocks[len(chunk4.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk4.Blocks[len(chunk4.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
endBlock2, finalizedBatchMeta2, err := validateBatch(event2, parentBatchMeta2, []*encoding.Chunk{chunk4}, ¶ms.ChainConfig{}, nil)
|
||||
endBlock2, finalizedBatchMeta2, err := validateBatch(event2, parentBatchMeta2, []*encoding.Chunk{chunk4}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(17), endBlock2)
|
||||
|
||||
parentBatchMeta3 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event2.BatchHash,
|
||||
TotalL1MessagePopped: 42,
|
||||
StateRoot: chunk4.Blocks[len(chunk4.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk4.Blocks[len(chunk4.Blocks)-1].WithdrawRoot,
|
||||
StateRoot: event2.StateRoot,
|
||||
WithdrawRoot: event2.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta3, finalizedBatchMeta2)
|
||||
}
|
||||
|
||||
func TestValidateBatchCodecv1(t *testing.T) {
|
||||
chainConfig := ¶ms.ChainConfig{BernoulliBlock: big.NewInt(0)}
|
||||
|
||||
block1 := readBlockFromJSON(t, "./testdata/blockTrace_02.json")
|
||||
chunk1 := &encoding.Chunk{Blocks: []*encoding.Block{block1}}
|
||||
|
||||
|
|
@ -330,7 +462,7 @@ func TestValidateBatchCodecv1(t *testing.T) {
|
|||
WithdrawRoot: chunk3.Blocks[len(chunk3.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
|
||||
endBlock1, finalizedBatchMeta1, err := validateBatch(event1, parentBatchMeta1, []*encoding.Chunk{chunk1, chunk2, chunk3}, ¶ms.ChainConfig{BernoulliBlock: big.NewInt(0)}, nil)
|
||||
endBlock1, finalizedBatchMeta1, err := validateBatch(event1, parentBatchMeta1, []*encoding.Chunk{chunk1, chunk2, chunk3}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(13), endBlock1)
|
||||
|
||||
|
|
@ -340,30 +472,32 @@ func TestValidateBatchCodecv1(t *testing.T) {
|
|||
parentBatchMeta2 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event1.BatchHash,
|
||||
TotalL1MessagePopped: 11,
|
||||
StateRoot: chunk3.Blocks[len(chunk3.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk3.Blocks[len(chunk3.Blocks)-1].WithdrawRoot,
|
||||
StateRoot: event1.StateRoot,
|
||||
WithdrawRoot: event1.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta2, finalizedBatchMeta1)
|
||||
event2 := &L1FinalizeBatchEvent{
|
||||
BatchIndex: big.NewInt(1),
|
||||
BatchHash: common.HexToHash("0x8eb3f63fbf286bb51a49879bfc653c53c890621542c640e5b6163cffb5a47aa6"),
|
||||
BatchHash: common.HexToHash("0x7f230ce84b4bf86f8ee22ffb5c145e3ef3ddf2a76da4936a33f33cebdb63a48a"),
|
||||
StateRoot: chunk4.Blocks[len(chunk4.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk4.Blocks[len(chunk4.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
endBlock2, finalizedBatchMeta2, err := validateBatch(event2, parentBatchMeta2, []*encoding.Chunk{chunk4}, ¶ms.ChainConfig{BernoulliBlock: big.NewInt(0)}, nil)
|
||||
endBlock2, finalizedBatchMeta2, err := validateBatch(event2, parentBatchMeta2, []*encoding.Chunk{chunk4}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(17), endBlock2)
|
||||
|
||||
parentBatchMeta3 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event2.BatchHash,
|
||||
TotalL1MessagePopped: 42,
|
||||
StateRoot: chunk4.Blocks[len(chunk4.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk4.Blocks[len(chunk4.Blocks)-1].WithdrawRoot,
|
||||
StateRoot: event2.StateRoot,
|
||||
WithdrawRoot: event2.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta3, finalizedBatchMeta2)
|
||||
}
|
||||
|
||||
func TestValidateBatchFromCodecv0ToCodecv1(t *testing.T) {
|
||||
func TestValidateBatchCodecv2(t *testing.T) {
|
||||
chainConfig := ¶ms.ChainConfig{BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0)}
|
||||
|
||||
block1 := readBlockFromJSON(t, "./testdata/blockTrace_02.json")
|
||||
chunk1 := &encoding.Chunk{Blocks: []*encoding.Block{block1}}
|
||||
|
||||
|
|
@ -376,12 +510,12 @@ func TestValidateBatchFromCodecv0ToCodecv1(t *testing.T) {
|
|||
parentBatchMeta1 := &rawdb.FinalizedBatchMeta{}
|
||||
event1 := &L1FinalizeBatchEvent{
|
||||
BatchIndex: big.NewInt(0),
|
||||
BatchHash: common.HexToHash("0xfd3ecf106ce993adc6db68e42ce701bfe638434395abdeeb871f7bd395ae2368"),
|
||||
BatchHash: common.HexToHash("0xaccf37a0b974f2058692d366b2ea85502c99db4a0bcb9b77903b49bf866a463b"),
|
||||
StateRoot: chunk3.Blocks[len(chunk3.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk3.Blocks[len(chunk3.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
|
||||
endBlock1, finalizedBatchMeta1, err := validateBatch(event1, parentBatchMeta1, []*encoding.Chunk{chunk1, chunk2, chunk3}, ¶ms.ChainConfig{BernoulliBlock: big.NewInt(16)}, nil)
|
||||
endBlock1, finalizedBatchMeta1, err := validateBatch(event1, parentBatchMeta1, []*encoding.Chunk{chunk1, chunk2, chunk3}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(13), endBlock1)
|
||||
|
||||
|
|
@ -391,29 +525,99 @@ func TestValidateBatchFromCodecv0ToCodecv1(t *testing.T) {
|
|||
parentBatchMeta2 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event1.BatchHash,
|
||||
TotalL1MessagePopped: 11,
|
||||
StateRoot: chunk3.Blocks[len(chunk3.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk3.Blocks[len(chunk3.Blocks)-1].WithdrawRoot,
|
||||
StateRoot: event1.StateRoot,
|
||||
WithdrawRoot: event1.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta2, finalizedBatchMeta1)
|
||||
event2 := &L1FinalizeBatchEvent{
|
||||
BatchIndex: big.NewInt(1),
|
||||
BatchHash: common.HexToHash("0x425ab2830087e2642f0407550d65f108ee93533063ef0bfab1263b0b3c8a4c9e"),
|
||||
BatchHash: common.HexToHash("0x62ec61e1fdb334868ffd471df601f6858e692af01d42b5077c805a9fd4558c91"),
|
||||
StateRoot: chunk4.Blocks[len(chunk4.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk4.Blocks[len(chunk4.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
endBlock2, finalizedBatchMeta2, err := validateBatch(event2, parentBatchMeta2, []*encoding.Chunk{chunk4}, ¶ms.ChainConfig{BernoulliBlock: big.NewInt(16)}, nil)
|
||||
endBlock2, finalizedBatchMeta2, err := validateBatch(event2, parentBatchMeta2, []*encoding.Chunk{chunk4}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(17), endBlock2)
|
||||
|
||||
parentBatchMeta3 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event2.BatchHash,
|
||||
TotalL1MessagePopped: 42,
|
||||
StateRoot: chunk4.Blocks[len(chunk4.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk4.Blocks[len(chunk4.Blocks)-1].WithdrawRoot,
|
||||
StateRoot: event2.StateRoot,
|
||||
WithdrawRoot: event2.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta3, finalizedBatchMeta2)
|
||||
}
|
||||
|
||||
func TestValidateBatchUpgrades(t *testing.T) {
|
||||
chainConfig := ¶ms.ChainConfig{BernoulliBlock: big.NewInt(14), CurieBlock: big.NewInt(16)}
|
||||
|
||||
block1 := readBlockFromJSON(t, "./testdata/blockTrace_02.json")
|
||||
chunk1 := &encoding.Chunk{Blocks: []*encoding.Block{block1}}
|
||||
|
||||
block2 := readBlockFromJSON(t, "./testdata/blockTrace_03.json")
|
||||
chunk2 := &encoding.Chunk{Blocks: []*encoding.Block{block2}}
|
||||
|
||||
parentBatchMeta1 := &rawdb.FinalizedBatchMeta{}
|
||||
event1 := &L1FinalizeBatchEvent{
|
||||
BatchIndex: big.NewInt(0),
|
||||
BatchHash: common.HexToHash("0xb501030a30bf3936aaf7d50ae175035ecfa04c8ce0031de3936300cf2718c427"),
|
||||
StateRoot: chunk2.Blocks[len(chunk2.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk2.Blocks[len(chunk2.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
|
||||
endBlock1, finalizedBatchMeta1, err := validateBatch(event1, parentBatchMeta1, []*encoding.Chunk{chunk1, chunk2}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(3), endBlock1)
|
||||
|
||||
block3 := readBlockFromJSON(t, "./testdata/blockTrace_04.json")
|
||||
chunk3 := &encoding.Chunk{Blocks: []*encoding.Block{block3}}
|
||||
|
||||
parentBatchMeta2 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event1.BatchHash,
|
||||
TotalL1MessagePopped: 0,
|
||||
StateRoot: event1.StateRoot,
|
||||
WithdrawRoot: event1.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta2, finalizedBatchMeta1)
|
||||
event2 := &L1FinalizeBatchEvent{
|
||||
BatchIndex: big.NewInt(1),
|
||||
BatchHash: common.HexToHash("0x1879659b3cdc1039a9db62f4ac5a6d0d8f2aaa13ff484917d603fe04eaf2d7c1"),
|
||||
StateRoot: chunk3.Blocks[len(chunk3.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk3.Blocks[len(chunk3.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
endBlock2, finalizedBatchMeta2, err := validateBatch(event2, parentBatchMeta2, []*encoding.Chunk{chunk3}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(13), endBlock2)
|
||||
|
||||
block4 := readBlockFromJSON(t, "./testdata/blockTrace_05.json")
|
||||
chunk4 := &encoding.Chunk{Blocks: []*encoding.Block{block4}}
|
||||
|
||||
parentBatchMeta3 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event2.BatchHash,
|
||||
TotalL1MessagePopped: 11,
|
||||
StateRoot: event2.StateRoot,
|
||||
WithdrawRoot: event2.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta3, finalizedBatchMeta2)
|
||||
event3 := &L1FinalizeBatchEvent{
|
||||
BatchIndex: big.NewInt(2),
|
||||
BatchHash: common.HexToHash("0x871ba3c4ed8821ffc438c5468f1e996a6c4325fd8b53066c2783e54b3b7e9e24"),
|
||||
StateRoot: chunk4.Blocks[len(chunk4.Blocks)-1].Header.Root,
|
||||
WithdrawRoot: chunk4.Blocks[len(chunk4.Blocks)-1].WithdrawRoot,
|
||||
}
|
||||
endBlock3, finalizedBatchMeta3, err := validateBatch(event3, parentBatchMeta3, []*encoding.Chunk{chunk4}, chainConfig, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, uint64(17), endBlock3)
|
||||
|
||||
parentBatchMeta4 := &rawdb.FinalizedBatchMeta{
|
||||
BatchHash: event3.BatchHash,
|
||||
TotalL1MessagePopped: 42,
|
||||
StateRoot: event3.StateRoot,
|
||||
WithdrawRoot: event3.WithdrawRoot,
|
||||
}
|
||||
assert.Equal(t, parentBatchMeta4, finalizedBatchMeta3)
|
||||
}
|
||||
|
||||
func readBlockFromJSON(t *testing.T, filename string) *encoding.Block {
|
||||
data, err := os.ReadFile(filename)
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
BIN
rollup/rollup_sync_service/testdata/commitBatch_codecv2.rlp
vendored
Normal file
BIN
rollup/rollup_sync_service/testdata/commitBatch_codecv2.rlp
vendored
Normal file
Binary file not shown.
31
rollup/rollup_sync_service/testdata/commitBatch_input_codecv2.json
vendored
Normal file
31
rollup/rollup_sync_service/testdata/commitBatch_input_codecv2.json
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,64 +0,0 @@
|
|||
package encoding
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/core/types"
|
||||
)
|
||||
|
||||
// ConstructSkippedBitmap constructs skipped L1 message bitmap of the batch.
|
||||
func ConstructSkippedBitmap(batchIndex uint64, chunks []*Chunk, totalL1MessagePoppedBefore uint64) ([]byte, uint64, error) {
|
||||
// skipped L1 message bitmap, an array of 256-bit bitmaps
|
||||
var skippedBitmap []*big.Int
|
||||
|
||||
// the first queue index that belongs to this batch
|
||||
baseIndex := totalL1MessagePoppedBefore
|
||||
|
||||
// the next queue index that we need to process
|
||||
nextIndex := totalL1MessagePoppedBefore
|
||||
|
||||
for chunkID, chunk := range chunks {
|
||||
for blockID, block := range chunk.Blocks {
|
||||
for _, tx := range block.Transactions {
|
||||
if tx.Type != types.L1MessageTxType {
|
||||
continue
|
||||
}
|
||||
currentIndex := tx.Nonce
|
||||
|
||||
if currentIndex < nextIndex {
|
||||
return nil, 0, fmt.Errorf("unexpected batch payload, expected queue index: %d, got: %d. Batch index: %d, chunk index in batch: %d, block index in chunk: %d, block hash: %v, transaction hash: %v", nextIndex, currentIndex, batchIndex, chunkID, blockID, block.Header.Hash(), tx.TxHash)
|
||||
}
|
||||
|
||||
// mark skipped messages
|
||||
for skippedIndex := nextIndex; skippedIndex < currentIndex; skippedIndex++ {
|
||||
quo := int((skippedIndex - baseIndex) / 256)
|
||||
rem := int((skippedIndex - baseIndex) % 256)
|
||||
for len(skippedBitmap) <= quo {
|
||||
bitmap := big.NewInt(0)
|
||||
skippedBitmap = append(skippedBitmap, bitmap)
|
||||
}
|
||||
skippedBitmap[quo].SetBit(skippedBitmap[quo], rem, 1)
|
||||
}
|
||||
|
||||
// process included message
|
||||
quo := int((currentIndex - baseIndex) / 256)
|
||||
for len(skippedBitmap) <= quo {
|
||||
bitmap := big.NewInt(0)
|
||||
skippedBitmap = append(skippedBitmap, bitmap)
|
||||
}
|
||||
|
||||
nextIndex = currentIndex + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bitmapBytes := make([]byte, len(skippedBitmap)*32)
|
||||
for ii, num := range skippedBitmap {
|
||||
bytes := num.Bytes()
|
||||
padding := 32 - len(bytes)
|
||||
copy(bitmapBytes[32*ii+padding:], bytes)
|
||||
}
|
||||
|
||||
return bitmapBytes, nextIndex, nil
|
||||
}
|
||||
|
|
@ -1,480 +0,0 @@
|
|||
package codecv0
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/core/types"
|
||||
"github.com/scroll-tech/go-ethereum/crypto"
|
||||
"github.com/scroll-tech/go-ethereum/rollup/types/encoding"
|
||||
)
|
||||
|
||||
// CodecV0Version denotes the version of the codec.
|
||||
const CodecV0Version = 0
|
||||
|
||||
// DABlock represents a Data Availability Block.
|
||||
type DABlock struct {
|
||||
BlockNumber uint64
|
||||
Timestamp uint64
|
||||
BaseFee *big.Int
|
||||
GasLimit uint64
|
||||
NumTransactions uint16
|
||||
NumL1Messages uint16
|
||||
}
|
||||
|
||||
// DAChunk groups consecutive DABlocks with their transactions.
|
||||
type DAChunk struct {
|
||||
Blocks []*DABlock
|
||||
Transactions [][]*types.TransactionData
|
||||
}
|
||||
|
||||
// DABatch contains metadata about a batch of DAChunks.
|
||||
type DABatch struct {
|
||||
Version uint8
|
||||
BatchIndex uint64
|
||||
L1MessagePopped uint64
|
||||
TotalL1MessagePopped uint64
|
||||
DataHash common.Hash
|
||||
ParentBatchHash common.Hash
|
||||
SkippedL1MessageBitmap []byte
|
||||
}
|
||||
|
||||
// NewDABlock creates a new DABlock from the given encoding.Block and the total number of L1 messages popped before.
|
||||
func NewDABlock(block *encoding.Block, totalL1MessagePoppedBefore uint64) (*DABlock, error) {
|
||||
if !block.Header.Number.IsUint64() {
|
||||
return nil, errors.New("block number is not uint64")
|
||||
}
|
||||
|
||||
// note: numL1Messages includes skipped messages
|
||||
numL1Messages := block.NumL1Messages(totalL1MessagePoppedBefore)
|
||||
if numL1Messages > math.MaxUint16 {
|
||||
return nil, errors.New("number of L1 messages exceeds max uint16")
|
||||
}
|
||||
|
||||
// note: numTransactions includes skipped messages
|
||||
numL2Transactions := block.NumL2Transactions()
|
||||
numTransactions := numL1Messages + numL2Transactions
|
||||
if numTransactions > math.MaxUint16 {
|
||||
return nil, errors.New("number of transactions exceeds max uint16")
|
||||
}
|
||||
|
||||
daBlock := DABlock{
|
||||
BlockNumber: block.Header.Number.Uint64(),
|
||||
Timestamp: block.Header.Time,
|
||||
BaseFee: block.Header.BaseFee,
|
||||
GasLimit: block.Header.GasLimit,
|
||||
NumTransactions: uint16(numTransactions),
|
||||
NumL1Messages: uint16(numL1Messages),
|
||||
}
|
||||
|
||||
return &daBlock, nil
|
||||
}
|
||||
|
||||
// Encode serializes the DABlock into a slice of bytes.
|
||||
func (b *DABlock) Encode() []byte {
|
||||
bytes := make([]byte, 60)
|
||||
binary.BigEndian.PutUint64(bytes[0:], b.BlockNumber)
|
||||
binary.BigEndian.PutUint64(bytes[8:], b.Timestamp)
|
||||
if b.BaseFee != nil {
|
||||
binary.BigEndian.PutUint64(bytes[40:], b.BaseFee.Uint64())
|
||||
}
|
||||
binary.BigEndian.PutUint64(bytes[48:], b.GasLimit)
|
||||
binary.BigEndian.PutUint16(bytes[56:], b.NumTransactions)
|
||||
binary.BigEndian.PutUint16(bytes[58:], b.NumL1Messages)
|
||||
return bytes
|
||||
}
|
||||
|
||||
// DecodeDABlock takes a byte slice and decodes it into a DABlock.
|
||||
func DecodeDABlock(bytes []byte) (*DABlock, error) {
|
||||
if len(bytes) != 60 {
|
||||
return nil, errors.New("block encoding is not 60 bytes long")
|
||||
}
|
||||
|
||||
block := &DABlock{
|
||||
BlockNumber: binary.BigEndian.Uint64(bytes[0:8]),
|
||||
Timestamp: binary.BigEndian.Uint64(bytes[8:16]),
|
||||
BaseFee: new(big.Int).SetUint64(binary.BigEndian.Uint64(bytes[40:48])),
|
||||
GasLimit: binary.BigEndian.Uint64(bytes[48:56]),
|
||||
NumTransactions: binary.BigEndian.Uint16(bytes[56:58]),
|
||||
NumL1Messages: binary.BigEndian.Uint16(bytes[58:60]),
|
||||
}
|
||||
|
||||
return block, nil
|
||||
}
|
||||
|
||||
// NewDAChunk creates a new DAChunk from the given encoding.Chunk and the total number of L1 messages popped before.
|
||||
func NewDAChunk(chunk *encoding.Chunk, totalL1MessagePoppedBefore uint64) (*DAChunk, error) {
|
||||
var blocks []*DABlock
|
||||
var txs [][]*types.TransactionData
|
||||
|
||||
if chunk == nil {
|
||||
return nil, errors.New("chunk is nil")
|
||||
}
|
||||
|
||||
if len(chunk.Blocks) == 0 {
|
||||
return nil, errors.New("number of blocks is 0")
|
||||
}
|
||||
|
||||
if len(chunk.Blocks) > 255 {
|
||||
return nil, errors.New("number of blocks exceeds 1 byte")
|
||||
}
|
||||
|
||||
for _, block := range chunk.Blocks {
|
||||
b, err := NewDABlock(block, totalL1MessagePoppedBefore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blocks = append(blocks, b)
|
||||
totalL1MessagePoppedBefore += block.NumL1Messages(totalL1MessagePoppedBefore)
|
||||
txs = append(txs, block.Transactions)
|
||||
}
|
||||
|
||||
daChunk := DAChunk{
|
||||
Blocks: blocks,
|
||||
Transactions: txs,
|
||||
}
|
||||
|
||||
return &daChunk, nil
|
||||
}
|
||||
|
||||
// Encode serializes the DAChunk into a slice of bytes.
|
||||
func (c *DAChunk) Encode() ([]byte, error) {
|
||||
var chunkBytes []byte
|
||||
chunkBytes = append(chunkBytes, byte(len(c.Blocks)))
|
||||
|
||||
var l2TxDataBytes []byte
|
||||
|
||||
for _, block := range c.Blocks {
|
||||
chunkBytes = append(chunkBytes, block.Encode()...)
|
||||
}
|
||||
|
||||
for _, blockTxs := range c.Transactions {
|
||||
for _, txData := range blockTxs {
|
||||
if txData.Type == types.L1MessageTxType {
|
||||
continue
|
||||
}
|
||||
var txLen [4]byte
|
||||
rlpTxData, err := encoding.ConvertTxDataToRLPEncoding(txData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
binary.BigEndian.PutUint32(txLen[:], uint32(len(rlpTxData)))
|
||||
l2TxDataBytes = append(l2TxDataBytes, txLen[:]...)
|
||||
l2TxDataBytes = append(l2TxDataBytes, rlpTxData...)
|
||||
}
|
||||
}
|
||||
|
||||
chunkBytes = append(chunkBytes, l2TxDataBytes...)
|
||||
return chunkBytes, nil
|
||||
}
|
||||
|
||||
// Hash computes the hash of the DAChunk data.
|
||||
func (c *DAChunk) Hash() (common.Hash, error) {
|
||||
chunkBytes, err := c.Encode()
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
|
||||
if len(chunkBytes) == 0 {
|
||||
return common.Hash{}, errors.New("chunk data is empty and cannot be processed")
|
||||
}
|
||||
numBlocks := chunkBytes[0]
|
||||
|
||||
// concatenate block contexts
|
||||
var dataBytes []byte
|
||||
for i := 0; i < int(numBlocks); i++ {
|
||||
// only the first 58 bytes of each BlockContext are needed for the hashing process
|
||||
dataBytes = append(dataBytes, chunkBytes[1+60*i:60*i+59]...)
|
||||
}
|
||||
|
||||
// concatenate l1 and l2 tx hashes
|
||||
for _, blockTxs := range c.Transactions {
|
||||
var l1TxHashes []byte
|
||||
var l2TxHashes []byte
|
||||
for _, txData := range blockTxs {
|
||||
txHash := strings.TrimPrefix(txData.TxHash, "0x")
|
||||
hashBytes, err := hex.DecodeString(txHash)
|
||||
if err != nil {
|
||||
return common.Hash{}, fmt.Errorf("failed to decode tx hash from TransactionData: hash=%v, err=%w", txData.TxHash, err)
|
||||
}
|
||||
if txData.Type == types.L1MessageTxType {
|
||||
l1TxHashes = append(l1TxHashes, hashBytes...)
|
||||
} else {
|
||||
l2TxHashes = append(l2TxHashes, hashBytes...)
|
||||
}
|
||||
}
|
||||
dataBytes = append(dataBytes, l1TxHashes...)
|
||||
dataBytes = append(dataBytes, l2TxHashes...)
|
||||
}
|
||||
|
||||
hash := crypto.Keccak256Hash(dataBytes)
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
// NewDABatch creates a DABatch from the provided encoding.Batch.
|
||||
func NewDABatch(batch *encoding.Batch) (*DABatch, error) {
|
||||
// compute batch data hash
|
||||
var dataBytes []byte
|
||||
totalL1MessagePoppedBeforeChunk := batch.TotalL1MessagePoppedBefore
|
||||
|
||||
for _, chunk := range batch.Chunks {
|
||||
// build data hash
|
||||
daChunk, err := NewDAChunk(chunk, totalL1MessagePoppedBeforeChunk)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
totalL1MessagePoppedBeforeChunk += chunk.NumL1Messages(totalL1MessagePoppedBeforeChunk)
|
||||
daChunkHash, err := daChunk.Hash()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataBytes = append(dataBytes, daChunkHash.Bytes()...)
|
||||
}
|
||||
|
||||
// compute data hash
|
||||
dataHash := crypto.Keccak256Hash(dataBytes)
|
||||
|
||||
// skipped L1 messages bitmap
|
||||
bitmapBytes, totalL1MessagePoppedAfter, err := encoding.ConstructSkippedBitmap(batch.Index, batch.Chunks, batch.TotalL1MessagePoppedBefore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
daBatch := DABatch{
|
||||
Version: CodecV0Version,
|
||||
BatchIndex: batch.Index,
|
||||
L1MessagePopped: totalL1MessagePoppedAfter - batch.TotalL1MessagePoppedBefore,
|
||||
TotalL1MessagePopped: totalL1MessagePoppedAfter,
|
||||
DataHash: dataHash,
|
||||
ParentBatchHash: batch.ParentBatchHash,
|
||||
SkippedL1MessageBitmap: bitmapBytes,
|
||||
}
|
||||
|
||||
return &daBatch, nil
|
||||
}
|
||||
|
||||
// NewDABatchFromBytes attempts to decode the given byte slice into a DABatch.
|
||||
func NewDABatchFromBytes(data []byte) (*DABatch, error) {
|
||||
if len(data) < 89 {
|
||||
return nil, fmt.Errorf("insufficient data for DABatch, expected at least 89 bytes but got %d", len(data))
|
||||
}
|
||||
|
||||
b := &DABatch{
|
||||
Version: data[0],
|
||||
BatchIndex: binary.BigEndian.Uint64(data[1:9]),
|
||||
L1MessagePopped: binary.BigEndian.Uint64(data[9:17]),
|
||||
TotalL1MessagePopped: binary.BigEndian.Uint64(data[17:25]),
|
||||
DataHash: common.BytesToHash(data[25:57]),
|
||||
ParentBatchHash: common.BytesToHash(data[57:89]),
|
||||
SkippedL1MessageBitmap: data[89:],
|
||||
}
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// Encode serializes the DABatch into bytes.
|
||||
func (b *DABatch) Encode() []byte {
|
||||
batchBytes := make([]byte, 89+len(b.SkippedL1MessageBitmap))
|
||||
batchBytes[0] = b.Version
|
||||
binary.BigEndian.PutUint64(batchBytes[1:], b.BatchIndex)
|
||||
binary.BigEndian.PutUint64(batchBytes[9:], b.L1MessagePopped)
|
||||
binary.BigEndian.PutUint64(batchBytes[17:], b.TotalL1MessagePopped)
|
||||
copy(batchBytes[25:], b.DataHash[:])
|
||||
copy(batchBytes[57:], b.ParentBatchHash[:])
|
||||
copy(batchBytes[89:], b.SkippedL1MessageBitmap[:])
|
||||
return batchBytes
|
||||
}
|
||||
|
||||
// Hash computes the hash of the serialized DABatch.
|
||||
func (b *DABatch) Hash() common.Hash {
|
||||
bytes := b.Encode()
|
||||
return crypto.Keccak256Hash(bytes)
|
||||
}
|
||||
|
||||
// DecodeFromCalldata attempts to decode a DABatch and an array of DAChunks from the provided calldata byte slice.
|
||||
func DecodeFromCalldata(data []byte) (*DABatch, []*DAChunk, error) {
|
||||
// TODO: implement this function.
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
// CalldataNonZeroByteGas is the gas consumption per non zero byte in calldata.
|
||||
const CalldataNonZeroByteGas = 16
|
||||
|
||||
// GetKeccak256Gas calculates the gas cost for computing the keccak256 hash of a given size.
|
||||
func GetKeccak256Gas(size uint64) uint64 {
|
||||
return GetMemoryExpansionCost(size) + 30 + 6*((size+31)/32)
|
||||
}
|
||||
|
||||
// GetMemoryExpansionCost calculates the cost of memory expansion for a given memoryByteSize.
|
||||
func GetMemoryExpansionCost(memoryByteSize uint64) uint64 {
|
||||
memorySizeWord := (memoryByteSize + 31) / 32
|
||||
memoryCost := (memorySizeWord*memorySizeWord)/512 + (3 * memorySizeWord)
|
||||
return memoryCost
|
||||
}
|
||||
|
||||
// EstimateBlockL1CommitCalldataSize calculates the calldata size in l1 commit for this block approximately.
|
||||
// TODO: The calculation could be more accurate by using 58 + len(l2TxDataBytes) (see Chunk).
|
||||
// This needs to be adjusted in the future.
|
||||
func EstimateBlockL1CommitCalldataSize(b *encoding.Block) (uint64, error) {
|
||||
var size uint64
|
||||
for _, txData := range b.Transactions {
|
||||
if txData.Type == types.L1MessageTxType {
|
||||
continue
|
||||
}
|
||||
size += 4 // 4 bytes payload length
|
||||
txPayloadLength, err := getTxPayloadLength(txData)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
size += txPayloadLength
|
||||
}
|
||||
size += 60 // 60 bytes BlockContext
|
||||
return size, nil
|
||||
}
|
||||
|
||||
// EstimateBlockL1CommitGas calculates the total L1 commit gas for this block approximately.
|
||||
func EstimateBlockL1CommitGas(b *encoding.Block) (uint64, error) {
|
||||
var total uint64
|
||||
var numL1Messages uint64
|
||||
for _, txData := range b.Transactions {
|
||||
if txData.Type == types.L1MessageTxType {
|
||||
numL1Messages++
|
||||
continue
|
||||
}
|
||||
|
||||
txPayloadLength, err := getTxPayloadLength(txData)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
total += CalldataNonZeroByteGas * txPayloadLength // an over-estimate: treat each byte as non-zero
|
||||
total += CalldataNonZeroByteGas * 4 // 4 bytes payload length
|
||||
total += GetKeccak256Gas(txPayloadLength) // l2 tx hash
|
||||
}
|
||||
|
||||
// 60 bytes BlockContext calldata
|
||||
total += CalldataNonZeroByteGas * 60
|
||||
|
||||
// sload
|
||||
total += 2100 * numL1Messages // numL1Messages times cold sload in L1MessageQueue
|
||||
|
||||
// staticcall
|
||||
total += 100 * numL1Messages // numL1Messages times call to L1MessageQueue
|
||||
total += 100 * numL1Messages // numL1Messages times warm address access to L1MessageQueue
|
||||
|
||||
total += GetMemoryExpansionCost(36) * numL1Messages // staticcall to proxy
|
||||
total += 100 * numL1Messages // read admin in proxy
|
||||
total += 100 * numL1Messages // read impl in proxy
|
||||
total += 100 * numL1Messages // access impl
|
||||
total += GetMemoryExpansionCost(36) * numL1Messages // delegatecall to impl
|
||||
|
||||
return total, nil
|
||||
}
|
||||
|
||||
// EstimateChunkL1CommitCalldataSize calculates the calldata size needed for committing a chunk to L1 approximately.
|
||||
func EstimateChunkL1CommitCalldataSize(c *encoding.Chunk) (uint64, error) {
|
||||
var totalL1CommitCalldataSize uint64
|
||||
for _, block := range c.Blocks {
|
||||
blockL1CommitCalldataSize, err := EstimateBlockL1CommitCalldataSize(block)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
totalL1CommitCalldataSize += blockL1CommitCalldataSize
|
||||
}
|
||||
return totalL1CommitCalldataSize, nil
|
||||
}
|
||||
|
||||
// EstimateChunkL1CommitGas calculates the total L1 commit gas for this chunk approximately.
|
||||
func EstimateChunkL1CommitGas(c *encoding.Chunk) (uint64, error) {
|
||||
var totalTxNum uint64
|
||||
var totalL1CommitGas uint64
|
||||
for _, block := range c.Blocks {
|
||||
totalTxNum += uint64(len(block.Transactions))
|
||||
blockL1CommitGas, err := EstimateBlockL1CommitGas(block)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
totalL1CommitGas += blockL1CommitGas
|
||||
}
|
||||
|
||||
numBlocks := uint64(len(c.Blocks))
|
||||
totalL1CommitGas += 100 * numBlocks // numBlocks times warm sload
|
||||
totalL1CommitGas += CalldataNonZeroByteGas // numBlocks field of chunk encoding in calldata
|
||||
totalL1CommitGas += CalldataNonZeroByteGas * numBlocks * 60 // numBlocks of BlockContext in chunk
|
||||
|
||||
totalL1CommitGas += GetKeccak256Gas(58*numBlocks + 32*totalTxNum) // chunk hash
|
||||
return totalL1CommitGas, nil
|
||||
}
|
||||
|
||||
// EstimateBatchL1CommitGas calculates the total L1 commit gas for this batch approximately.
|
||||
func EstimateBatchL1CommitGas(b *encoding.Batch) (uint64, error) {
|
||||
var totalL1CommitGas uint64
|
||||
|
||||
// Add extra gas costs
|
||||
totalL1CommitGas += 100000 // constant to account for ops like _getAdmin, _implementation, _requireNotPaused, etc
|
||||
totalL1CommitGas += 4 * 2100 // 4 one-time cold sload for commitBatch
|
||||
totalL1CommitGas += 20000 // 1 time sstore
|
||||
totalL1CommitGas += 21000 // base fee for tx
|
||||
totalL1CommitGas += CalldataNonZeroByteGas // version in calldata
|
||||
|
||||
// adjusting gas:
|
||||
// add 1 time cold sload (2100 gas) for L1MessageQueue
|
||||
// add 1 time cold address access (2600 gas) for L1MessageQueue
|
||||
// minus 1 time warm sload (100 gas) & 1 time warm address access (100 gas)
|
||||
totalL1CommitGas += (2100 + 2600 - 100 - 100)
|
||||
totalL1CommitGas += GetKeccak256Gas(89 + 32) // parent batch header hash, length is estimated as 89 (constant part)+ 32 (1 skippedL1MessageBitmap)
|
||||
totalL1CommitGas += CalldataNonZeroByteGas * (89 + 32) // parent batch header in calldata
|
||||
|
||||
// adjust batch data hash gas cost
|
||||
totalL1CommitGas += GetKeccak256Gas(uint64(32 * len(b.Chunks)))
|
||||
|
||||
totalL1MessagePoppedBefore := b.TotalL1MessagePoppedBefore
|
||||
|
||||
for _, chunk := range b.Chunks {
|
||||
chunkL1CommitGas, err := EstimateChunkL1CommitGas(chunk)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
totalL1CommitGas += chunkL1CommitGas
|
||||
|
||||
totalL1MessagePoppedInChunk := chunk.NumL1Messages(totalL1MessagePoppedBefore)
|
||||
totalL1MessagePoppedBefore += totalL1MessagePoppedInChunk
|
||||
|
||||
totalL1CommitGas += CalldataNonZeroByteGas * (32 * (totalL1MessagePoppedInChunk + 255) / 256)
|
||||
totalL1CommitGas += GetKeccak256Gas(89 + 32*(totalL1MessagePoppedInChunk+255)/256)
|
||||
|
||||
totalL1CommitCalldataSize, err := EstimateChunkL1CommitCalldataSize(chunk)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
totalL1CommitGas += GetMemoryExpansionCost(totalL1CommitCalldataSize)
|
||||
}
|
||||
|
||||
return totalL1CommitGas, nil
|
||||
}
|
||||
|
||||
// EstimateBatchL1CommitCalldataSize calculates the calldata size in l1 commit for this batch approximately.
|
||||
func EstimateBatchL1CommitCalldataSize(b *encoding.Batch) (uint64, error) {
|
||||
var totalL1CommitCalldataSize uint64
|
||||
for _, chunk := range b.Chunks {
|
||||
chunkL1CommitCalldataSize, err := EstimateChunkL1CommitCalldataSize(chunk)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
totalL1CommitCalldataSize += chunkL1CommitCalldataSize
|
||||
}
|
||||
return totalL1CommitCalldataSize, nil
|
||||
}
|
||||
|
||||
func getTxPayloadLength(txData *types.TransactionData) (uint64, error) {
|
||||
rlpTxData, err := encoding.ConvertTxDataToRLPEncoding(txData)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return uint64(len(rlpTxData)), nil
|
||||
}
|
||||
|
|
@ -1,525 +0,0 @@
|
|||
package codecv1
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/accounts/abi"
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/core/types"
|
||||
"github.com/scroll-tech/go-ethereum/crypto"
|
||||
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
|
||||
"github.com/scroll-tech/go-ethereum/log"
|
||||
"github.com/scroll-tech/go-ethereum/rollup/types/encoding"
|
||||
)
|
||||
|
||||
var (
|
||||
// BLSModulus is the BLS modulus defined in EIP-4844.
|
||||
BLSModulus *big.Int
|
||||
|
||||
// BlobDataProofArgs defines the argument types for `_blobDataProof` in `finalizeBatchWithProof4844`.
|
||||
BlobDataProofArgs abi.Arguments
|
||||
|
||||
// MaxNumChunks is the maximum number of chunks that a batch can contain.
|
||||
MaxNumChunks int = 15
|
||||
)
|
||||
|
||||
func init() {
|
||||
// initialize modulus
|
||||
modulus, success := new(big.Int).SetString("52435875175126190479447740508185965837690552500527637822603658699938581184513", 10)
|
||||
if !success {
|
||||
log.Crit("BLSModulus conversion failed")
|
||||
}
|
||||
BLSModulus = modulus
|
||||
|
||||
// initialize arguments
|
||||
bytes32Type, err1 := abi.NewType("bytes32", "bytes32", nil)
|
||||
bytes48Type, err2 := abi.NewType("bytes48", "bytes48", nil)
|
||||
if err1 != nil || err2 != nil {
|
||||
log.Crit("Failed to initialize abi types", "err1", err1, "err2", err2)
|
||||
}
|
||||
|
||||
BlobDataProofArgs = abi.Arguments{
|
||||
{Type: bytes32Type, Name: "z"},
|
||||
{Type: bytes32Type, Name: "y"},
|
||||
{Type: bytes48Type, Name: "commitment"},
|
||||
{Type: bytes48Type, Name: "proof"},
|
||||
}
|
||||
}
|
||||
|
||||
// CodecV1Version denotes the version of the codec.
|
||||
const CodecV1Version = 1
|
||||
|
||||
// DABlock represents a Data Availability Block.
|
||||
type DABlock struct {
|
||||
BlockNumber uint64
|
||||
Timestamp uint64
|
||||
BaseFee *big.Int
|
||||
GasLimit uint64
|
||||
NumTransactions uint16
|
||||
NumL1Messages uint16
|
||||
}
|
||||
|
||||
// DAChunk groups consecutive DABlocks with their transactions.
|
||||
type DAChunk struct {
|
||||
Blocks []*DABlock
|
||||
Transactions [][]*types.TransactionData
|
||||
}
|
||||
|
||||
// DABatch contains metadata about a batch of DAChunks.
|
||||
type DABatch struct {
|
||||
// header
|
||||
Version uint8
|
||||
BatchIndex uint64
|
||||
L1MessagePopped uint64
|
||||
TotalL1MessagePopped uint64
|
||||
DataHash common.Hash
|
||||
BlobVersionedHash common.Hash
|
||||
ParentBatchHash common.Hash
|
||||
SkippedL1MessageBitmap []byte
|
||||
|
||||
// blob payload
|
||||
blob *kzg4844.Blob
|
||||
z *kzg4844.Point
|
||||
}
|
||||
|
||||
// NewDABlock creates a new DABlock from the given encoding.Block and the total number of L1 messages popped before.
|
||||
func NewDABlock(block *encoding.Block, totalL1MessagePoppedBefore uint64) (*DABlock, error) {
|
||||
if !block.Header.Number.IsUint64() {
|
||||
return nil, errors.New("block number is not uint64")
|
||||
}
|
||||
|
||||
// note: numL1Messages includes skipped messages
|
||||
numL1Messages := block.NumL1Messages(totalL1MessagePoppedBefore)
|
||||
if numL1Messages > math.MaxUint16 {
|
||||
return nil, errors.New("number of L1 messages exceeds max uint16")
|
||||
}
|
||||
|
||||
// note: numTransactions includes skipped messages
|
||||
numL2Transactions := block.NumL2Transactions()
|
||||
numTransactions := numL1Messages + numL2Transactions
|
||||
if numTransactions > math.MaxUint16 {
|
||||
return nil, errors.New("number of transactions exceeds max uint16")
|
||||
}
|
||||
|
||||
daBlock := DABlock{
|
||||
BlockNumber: block.Header.Number.Uint64(),
|
||||
Timestamp: block.Header.Time,
|
||||
BaseFee: block.Header.BaseFee,
|
||||
GasLimit: block.Header.GasLimit,
|
||||
NumTransactions: uint16(numTransactions),
|
||||
NumL1Messages: uint16(numL1Messages),
|
||||
}
|
||||
|
||||
return &daBlock, nil
|
||||
}
|
||||
|
||||
// Encode serializes the DABlock into a slice of bytes.
|
||||
func (b *DABlock) Encode() []byte {
|
||||
bytes := make([]byte, 60)
|
||||
binary.BigEndian.PutUint64(bytes[0:], b.BlockNumber)
|
||||
binary.BigEndian.PutUint64(bytes[8:], b.Timestamp)
|
||||
if b.BaseFee != nil {
|
||||
binary.BigEndian.PutUint64(bytes[40:], b.BaseFee.Uint64())
|
||||
}
|
||||
binary.BigEndian.PutUint64(bytes[48:], b.GasLimit)
|
||||
binary.BigEndian.PutUint16(bytes[56:], b.NumTransactions)
|
||||
binary.BigEndian.PutUint16(bytes[58:], b.NumL1Messages)
|
||||
return bytes
|
||||
}
|
||||
|
||||
// DecodeDABlock takes a byte slice and decodes it into a DABlock.
|
||||
func DecodeDABlock(bytes []byte) (*DABlock, error) {
|
||||
if len(bytes) != 60 {
|
||||
return nil, errors.New("block encoding is not 60 bytes long")
|
||||
}
|
||||
|
||||
block := &DABlock{
|
||||
BlockNumber: binary.BigEndian.Uint64(bytes[0:8]),
|
||||
Timestamp: binary.BigEndian.Uint64(bytes[8:16]),
|
||||
BaseFee: new(big.Int).SetUint64(binary.BigEndian.Uint64(bytes[40:48])),
|
||||
GasLimit: binary.BigEndian.Uint64(bytes[48:56]),
|
||||
NumTransactions: binary.BigEndian.Uint16(bytes[56:58]),
|
||||
NumL1Messages: binary.BigEndian.Uint16(bytes[58:60]),
|
||||
}
|
||||
|
||||
return block, nil
|
||||
}
|
||||
|
||||
// NewDAChunk creates a new DAChunk from the given encoding.Chunk and the total number of L1 messages popped before.
|
||||
func NewDAChunk(chunk *encoding.Chunk, totalL1MessagePoppedBefore uint64) (*DAChunk, error) {
|
||||
var blocks []*DABlock
|
||||
var txs [][]*types.TransactionData
|
||||
|
||||
for _, block := range chunk.Blocks {
|
||||
b, err := NewDABlock(block, totalL1MessagePoppedBefore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blocks = append(blocks, b)
|
||||
totalL1MessagePoppedBefore += block.NumL1Messages(totalL1MessagePoppedBefore)
|
||||
txs = append(txs, block.Transactions)
|
||||
}
|
||||
|
||||
daChunk := DAChunk{
|
||||
Blocks: blocks,
|
||||
Transactions: txs,
|
||||
}
|
||||
|
||||
return &daChunk, nil
|
||||
}
|
||||
|
||||
// Encode serializes the DAChunk into a slice of bytes.
|
||||
func (c *DAChunk) Encode() []byte {
|
||||
var chunkBytes []byte
|
||||
chunkBytes = append(chunkBytes, byte(len(c.Blocks)))
|
||||
|
||||
for _, block := range c.Blocks {
|
||||
blockBytes := block.Encode()
|
||||
chunkBytes = append(chunkBytes, blockBytes...)
|
||||
}
|
||||
|
||||
return chunkBytes
|
||||
}
|
||||
|
||||
// Hash computes the hash of the DAChunk data.
|
||||
func (c *DAChunk) Hash() (common.Hash, error) {
|
||||
var dataBytes []byte
|
||||
|
||||
// concatenate block contexts
|
||||
for _, block := range c.Blocks {
|
||||
encodedBlock := block.Encode()
|
||||
// only the first 58 bytes are used in the hashing process
|
||||
dataBytes = append(dataBytes, encodedBlock[:58]...)
|
||||
}
|
||||
|
||||
// concatenate l1 tx hashes
|
||||
for _, blockTxs := range c.Transactions {
|
||||
for _, txData := range blockTxs {
|
||||
if txData.Type == types.L1MessageTxType {
|
||||
txHash := strings.TrimPrefix(txData.TxHash, "0x")
|
||||
hashBytes, err := hex.DecodeString(txHash)
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
if len(hashBytes) != 32 {
|
||||
return common.Hash{}, fmt.Errorf("unexpected hash: %s", txData.TxHash)
|
||||
}
|
||||
dataBytes = append(dataBytes, hashBytes...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hash := crypto.Keccak256Hash(dataBytes)
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
// NewDABatch creates a DABatch from the provided encoding.Batch.
|
||||
func NewDABatch(batch *encoding.Batch) (*DABatch, error) {
|
||||
// this encoding can only support a fixed number of chunks per batch
|
||||
if len(batch.Chunks) > MaxNumChunks {
|
||||
return nil, fmt.Errorf("too many chunks in batch")
|
||||
}
|
||||
|
||||
if len(batch.Chunks) == 0 {
|
||||
return nil, fmt.Errorf("too few chunks in batch")
|
||||
}
|
||||
|
||||
// batch data hash
|
||||
dataHash, err := computeBatchDataHash(batch.Chunks, batch.TotalL1MessagePoppedBefore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// skipped L1 messages bitmap
|
||||
bitmapBytes, totalL1MessagePoppedAfter, err := encoding.ConstructSkippedBitmap(batch.Index, batch.Chunks, batch.TotalL1MessagePoppedBefore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// blob payload
|
||||
blob, blobVersionedHash, z, err := constructBlobPayload(batch.Chunks)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
daBatch := DABatch{
|
||||
Version: CodecV1Version,
|
||||
BatchIndex: batch.Index,
|
||||
L1MessagePopped: totalL1MessagePoppedAfter - batch.TotalL1MessagePoppedBefore,
|
||||
TotalL1MessagePopped: totalL1MessagePoppedAfter,
|
||||
DataHash: dataHash,
|
||||
BlobVersionedHash: blobVersionedHash,
|
||||
ParentBatchHash: batch.ParentBatchHash,
|
||||
SkippedL1MessageBitmap: bitmapBytes,
|
||||
blob: blob,
|
||||
z: z,
|
||||
}
|
||||
|
||||
return &daBatch, nil
|
||||
}
|
||||
|
||||
// computeBatchDataHash computes the data hash of the batch.
|
||||
// Note: The batch hash and batch data hash are two different hashes,
|
||||
// the former is used for identifying a badge in the contracts,
|
||||
// the latter is used in the public input to the provers.
|
||||
func computeBatchDataHash(chunks []*encoding.Chunk, totalL1MessagePoppedBefore uint64) (common.Hash, error) {
|
||||
var dataBytes []byte
|
||||
totalL1MessagePoppedBeforeChunk := totalL1MessagePoppedBefore
|
||||
|
||||
for _, chunk := range chunks {
|
||||
daChunk, err := NewDAChunk(chunk, totalL1MessagePoppedBeforeChunk)
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
totalL1MessagePoppedBeforeChunk += chunk.NumL1Messages(totalL1MessagePoppedBeforeChunk)
|
||||
chunkHash, err := daChunk.Hash()
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
dataBytes = append(dataBytes, chunkHash.Bytes()...)
|
||||
}
|
||||
|
||||
dataHash := crypto.Keccak256Hash(dataBytes)
|
||||
return dataHash, nil
|
||||
}
|
||||
|
||||
// constructBlobPayload constructs the 4844 blob payload.
|
||||
func constructBlobPayload(chunks []*encoding.Chunk) (*kzg4844.Blob, common.Hash, *kzg4844.Point, error) {
|
||||
// metadata consists of num_chunks (2 bytes) and chunki_size (4 bytes per chunk)
|
||||
metadataLength := 2 + MaxNumChunks*4
|
||||
|
||||
// the raw (un-padded) blob payload
|
||||
blobBytes := make([]byte, metadataLength)
|
||||
|
||||
// challenge digest preimage
|
||||
// 1 hash for metadata, 1 hash for each chunk, 1 hash for blob versioned hash
|
||||
challengePreimage := make([]byte, (1+MaxNumChunks+1)*32)
|
||||
|
||||
// the chunk data hash used for calculating the challenge preimage
|
||||
var chunkDataHash common.Hash
|
||||
|
||||
// blob metadata: num_chunks
|
||||
binary.BigEndian.PutUint16(blobBytes[0:], uint16(len(chunks)))
|
||||
|
||||
// encode blob metadata and L2 transactions,
|
||||
// and simultaneously also build challenge preimage
|
||||
for chunkID, chunk := range chunks {
|
||||
currentChunkStartIndex := len(blobBytes)
|
||||
|
||||
for _, block := range chunk.Blocks {
|
||||
for _, tx := range block.Transactions {
|
||||
if tx.Type != types.L1MessageTxType {
|
||||
// encode L2 txs into blob payload
|
||||
rlpTxData, err := encoding.ConvertTxDataToRLPEncoding(tx)
|
||||
if err != nil {
|
||||
return nil, common.Hash{}, nil, err
|
||||
}
|
||||
blobBytes = append(blobBytes, rlpTxData...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// blob metadata: chunki_size
|
||||
if chunkSize := len(blobBytes) - currentChunkStartIndex; chunkSize != 0 {
|
||||
binary.BigEndian.PutUint32(blobBytes[2+4*chunkID:], uint32(chunkSize))
|
||||
}
|
||||
|
||||
// challenge: compute chunk data hash
|
||||
chunkDataHash = crypto.Keccak256Hash(blobBytes[currentChunkStartIndex:])
|
||||
copy(challengePreimage[32+chunkID*32:], chunkDataHash[:])
|
||||
}
|
||||
|
||||
// if we have fewer than MaxNumChunks chunks, the rest
|
||||
// of the blob metadata is correctly initialized to 0,
|
||||
// but we need to add padding to the challenge preimage
|
||||
for chunkID := len(chunks); chunkID < MaxNumChunks; chunkID++ {
|
||||
// use the last chunk's data hash as padding
|
||||
copy(challengePreimage[32+chunkID*32:], chunkDataHash[:])
|
||||
}
|
||||
|
||||
// challenge: compute metadata hash
|
||||
hash := crypto.Keccak256Hash(blobBytes[0:metadataLength])
|
||||
copy(challengePreimage[0:], hash[:])
|
||||
|
||||
// convert raw data to BLSFieldElements
|
||||
blob, err := makeBlobCanonical(blobBytes)
|
||||
if err != nil {
|
||||
return nil, common.Hash{}, nil, err
|
||||
}
|
||||
|
||||
// compute blob versioned hash
|
||||
c, err := kzg4844.BlobToCommitment(blob)
|
||||
if err != nil {
|
||||
return nil, common.Hash{}, nil, fmt.Errorf("failed to create blob commitment")
|
||||
}
|
||||
blobVersionedHash := kzg4844.CalcBlobHashV1(sha256.New(), &c)
|
||||
|
||||
// challenge: append blob versioned hash
|
||||
copy(challengePreimage[(1+MaxNumChunks)*32:], blobVersionedHash[:])
|
||||
|
||||
// compute z = challenge_digest % BLS_MODULUS
|
||||
challengeDigest := crypto.Keccak256Hash(challengePreimage)
|
||||
pointBigInt := new(big.Int).Mod(new(big.Int).SetBytes(challengeDigest[:]), BLSModulus)
|
||||
pointBytes := pointBigInt.Bytes()
|
||||
|
||||
// the challenge point z
|
||||
var z kzg4844.Point
|
||||
start := 32 - len(pointBytes)
|
||||
copy(z[start:], pointBytes)
|
||||
|
||||
return blob, blobVersionedHash, &z, nil
|
||||
}
|
||||
|
||||
// makeBlobCanonical converts the raw blob data into the canonical blob representation of 4096 BLSFieldElements.
|
||||
func makeBlobCanonical(blobBytes []byte) (*kzg4844.Blob, error) {
|
||||
// blob contains 131072 bytes but we can only utilize 31/32 of these
|
||||
if len(blobBytes) > 126976 {
|
||||
return nil, fmt.Errorf("oversized batch payload")
|
||||
}
|
||||
|
||||
// the canonical (padded) blob payload
|
||||
var blob kzg4844.Blob
|
||||
|
||||
// encode blob payload by prepending every 31 bytes with 1 zero byte
|
||||
index := 0
|
||||
|
||||
for from := 0; from < len(blobBytes); from += 31 {
|
||||
to := from + 31
|
||||
if to > len(blobBytes) {
|
||||
to = len(blobBytes)
|
||||
}
|
||||
copy(blob[index+1:], blobBytes[from:to])
|
||||
index += 32
|
||||
}
|
||||
|
||||
return &blob, nil
|
||||
}
|
||||
|
||||
// NewDABatchFromBytes attempts to decode the given byte slice into a DABatch.
|
||||
// Note: This function only populates the batch header, it leaves the blob-related fields empty.
|
||||
func NewDABatchFromBytes(data []byte) (*DABatch, error) {
|
||||
if len(data) < 121 {
|
||||
return nil, fmt.Errorf("insufficient data for DABatch, expected at least 121 bytes but got %d", len(data))
|
||||
}
|
||||
|
||||
b := &DABatch{
|
||||
Version: data[0],
|
||||
BatchIndex: binary.BigEndian.Uint64(data[1:9]),
|
||||
L1MessagePopped: binary.BigEndian.Uint64(data[9:17]),
|
||||
TotalL1MessagePopped: binary.BigEndian.Uint64(data[17:25]),
|
||||
DataHash: common.BytesToHash(data[25:57]),
|
||||
BlobVersionedHash: common.BytesToHash(data[57:89]),
|
||||
ParentBatchHash: common.BytesToHash(data[89:121]),
|
||||
SkippedL1MessageBitmap: data[121:],
|
||||
}
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// Encode serializes the DABatch into bytes.
|
||||
func (b *DABatch) Encode() []byte {
|
||||
batchBytes := make([]byte, 121+len(b.SkippedL1MessageBitmap))
|
||||
batchBytes[0] = b.Version
|
||||
binary.BigEndian.PutUint64(batchBytes[1:], b.BatchIndex)
|
||||
binary.BigEndian.PutUint64(batchBytes[9:], b.L1MessagePopped)
|
||||
binary.BigEndian.PutUint64(batchBytes[17:], b.TotalL1MessagePopped)
|
||||
copy(batchBytes[25:], b.DataHash[:])
|
||||
copy(batchBytes[57:], b.BlobVersionedHash[:])
|
||||
copy(batchBytes[89:], b.ParentBatchHash[:])
|
||||
copy(batchBytes[121:], b.SkippedL1MessageBitmap[:])
|
||||
return batchBytes
|
||||
}
|
||||
|
||||
// Hash computes the hash of the serialized DABatch.
|
||||
func (b *DABatch) Hash() common.Hash {
|
||||
bytes := b.Encode()
|
||||
return crypto.Keccak256Hash(bytes)
|
||||
}
|
||||
|
||||
// BlobDataProof computes the abi-encoded blob verification data.
|
||||
func (b *DABatch) BlobDataProof() ([]byte, error) {
|
||||
if b.blob == nil {
|
||||
return nil, errors.New("called BlobDataProof with empty blob")
|
||||
}
|
||||
if b.z == nil {
|
||||
return nil, errors.New("called BlobDataProof with empty z")
|
||||
}
|
||||
|
||||
commitment, err := kzg4844.BlobToCommitment(b.blob)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create blob commitment")
|
||||
}
|
||||
|
||||
proof, y, err := kzg4844.ComputeProof(b.blob, *b.z)
|
||||
if err != nil {
|
||||
log.Crit("failed to create KZG proof at point", "err", err, "z", hex.EncodeToString(b.z[:]))
|
||||
}
|
||||
|
||||
// Memory layout of ``_blobDataProof``:
|
||||
// | z | y | kzg_commitment | kzg_proof |
|
||||
// |---------|---------|----------------|-----------|
|
||||
// | bytes32 | bytes32 | bytes48 | bytes48 |
|
||||
|
||||
values := []interface{}{*b.z, y, commitment, proof}
|
||||
return BlobDataProofArgs.Pack(values...)
|
||||
}
|
||||
|
||||
// Blob returns the blob of the batch.
|
||||
func (b *DABatch) Blob() *kzg4844.Blob {
|
||||
return b.blob
|
||||
}
|
||||
|
||||
// DecodeFromCalldata attempts to decode a DABatch and an array of DAChunks from the provided calldata byte slice.
|
||||
func DecodeFromCalldata(data []byte) (*DABatch, []*DAChunk, error) {
|
||||
// TODO: implement this function.
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
// EstimateChunkL1CommitBlobSize estimates the size of the L1 commit blob for a single chunk.
|
||||
func EstimateChunkL1CommitBlobSize(c *encoding.Chunk) (uint64, error) {
|
||||
metadataSize := uint64(2 + 4*MaxNumChunks) // over-estimate: adding metadata length
|
||||
chunkDataSize, err := chunkL1CommitBlobDataSize(c)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
paddedSize := ((metadataSize + chunkDataSize + 30) / 31) * 32
|
||||
return paddedSize, nil
|
||||
}
|
||||
|
||||
// EstimateBatchL1CommitBlobSize estimates the total size of the L1 commit blob for a batch.
|
||||
func EstimateBatchL1CommitBlobSize(b *encoding.Batch) (uint64, error) {
|
||||
metadataSize := uint64(2 + 4*MaxNumChunks)
|
||||
var batchDataSize uint64
|
||||
for _, c := range b.Chunks {
|
||||
chunkDataSize, err := chunkL1CommitBlobDataSize(c)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
batchDataSize += chunkDataSize
|
||||
}
|
||||
paddedSize := ((metadataSize + batchDataSize + 30) / 31) * 32
|
||||
return paddedSize, nil
|
||||
}
|
||||
|
||||
func chunkL1CommitBlobDataSize(c *encoding.Chunk) (uint64, error) {
|
||||
var dataSize uint64
|
||||
for _, block := range c.Blocks {
|
||||
for _, tx := range block.Transactions {
|
||||
if tx.Type != types.L1MessageTxType {
|
||||
rlpTxData, err := encoding.ConvertTxDataToRLPEncoding(tx)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
dataSize += uint64(len(rlpTxData))
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataSize, nil
|
||||
}
|
||||
|
|
@ -1,259 +0,0 @@
|
|||
package encoding
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/common/hexutil"
|
||||
"github.com/scroll-tech/go-ethereum/core/types"
|
||||
)
|
||||
|
||||
// CodecVersion defines the version of encoder and decoder.
|
||||
type CodecVersion int
|
||||
|
||||
const (
|
||||
// CodecV0 represents the version 0 of the encoder and decoder.
|
||||
CodecV0 CodecVersion = iota
|
||||
|
||||
// CodecV1 represents the version 1 of the encoder and decoder.
|
||||
CodecV1
|
||||
)
|
||||
|
||||
// Block represents an L2 block.
|
||||
type Block struct {
|
||||
Header *types.Header
|
||||
Transactions []*types.TransactionData
|
||||
WithdrawRoot common.Hash `json:"withdraw_trie_root,omitempty"`
|
||||
RowConsumption *types.RowConsumption `json:"row_consumption,omitempty"`
|
||||
}
|
||||
|
||||
// Chunk represents a group of blocks.
|
||||
type Chunk struct {
|
||||
Blocks []*Block `json:"blocks"`
|
||||
}
|
||||
|
||||
// Batch represents a batch of chunks.
|
||||
type Batch struct {
|
||||
Index uint64
|
||||
TotalL1MessagePoppedBefore uint64
|
||||
ParentBatchHash common.Hash
|
||||
Chunks []*Chunk
|
||||
}
|
||||
|
||||
// NumL1Messages returns the number of L1 messages in this block.
|
||||
// This number is the sum of included and skipped L1 messages.
|
||||
func (b *Block) NumL1Messages(totalL1MessagePoppedBefore uint64) uint64 {
|
||||
var lastQueueIndex *uint64
|
||||
for _, txData := range b.Transactions {
|
||||
if txData.Type == types.L1MessageTxType {
|
||||
lastQueueIndex = &txData.Nonce
|
||||
}
|
||||
}
|
||||
if lastQueueIndex == nil {
|
||||
return 0
|
||||
}
|
||||
// note: last queue index included before this block is totalL1MessagePoppedBefore - 1
|
||||
// TODO: cache results
|
||||
return *lastQueueIndex - totalL1MessagePoppedBefore + 1
|
||||
}
|
||||
|
||||
// NumL2Transactions returns the number of L2 transactions in this block.
|
||||
func (b *Block) NumL2Transactions() uint64 {
|
||||
var count uint64
|
||||
for _, txData := range b.Transactions {
|
||||
if txData.Type != types.L1MessageTxType {
|
||||
count++
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// NumL1Messages returns the number of L1 messages in this chunk.
|
||||
// This number is the sum of included and skipped L1 messages.
|
||||
func (c *Chunk) NumL1Messages(totalL1MessagePoppedBefore uint64) uint64 {
|
||||
var numL1Messages uint64
|
||||
for _, block := range c.Blocks {
|
||||
numL1MessagesInBlock := block.NumL1Messages(totalL1MessagePoppedBefore)
|
||||
numL1Messages += numL1MessagesInBlock
|
||||
totalL1MessagePoppedBefore += numL1MessagesInBlock
|
||||
}
|
||||
// TODO: cache results
|
||||
return numL1Messages
|
||||
}
|
||||
|
||||
// ConvertTxDataToRLPEncoding transforms []*TransactionData into []*types.Transaction.
|
||||
func ConvertTxDataToRLPEncoding(txData *types.TransactionData) ([]byte, error) {
|
||||
data, err := hexutil.Decode(txData.Data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode txData.Data: data=%v, err=%w", txData.Data, err)
|
||||
}
|
||||
|
||||
var tx *types.Transaction
|
||||
switch txData.Type {
|
||||
case types.LegacyTxType:
|
||||
tx = types.NewTx(&types.LegacyTx{
|
||||
Nonce: txData.Nonce,
|
||||
To: txData.To,
|
||||
Value: txData.Value.ToInt(),
|
||||
Gas: txData.Gas,
|
||||
GasPrice: txData.GasPrice.ToInt(),
|
||||
Data: data,
|
||||
V: txData.V.ToInt(),
|
||||
R: txData.R.ToInt(),
|
||||
S: txData.S.ToInt(),
|
||||
})
|
||||
|
||||
case types.AccessListTxType:
|
||||
tx = types.NewTx(&types.AccessListTx{
|
||||
ChainID: txData.ChainId.ToInt(),
|
||||
Nonce: txData.Nonce,
|
||||
To: txData.To,
|
||||
Value: txData.Value.ToInt(),
|
||||
Gas: txData.Gas,
|
||||
GasPrice: txData.GasPrice.ToInt(),
|
||||
Data: data,
|
||||
AccessList: txData.AccessList,
|
||||
V: txData.V.ToInt(),
|
||||
R: txData.R.ToInt(),
|
||||
S: txData.S.ToInt(),
|
||||
})
|
||||
|
||||
case types.DynamicFeeTxType:
|
||||
tx = types.NewTx(&types.DynamicFeeTx{
|
||||
ChainID: txData.ChainId.ToInt(),
|
||||
Nonce: txData.Nonce,
|
||||
To: txData.To,
|
||||
Value: txData.Value.ToInt(),
|
||||
Gas: txData.Gas,
|
||||
GasTipCap: txData.GasTipCap.ToInt(),
|
||||
GasFeeCap: txData.GasFeeCap.ToInt(),
|
||||
Data: data,
|
||||
AccessList: txData.AccessList,
|
||||
V: txData.V.ToInt(),
|
||||
R: txData.R.ToInt(),
|
||||
S: txData.S.ToInt(),
|
||||
})
|
||||
|
||||
case types.L1MessageTxType: // L1MessageTxType is not supported
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported tx type: %d", txData.Type)
|
||||
}
|
||||
|
||||
rlpTxData, err := tx.MarshalBinary()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal binary of the tx: tx=%v, err=%w", tx, err)
|
||||
}
|
||||
|
||||
return rlpTxData, nil
|
||||
}
|
||||
|
||||
// CrcMax calculates the maximum row consumption of crc.
|
||||
func (c *Chunk) CrcMax() (uint64, error) {
|
||||
// Map sub-circuit name to row count
|
||||
crc := make(map[string]uint64)
|
||||
|
||||
// Iterate over blocks, accumulate row consumption
|
||||
for _, block := range c.Blocks {
|
||||
if block.RowConsumption == nil {
|
||||
return 0, fmt.Errorf("block (%d, %v) has nil RowConsumption", block.Header.Number, block.Header.Hash().Hex())
|
||||
}
|
||||
for _, subCircuit := range *block.RowConsumption {
|
||||
crc[subCircuit.Name] += subCircuit.RowNumber
|
||||
}
|
||||
}
|
||||
|
||||
// Find the maximum row consumption
|
||||
var maxVal uint64
|
||||
for _, value := range crc {
|
||||
if value > maxVal {
|
||||
maxVal = value
|
||||
}
|
||||
}
|
||||
|
||||
// Return the maximum row consumption
|
||||
return maxVal, nil
|
||||
}
|
||||
|
||||
// NumTransactions calculates the total number of transactions in a Chunk.
|
||||
func (c *Chunk) NumTransactions() uint64 {
|
||||
var totalTxNum uint64
|
||||
for _, block := range c.Blocks {
|
||||
totalTxNum += uint64(len(block.Transactions))
|
||||
}
|
||||
return totalTxNum
|
||||
}
|
||||
|
||||
// NumL2Transactions calculates the total number of L2 transactions in a Chunk.
|
||||
func (c *Chunk) NumL2Transactions() uint64 {
|
||||
var totalTxNum uint64
|
||||
for _, block := range c.Blocks {
|
||||
totalTxNum += block.NumL2Transactions()
|
||||
}
|
||||
return totalTxNum
|
||||
}
|
||||
|
||||
// L2GasUsed calculates the total gas of L2 transactions in a Chunk.
|
||||
func (c *Chunk) L2GasUsed() uint64 {
|
||||
var totalTxNum uint64
|
||||
for _, block := range c.Blocks {
|
||||
totalTxNum += block.Header.GasUsed
|
||||
}
|
||||
return totalTxNum
|
||||
}
|
||||
|
||||
// StateRoot gets the state root after committing/finalizing the batch.
|
||||
func (b *Batch) StateRoot() common.Hash {
|
||||
numChunks := len(b.Chunks)
|
||||
if len(b.Chunks) == 0 {
|
||||
return common.Hash{}
|
||||
}
|
||||
lastChunkBlockNum := len(b.Chunks[numChunks-1].Blocks)
|
||||
return b.Chunks[len(b.Chunks)-1].Blocks[lastChunkBlockNum-1].Header.Root
|
||||
}
|
||||
|
||||
// WithdrawRoot gets the withdraw root after committing/finalizing the batch.
|
||||
func (b *Batch) WithdrawRoot() common.Hash {
|
||||
numChunks := len(b.Chunks)
|
||||
if len(b.Chunks) == 0 {
|
||||
return common.Hash{}
|
||||
}
|
||||
lastChunkBlockNum := len(b.Chunks[numChunks-1].Blocks)
|
||||
return b.Chunks[len(b.Chunks)-1].Blocks[lastChunkBlockNum-1].WithdrawRoot
|
||||
}
|
||||
|
||||
// TxsToTxsData converts transactions to a TransactionData array.
|
||||
func TxsToTxsData(txs types.Transactions) []*types.TransactionData {
|
||||
txsData := make([]*types.TransactionData, len(txs))
|
||||
for i, tx := range txs {
|
||||
v, r, s := tx.RawSignatureValues()
|
||||
|
||||
nonce := tx.Nonce()
|
||||
|
||||
// We need QueueIndex in `NewBatchHeader`. However, `TransactionData`
|
||||
// does not have this field. Since `L1MessageTx` do not have a nonce,
|
||||
// we reuse this field for storing the queue index.
|
||||
if msg := tx.AsL1MessageTx(); msg != nil {
|
||||
nonce = msg.QueueIndex
|
||||
}
|
||||
|
||||
txsData[i] = &types.TransactionData{
|
||||
Type: tx.Type(),
|
||||
TxHash: tx.Hash().String(),
|
||||
Nonce: nonce,
|
||||
ChainId: (*hexutil.Big)(tx.ChainId()),
|
||||
Gas: tx.Gas(),
|
||||
GasPrice: (*hexutil.Big)(tx.GasPrice()),
|
||||
GasTipCap: (*hexutil.Big)(tx.GasTipCap()),
|
||||
GasFeeCap: (*hexutil.Big)(tx.GasFeeCap()),
|
||||
To: tx.To(),
|
||||
Value: (*hexutil.Big)(tx.Value()),
|
||||
Data: hexutil.Encode(tx.Data()),
|
||||
IsCreate: tx.To() == nil,
|
||||
AccessList: tx.AccessList(),
|
||||
V: (*hexutil.Big)(v),
|
||||
R: (*hexutil.Big)(r),
|
||||
S: (*hexutil.Big)(s),
|
||||
}
|
||||
}
|
||||
return txsData
|
||||
}
|
||||
28
run_test.sh
Executable file
28
run_test.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Download .so files
|
||||
export LIBSCROLL_ZSTD_VERSION=v0.1.0-rc0-ubuntu20.04
|
||||
export SCROLL_LIB_PATH=/scroll/lib
|
||||
|
||||
sudo mkdir -p $SCROLL_LIB_PATH
|
||||
|
||||
sudo wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so
|
||||
|
||||
# Set the environment variable
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
|
||||
export CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
|
||||
|
||||
# Download and install the project dependencies
|
||||
go run build/ci.go install
|
||||
go get ./...
|
||||
|
||||
# Save the root directory of the project
|
||||
ROOT_DIR=$(pwd)
|
||||
|
||||
# Run genesis test
|
||||
cd $ROOT_DIR/cmd/geth
|
||||
go test -test.run TestCustomGenesis
|
||||
|
||||
# Run module tests
|
||||
cd $ROOT_DIR
|
||||
go run build/ci.go test ./consensus ./core ./eth ./miner ./node ./trie ./rollup/...
|
||||
Loading…
Reference in a new issue