Skip to content

feat(permissionless batches): batch production toolkit and operator recovery #1555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 131 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
dca69ce
implement first steps for minimal recovery to permissionlessly produc…
jonastheis Oct 23, 2024
2e09118
Merge remote-tracking branch 'origin/develop' into jt/permissionless-…
jonastheis Oct 24, 2024
496314f
add config for recovery mode
jonastheis Oct 24, 2024
c12d380
structure code and implement restoreMinimalPreviousState and fetchL2B…
jonastheis Oct 24, 2024
c329959
produce chunks from specified L2 blocks and batch from chunks
jonastheis Oct 24, 2024
71f240b
start implementation of restoring full previous state for relayer
jonastheis Oct 25, 2024
acc7083
implement processFinalizedBatch
jonastheis Oct 28, 2024
59ea991
handle batches
jonastheis Oct 29, 2024
2df07a9
introduce ForceL1MessageCount to config to be able to set a custom L1…
jonastheis Nov 6, 2024
0f5ebf3
add Dockerfile for relayer in permissionless batches mode
jonastheis Nov 6, 2024
f96af8e
add docker compose file to spin up all necessary services together
jonastheis Nov 6, 2024
16a471d
move docker file to build/dockerfiles
jonastheis Nov 19, 2024
d25094b
add coordinator-cron and proving-service-bundle
jonastheis Nov 19, 2024
603feed
add bundle creation
jonastheis Nov 19, 2024
5ddd6d6
add permissionless-batches/conf/ to dockerignore files
jonastheis Nov 20, 2024
5ff6fd0
refactor cmd/permissionless_batches/app
jonastheis Nov 20, 2024
0108873
implement RecoveryNeeded functionality to allow re-running without ov…
jonastheis Nov 20, 2024
a6f914a
refactor cmd/rollup_relayer/app and split into FullRecovery struct
jonastheis Nov 20, 2024
0123502
clean up
jonastheis Nov 21, 2024
596d9fe
introduce profiles to docker-compose.yml
jonastheis Nov 21, 2024
d85bdf5
initial instructions in README.md
jonastheis Nov 21, 2024
a9eac08
address review comments
jonastheis Nov 22, 2024
606162e
add dummy configuration and documentation for permissionless batch pr…
jonastheis Nov 25, 2024
30c0201
ignore /conf folder from git
jonastheis Nov 25, 2024
ec9d862
add documentation for operator recovery
jonastheis Nov 26, 2024
6ef4775
address review comments
jonastheis Nov 26, 2024
41606fe
support first version of CodecV6 in relayer and add functionality to …
jonastheis Dec 30, 2024
0c0c417
adjust Sender to support multiple blobs when sending a transaction
jonastheis Dec 31, 2024
78c9963
implement batch submission of multiple batches per transaction and co…
jonastheis Dec 31, 2024
940fde0
implement missing part of commit logic for CodecV6
jonastheis Dec 31, 2024
ca8d930
feat(rollup-relayer): add Euclid support
omerfirmak Jan 9, 2025
421afe9
deprecate halo2 provers, start openvm prover
omerfirmak Jan 27, 2025
b460d4a
Merge remote-tracking branch 'origin/omerfirmak/mpt' into feat/use-co…
jonastheis Jan 28, 2025
182f8e3
update go.mod to latest da-codec version V7
jonastheis Jan 28, 2025
783b965
update go.mod to latest da-codec version V7
jonastheis Feb 5, 2025
5a479c3
address review comments
jonastheis Feb 5, 2025
310abdd
add InitialL1MessageQueueHash and LastL1MessageQueueHash to chunk and…
jonastheis Feb 5, 2025
2efbbd7
add support for bundles with CodecV7
jonastheis Feb 5, 2025
e713424
update contextIDFromBatches prefix to v7
jonastheis Feb 5, 2025
f4e17bc
fix ci
jonastheis Feb 5, 2025
99c0a9f
update to latest da-codec
jonastheis Feb 10, 2025
8db5339
fix issues with chunks when handling CodecV7
jonastheis Feb 10, 2025
69a80d4
add testCommitBatchAndFinalizeBundleCodecV7 for relayer
jonastheis Feb 10, 2025
5f22950
feat(prover): euclid prover first draft
omerfirmak Feb 5, 2025
9412c7f
feat(coordinator): abstract proof types behind an interface
omerfirmak Feb 6, 2025
c3a3bad
feat(rollup-relayer): add Euclid support
omerfirmak Jan 9, 2025
2de45f0
feat(coordinator): add euclid proof types
omerfirmak Feb 6, 2025
f01af24
fix: potentially flaky testResubmitZeroGasPriceTransaction
omerfirmak Feb 7, 2025
2bd0655
feat: Add Euclid verifier
omerfirmak Feb 7, 2025
848d3a6
fix: re-enable supported forks check
omerfirmak Feb 7, 2025
e5ad9c6
feat: allow stopping fake finalization at fork boundary
omerfirmak Feb 13, 2025
b424cef
feat: add CPU prover dockerfile
omerfirmak Feb 13, 2025
ac17696
feat: update contracts to euclid version
omerfirmak Feb 13, 2025
d503d4a
fix: base64 encode VKs
omerfirmak Feb 17, 2025
bf08436
fix: prover using wrong resources for batch/bundle circuits
omerfirmak Feb 17, 2025
83c73f8
fix: coordinator ignore euclid transition chunk
omerfirmak Feb 17, 2025
d3acd6b
adjust to recent CodecV7 changes. remove initialL1MessageQueueIndex a…
jonastheis Feb 19, 2025
f13863e
Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into f…
jonastheis Feb 20, 2025
8b57dd6
fixes after merge
jonastheis Feb 20, 2025
37924b0
feat: bump zkvm-prover to rc4
omerfirmak Feb 20, 2025
fbc14ac
address review comments
jonastheis Feb 20, 2025
867fda6
fix: add batch tasks details for v6 codec
omerfirmak Feb 20, 2025
2e9827a
fix: properly propagate verifier errors
omerfirmak Feb 21, 2025
01fa3b3
feat: use verifier-only types in coordinator
omerfirmak Feb 21, 2025
50ebf17
fix: generate evm proofs for bundles
omerfirmak Feb 21, 2025
e1a0bab
add new contract ABI and adjust submission to it
jonastheis Feb 24, 2025
bb9d404
fix: force byte arrays to be marshaled as JSON arrays
omerfirmak Feb 24, 2025
0125dd6
add new contract ABI
jonastheis Feb 27, 2025
121ce09
update config and adjust to new contract ABI
jonastheis Feb 27, 2025
ed394a6
make sure that all batches committed in the same tx are part of the s…
jonastheis Feb 27, 2025
a55de1f
feat: set code tx support (#1600)
colinlyguo Feb 27, 2025
89ede0d
build rollup images with --platform=linux/amd64
jonastheis Feb 27, 2025
782e019
Merge branch 'feat/use-codec-v6' of github.com:scroll-tech/scroll int…
jonastheis Feb 27, 2025
081d289
update da-codec dependency
jonastheis Feb 27, 2025
47a6c23
fix bug where chunk and batch blocks mismatch
jonastheis Feb 28, 2025
eb5758b
feat: bump to zkvm-prover rc5
roynalnaruto Feb 28, 2025
7353f30
update l2geth version in go.mod
jonastheis Feb 28, 2025
673777f
use go 1.22 in Dockerfile builder
jonastheis Feb 28, 2025
554a233
refactor: move euclid prover to new subdir
omerfirmak Mar 4, 2025
e27ab5a
Merge remote-tracking branch 'origin/develop' into omerfirmak/euclid-…
omerfirmak Mar 4, 2025
26a49cb
Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into f…
jonastheis Mar 6, 2025
8ea4315
update go.work.sum
jonastheis Mar 6, 2025
55b32e1
add debug log message
jonastheis Mar 6, 2025
d6674e8
add configuration parameter maxChunksPerBatch for batch proposer
jonastheis Mar 6, 2025
a1c4562
add configuration parameter maxChunksPerBatch for batch proposer
jonastheis Mar 6, 2025
c8b614f
unit tests fix
colinlyguo Mar 6, 2025
f91c999
fix batch proposer panic
Thegaram Mar 6, 2025
82dd5e0
feat(bridge-history): support codecv7
colinlyguo Mar 6, 2025
4333d51
Revert "feat(bridge-history): support codecv7"
colinlyguo Mar 6, 2025
b30f4d0
chore(zkvm-circuit): upgrade to 0.1.0-rc.6 (#1610)
colinlyguo Mar 7, 2025
03c63a6
update batch/chunk details for phase2
omerfirmak Mar 7, 2025
9f4c9ee
fix: prover version (#1611)
yiweichi Mar 7, 2025
101cc46
update dependencies
colinlyguo Mar 7, 2025
a868bc1
simplify version checks
colinlyguo Mar 7, 2025
8b08a57
Revert "simplify version checks"
colinlyguo Mar 7, 2025
f1ea4b3
process task with CodecV7, add check for BlobDataProof length and add…
jonastheis Mar 8, 2025
b7e7d1a
Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into f…
jonastheis Mar 8, 2025
94bee19
feat(bridge-history): support codecv7 (#1609)
colinlyguo Mar 8, 2025
f27ddb7
remove debug line
jonastheis Mar 8, 2025
da96331
tweak comments and some renamings
colinlyguo Mar 9, 2025
d79aaef
fix CI
jonastheis Mar 10, 2025
ab7038c
Merge branch 'feat/use-codec-v6' of github.com:scroll-tech/scroll int…
jonastheis Mar 10, 2025
47219f2
run goimports
jonastheis Mar 10, 2025
95adcc3
fix tests
jonastheis Mar 10, 2025
224546e
add new ABI and add more tests
jonastheis Mar 10, 2025
0799dd4
fix linter
jonastheis Mar 10, 2025
7a70e37
fix test
jonastheis Mar 10, 2025
57d50b7
Merge branch 'develop' into omerfirmak/euclid-prover
omerfirmak Mar 10, 2025
20dffe4
chore: auto version bump [bot]
omerfirmak Mar 10, 2025
867307d
Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into f…
jonastheis Mar 10, 2025
c9f6e8c
Merge remote-tracking branch 'origin/develop' into feat/use-codec-v6
jonastheis Mar 10, 2025
9b462e4
go mod tidy
jonastheis Mar 10, 2025
d57e6b0
chore: auto version bump [bot]
jonastheis Mar 10, 2025
4d677b3
address review comments
jonastheis Mar 10, 2025
90d1563
Merge remote-tracking branch 'origin/develop' into feat/use-codec-v6
jonastheis Mar 10, 2025
d987931
go mod tidy
jonastheis Mar 10, 2025
38b3239
chore: auto version bump [bot]
jonastheis Mar 10, 2025
e99a851
Merge branch 'feat/use-codec-v6' of github.com:scroll-tech/scroll int…
jonastheis Mar 10, 2025
bb6ee2c
Merge branch 'develop' into feat/use-codec-v6
jonastheis Mar 10, 2025
2d84478
Merge remote-tracking branch 'origin/feat/use-codec-v6' into jt/permi…
jonastheis Mar 10, 2025
a8511d5
adjust minimal recovery to changes from CodecV7
jonastheis Mar 11, 2025
a16b906
add submission of permissionless batch
jonastheis Mar 12, 2025
942f883
Merge remote-tracking branch 'origin/develop' into jt/permissionless-…
jonastheis Mar 12, 2025
495921c
Merge remote-tracking branch 'origin/develop' into jt/permissionless-…
jonastheis Mar 24, 2025
6414767
update da-codec to latest version
jonastheis Mar 24, 2025
596fabf
update l2geth to latest version
jonastheis Mar 24, 2025
81df41c
add better error handling and wait for transaction confirmation
jonastheis Mar 26, 2025
c2152b1
fix issue with replaced l2geth dependency
jonastheis Mar 27, 2025
8009bd1
Merge branch 'develop' into jt/permissionless-batches-recovery
yiweichi Apr 11, 2025
9d54bc2
Merge branch 'develop' into jt/permissionless-batches-recovery
yiweichi Apr 24, 2025
ac3305c
Merge branch 'develop' into jt/permissionless-batches-recovery
yiweichi Apr 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build/dockerfiles/coordinator-api.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ docs/
l2geth/
rpc-gateway/
*target/*

permissionless-batches/conf/
2 changes: 2 additions & 0 deletions build/dockerfiles/coordinator-cron.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ docs/
l2geth/
rpc-gateway/
*target/*

permissionless-batches/conf/
2 changes: 2 additions & 0 deletions build/dockerfiles/db_cli.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ docs/
l2geth/
rpc-gateway/
*target/*

permissionless-batches/conf/
5 changes: 4 additions & 1 deletion build/dockerfiles/gas_oracle.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
assets/
contracts/
docs/
l2geth/
rpc-gateway/
*target/*
*target/*

permissionless-batches/conf/
30 changes: 30 additions & 0 deletions build/dockerfiles/recovery_permissionless_batches.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Download Go dependencies
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as base

WORKDIR /src
COPY go.work* ./
COPY ./rollup/go.* ./rollup/
COPY ./common/go.* ./common/
COPY ./coordinator/go.* ./coordinator/
COPY ./database/go.* ./database/
COPY ./tests/integration-test/go.* ./tests/integration-test/
COPY ./bridge-history-api/go.* ./bridge-history-api/
RUN go mod download -x

# Build rollup_relayer
FROM base as builder

RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
cd /src/rollup/cmd/permissionless_batches/ && CGO_LDFLAGS="-ldl" go build -v -p 4 -o /bin/rollup_relayer

# Pull rollup_relayer into a second stage deploy ubuntu container
FROM ubuntu:20.04

RUN apt update && apt install vim netcat-openbsd net-tools curl ca-certificates -y

ENV CGO_LDFLAGS="-ldl"

COPY --from=builder /bin/rollup_relayer /bin/
WORKDIR /app
ENTRYPOINT ["rollup_relayer"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
assets/
contracts/
docs/
l2geth/
rpc-gateway/
*target/*

permissionless-batches/conf/
5 changes: 4 additions & 1 deletion build/dockerfiles/rollup_relayer.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
assets/
contracts/
docs/
l2geth/
rpc-gateway/
*target/*
*target/*

permissionless-batches/conf/
3 changes: 2 additions & 1 deletion go.work
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ go 1.22
toolchain go1.22.2

use (
./bridge-history-api
//./bridge-history-api
./common
./coordinator
./database
./rollup
./tests/integration-test
//../go-ethereum
)
3 changes: 3 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,10 @@ github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
github.com/compose-spec/compose-go v1.20.0 h1:h4ZKOst1EF/DwZp7dWkb+wbTVE4nEyT9Lc89to84Ol4=
github.com/compose-spec/compose-go v1.20.0/go.mod h1:+MdqXV4RA7wdFsahh/Kb8U0pAJqkg7mr4PM9tFKU8RM=
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
github.com/consensys/bavard v0.1.27/go.mod h1:k/zVjHHC4B+PQy1Pg7fgvG3ALicQw540Crag8qx+dZs=
github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY=
github.com/consensys/gnark-crypto v0.13.0/go.mod h1:wKqwsieaKPThcFkHe0d0zMsbHEUWFmZcG7KBCse210o=
github.com/container-orchestrated-devices/container-device-interface v0.6.1 h1:mz77uJoP8im/4Zins+mPqt677ZMaflhoGaYrRAl5jvA=
github.com/container-orchestrated-devices/container-device-interface v0.6.1/go.mod h1:40T6oW59rFrL/ksiSs7q45GzjGlbvxnA4xaK6cyq+kA=
github.com/containerd/aufs v1.0.0 h1:2oeJiwX5HstO7shSrPZjrohJZLzK36wvpdmzDRkL/LY=
Expand Down Expand Up @@ -1167,6 +1169,7 @@ github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20L
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A=
github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y=
github.com/lestrrat-go/blackmagic v1.0.0 h1:XzdxDbuQTz0RZZEmdU7cnQxUtFUzgCSPq8RCz4BxIi4=
Expand Down
1 change: 1 addition & 0 deletions permissionless-batches/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conf/
172 changes: 172 additions & 0 deletions permissionless-batches/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
# Permissionless Batches
Permissionless batches aka enforced batches is a feature that provides guarantee to users that they can exit Scroll even if the operator is down or censoring.
It allows anyone to take over and submit a batch (permissionless batch submission) together with a proof after a certain time period has passed without a batch being finalized on L1.

Once permissionless batch mode is activated, the operator can no longer submit batches in a permissioned way. Only the security council can deactivate permissionless batch mode and reinstate the operator as the only batch submitter.
There are two types of situations to consider:
- `Permissionless batch mode is activated:` This means that finalization halted for some time. Now anyone can submit batches utilizing the [batch production toolkit](#batch-production-toolkit).
- `Permissionless batch mode is deactivated:` This means that the security council has decided to reinstate the operator as the only batch submitter. The operator needs to [recover](#operator-recovery) the sequencer and relayer to resume batch submission and the valid L2 chain.


## Batch production toolkit
The batch production toolkit is a set of tools that allow anyone to submit a batch in permissionless mode. It consists of three main components:
1. l2geth state recovery from L1
2. l2geth block production
3. production, proving and submission of batch with `docker-compose.yml`

### Prerequisites
- Unix-like OS, 32GB RAM
- Docker
- [l2geth](https://github.com/scroll-tech/go-ethereum/) or [Docker image](https://hub.docker.com/r/scrolltech/l2geth) of corresponding version [TODO link list with versions](#batch-production-toolkit).
- access to an Ethereum L1 RPC node (beacon node and execution client)
- ability to run a prover or access to a proving service (e.g. Sindri)
- L1 account with funds to pay for the batch submission

### 1. l2geth state recovery from L1
Once permissionless mode is activated there's no blocks being produced and propagated on L2. The first step is to recover the latest state of the L2 chain from L1. This is done by running l2geth in recovery mode.
More information about l2geth recovery (aka L1 follower mode) can be found [here TODO: put correct link once released](https://github.com/scroll-tech/scroll-documentation/pull/374).

Running l2geth in recovery mode requires following configuration:
- `--scroll` or `--scroll-sepolia` - enables Scroll Mainnet or Sepolia mode
- `--da.blob.beaconnode` - L1 RPC beacon node
- `--l1.endpoint` - L1 RPC execution client
- `--da.sync=true` - enables syncing with L1
- `--da.recovery` - enables recovery mode
- `--da.recovery.initiall1block` - initial L1 block (commit tx of initial batch)
- `--da.recovery.initialbatch` - batch where to start recovery from. Can be found on [Scrollscan Explorer](https://scrollscan.com/batches).
- `--da.recovery.l2endblock` - until which L2 block recovery should run (optional)

```bash
./build/bin/geth --scroll<-sepolia> \
--datadir "tmp/datadir" \
--gcmode archive \
--http --http.addr "0.0.0.0" --http.port 8545 --http.api "eth,net,web3,debug,scroll" --http.vhosts "*" \
--da.blob.beaconnode "<L1 RPC beacon node>" \
--l1.endpoint "<L1 RPC execution client>" \
--da.sync=true --da.recovery --da.recovery.initiall1block "<initial L1 block (commit tx of initial batch)>" --da.recovery.initialbatch "<batch where to start recovery from>" --da.recovery.l2endblock "<until which L2 block recovery should run (optional)>" \
--verbosity 3
```

### 2. l2geth block production
After the state is recovered, the next step is to produce blocks on L2. This is done by running l2geth in block production mode.
As a prerequisite, the state recovery must be completed and the latest state of the L2 chain must be available.

You also need to generate a keystore e.g. with [Clef](https://geth.ethereum.org/docs/fundamentals/account-management) to be able to sign blocks.
This key is not used for any funds, but required for block production to work. Once you generated blocks you can safely discard it.

Running l2geth in block production mode requires following configuration:
- `--scroll` or `--scroll-sepolia` - enables Scroll Mainnet or Sepolia mode
- `--da.blob.beaconnode` - L1 RPC beacon node
- `--l1.endpoint` - L1 RPC execution client
- `--da.sync=true` - enables syncing with L1
- `--da.recovery` - enables recovery mode
- `--da.recovery.produceblocks` - enables block production
- `--miner.etherbase '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' --mine` - enables mining. the address is not used, but required for mining to work
- `---miner.gaslimit 1 --miner.gasprice 1 --miner.maxaccountsnum 100 --rpc.gascap 0 --gpo.ignoreprice 1` - gas limits for block production

```bash
./build/bin/geth --scroll<-sepolia> \
--datadir "tmp/datadir" \
--gcmode archive \
--http --http.addr "0.0.0.0" --http.port 8545 --http.api "eth,net,web3,debug,scroll" --http.vhosts "*" \
--da.blob.beaconnode "<L1 RPC beacon node>" \
--l1.endpoint "<L1 RPC execution client>" \
--da.sync=true --da.recovery --da.recovery.produceblocks \
--miner.gaslimit 1 --miner.gasprice 1 --miner.maxaccountsnum 100 --rpc.gascap 0 --gpo.ignoreprice 1 \
--miner.etherbase '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' --mine \
--ccc \
--verbosity 3
Comment on lines +65 to +78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Stray --ccc flag looks accidental

The sample command includes --ccc, which does not exist in l2geth; this will cause the node to abort on unknown flag. Please drop or replace with the intended option.

```

### 3. production, proving and submission of batch with `docker-compose.yml`
After the blocks are produced, the next step is to produce a batch, prove it and submit it to L1. This is done by running the `docker-compose.yml` in the `permissionless-batches` folder.


#### Producing a batch
To produce a batch you need to run the `batch-production-submission` profile in `docker-compose.yml`.

1. Fill `conf/genesis.json` with the latest genesis state from the L2 chain. The genesis for the current fork can be found here: [TODO link list with versions](#batch-production-toolkit)
2. Make sure that `l2geth` with your locally produced blocks is running and reachable from the Docker network (e.g. `http://host.docker.internal:8545`)
3. Fill in required fields in `conf/relayer/config.json`


Run with `docker compose --profile batch-production-submission up`.
This will produce chunks, a batch and bundle which will be proven in the next step.
`Success! You're ready to generate proofs!` indicates that everything is working correctly and the batch is ready to be proven.

#### Proving a batch
To prove the chunk, batch and bundle you just generated you need to run the `proving` profile in `docker-compose.yml`.

1. Make sure `verifier` `low_version_circuit` and `high_version_circuit` in `conf/coordinator/config.json` are correct for the latest fork: [TODO link list with versions](#batch-production-toolkit)
2. Download the latest `assets` and `params` for the circuit from [TODO link list with versions](#batch-production-toolkit) into `conf/coordinator/assets` and `conf/coordinator/params` respectively.
3. Fill in the required fields in `conf/proving-service/config.json`. It is recommended to use Sindri. You'll need to obtain credits and an API key from their [website](https://sindri.app/).
4. Alternatively, you can run your own prover: https://github.com/scroll-tech/scroll-prover. However, this requires more configuration.

Run with `docker compose --profile proving up`.


#### Batch submission
To submit the batch you need to run the `batch-production-submission` profile in `docker-compose.yml`.

1. Fill in required fields in `conf/relayer/config.json` for the sender config.

Run with `docker compose --profile batch-production-submission up`.
This will submit the batch to L1 and finalize it. The transaction will be retried in case of failure.

**Troubleshooting**
- in case the submission fails it will print the calldata for the transaction in an error message. You can use this with `cast call --trace --rpc-url "$SCROLL_L1_DEPLOYMENT_RPC" "$L1_SCROLL_CHAIN_PROXY_ADDR" <calldata>` to see what went wrong.
- `0x4df567b9: ErrorNotInEnforcedBatchMode`: permissionless batch mode is not activated, you can't submit a batch
- `0xa5d305cc: ErrorBatchIsEmpty`: no blob was provided. This is usually returned if you do the `cast call`, permissionless mode is activated but you didn't provide a blob in the transaction.

## Operator recovery
Operator recovery needs to be run by the rollup operator to resume normal rollup operation after permissionless batch mode is deactivated. It consists of two main components:
1. l2geth recovery
2. Relayer recovery

These steps are required to resume permissioned batch submission and the valid L2 chain. They will restore the entire history of the batches submitted during permissionless mode.

### Prerequisites
- l2geth with the latest state of the L2 chain (before permissionless mode was activated)
- signer key for the sequencer according to Clique consensus
- relayer and coordinator are set up, running and up-to-date with the latest state of the L2 chain (before permissionless mode was activated)

### l2geth recovery
Running l2geth in recovery mode requires following configuration:
- `--scroll` or `--scroll-sepolia` - enables Scroll Mainnet or Sepolia mode
- `--da.blob.beaconnode` - L1 RPC beacon node
- `--l1.endpoint` - L1 RPC execution client
- `--da.sync=true` - enables syncing with L1
- `--da.recovery` - enables recovery mode
- `--da.recovery.signblocks` - enables signing blocks with the sequencer and configured key
- `--da.recovery.initiall1block` - initial L1 block (commit tx of initial batch)
- `--da.recovery.initialbatch` - batch where to start recovery from. Can be found on [Scrollscan Explorer](https://scrollscan.com/batches).
- `--da.recovery.l2endblock` - until which L2 block recovery should run (optional)

```bash
./build/bin/geth --scroll<-sepolia> \
--datadir "tmp/datadir" \
--gcmode archive \
--http --http.addr "0.0.0.0" --http.port 8545 --http.api "eth,net,web3,debug,scroll" --http.vhosts "*" \
--da.blob.beaconnode "<L1 RPC beacon node>" \
--l1.endpoint "<L1 RPC execution client>" \
--da.sync=true --da.recovery --da.recovery.signblocks --da.recovery.initiall1block "<initial L1 block (commit tx of initial batch)>" --da.recovery.initialbatch "<batch where to start recovery from>" --da.recovery.l2endblock "<until which L2 block recovery should run (optional)>" \
--verbosity 3
```

After the recovery is finished, start the sequencer in normal operation and continue issuing L2 blocks as normal. This will resume the L2 chain, allow the relayer (after running recovery) to create new batches and allow other L2 follower nodes to sync up the valid and signed L2 chain.

### Relayer recovery
Start the relayer with the following additional top-level configuration:
```
"recovery_config": {
"enable": true
}
```

This will make the relayer recover all the chunks, batches and bundles that were submitted during permissionless mode. These batches are marked automatically as proven and finalized.
Once this process is finished, start the relayer normally without the recovery config to resume normal operation.
```
"recovery_config": {
"enable": false
}
```
Empty file.
38 changes: 38 additions & 0 deletions permissionless-batches/conf/coordinator/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"prover_manager": {
"provers_per_session": 1,
"session_attempts": 5,
"bundle_collection_time_sec": 3600,
"batch_collection_time_sec": 3600,
"chunk_collection_time_sec": 3600,
"verifier": {
"mock_mode": false,
"low_version_circuit": {
"params_path": "./conf/params",
"assets_path": "./conf/assets",
"fork_name": "darwinV2",
"min_prover_version": "v4.4.55"
},
"high_version_circuit": {
"params_path": "./conf/params",
"assets_path": "./conf/assets",
"fork_name": "darwinV2",
"min_prover_version": "v4.4.56"
}
}
},
"db": {
"driver_name": "postgres",
"dsn": "postgres://db/scroll?sslmode=disable&user=postgres",
"maxOpenNum": 200,
"maxIdleNum": 20
},
"l2": {
"chain_id": 111
},
"auth": {
"secret": "prover secret key",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Authentication secret should not be hardcoded.

The authentication secret "prover secret key" appears to be a placeholder and should be replaced with a secure, randomly generated value in production.

Replace the hardcoded secret with an environment variable reference:

-    "secret": "prover secret key",
+    "secret": "${AUTH_SECRET}",

Then ensure this secret is provided through a secure method like environment variables or a secrets management system.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"secret": "prover secret key",
"secret": "${AUTH_SECRET}",

"challenge_expire_duration_sec": 3600,
"login_expire_duration_sec": 3600
}
}
Empty file.
1 change: 1 addition & 0 deletions permissionless-batches/conf/genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<fill with correct genesis.json>
Empty file.
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions permissionless-batches/conf/proving-service/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"prover_name_prefix": "prover_",
"keys_dir": "/app/",
"db_path": "/app/",
"coordinator": {
"base_url": "http://coordinator:8390",
"retry_count": 3,
"retry_wait_time_sec": 5,
"connection_timeout_sec": 60
},
"l2geth": {
"endpoint": "<L2 RPC with generated blocks reachable from Docker network>"
},
"prover": {
"circuit_type": 2,
"circuit_version": "v0.13.1",
"n_workers": 1,
"cloud": {
"base_url": "https://sindri.app/api/v1/",
"api_key": "<API key>",
"retry_count": 3,
"retry_wait_time_sec": 5,
"connection_timeout_sec": 60
}
}
}
Loading