Skip to content
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

feat(relayer): adapt to CodecV7 for EuclidV2 #1583

Open
wants to merge 37 commits into
base: omerfirmak/euclid-prover
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
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
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
fbc14ac
address review comments
jonastheis Feb 20, 2025
e1a0bab
add new contract ABI and adjust submission to it
jonastheis 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
7353f30
update l2geth version in go.mod
jonastheis Feb 28, 2025
673777f
use go 1.22 in Dockerfile builder
jonastheis Feb 28, 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
f91c999
fix batch proposer panic
Thegaram Mar 6, 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
5 changes: 4 additions & 1 deletion build/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ linters-settings:
#local-prefixes: github.com/org/project
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30
min-complexity: 40
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
Expand Down Expand Up @@ -254,6 +254,9 @@ issues:
- linters:
- wsl
text: "expressions should not be cuddled with declarations or returns"
- linters:
- govet
text: 'shadow: declaration of "(err|ctx)" shadows declaration at'

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/rollup_relayer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Download Go dependencies
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as base
FROM scrolltech/go-rust-builder:go-1.22-rust-nightly-2023-12-03 as base

WORKDIR /src
COPY go.work* ./
Expand Down
6 changes: 3 additions & 3 deletions database/migrate/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ func testResetDB(t *testing.T) {
cur, err := Current(pgDB)
assert.NoError(t, err)
// total number of tables.
assert.Equal(t, int64(24), cur)
assert.Equal(t, int64(25), cur)
}

func testMigrate(t *testing.T) {
assert.NoError(t, Migrate(pgDB))
cur, err := Current(pgDB)
assert.NoError(t, err)
assert.Equal(t, int64(24), cur)
assert.Equal(t, int64(25), cur)
}

func testRollback(t *testing.T) {
version, err := Current(pgDB)
assert.NoError(t, err)
assert.Equal(t, int64(24), version)
assert.Equal(t, int64(25), version)

assert.NoError(t, Rollback(pgDB, nil))

Expand Down
26 changes: 26 additions & 0 deletions database/migrate/migrations/00025_add_l1_message_queue_hash.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- +goose Up
-- +goose StatementBegin

ALTER TABLE chunk
ADD COLUMN prev_l1_message_queue_hash VARCHAR DEFAULT '',
ADD COLUMN post_l1_message_queue_hash VARCHAR DEFAULT '';

ALTER TABLE batch
ADD COLUMN prev_l1_message_queue_hash VARCHAR DEFAULT '',
ADD COLUMN post_l1_message_queue_hash VARCHAR DEFAULT '';


-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin

ALTER TABLE IF EXISTS chunk
DROP COLUMN IF EXISTS prev_l1_message_queue_hash,
DROP COLUMN IF EXISTS post_l1_message_queue_hash;

ALTER TABLE IF EXISTS batch
DROP COLUMN IF EXISTS prev_l1_message_queue_hash,
DROP COLUMN IF EXISTS post_l1_message_queue_hash;

-- +goose StatementEnd
192 changes: 192 additions & 0 deletions go.work.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions rollup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ docker_push:
docker push scrolltech/rollup-relayer:${IMAGE_VERSION}

docker:
DOCKER_BUILDKIT=1 docker build -t scrolltech/gas-oracle:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/gas_oracle.Dockerfile
DOCKER_BUILDKIT=1 docker build -t scrolltech/rollup-relayer:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/rollup_relayer.Dockerfile
DOCKER_BUILDKIT=1 docker build -t scrolltech/gas-oracle:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/gas_oracle.Dockerfile --platform=linux/amd64
DOCKER_BUILDKIT=1 docker build -t scrolltech/rollup-relayer:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/rollup_relayer.Dockerfile --platform=linux/amd64
2 changes: 1 addition & 1 deletion rollup/abi/bridge_abi.go

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions rollup/abi/bridge_abi_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package bridgeabi

import (
"fmt"
"math/big"
"testing"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/common/hexutil"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -74,3 +76,20 @@ func TestPackSetL2BaseFee(t *testing.T) {
_, err = l2GasOracleABI.Pack("setL2BaseFee", baseFee)
assert.NoError(err)
}

func TestPrintABISignatures(t *testing.T) {
// print all error signatures of ABI
abi, err := ScrollChainMetaData.GetAbi()
if err != nil {
t.Fatal(err)
}

for _, method := range abi.Methods {
fmt.Println(hexutil.Encode(method.ID[:4]), method.Sig, method.Name)
}

fmt.Println("------------------------------")
for _, errors := range abi.Errors {
fmt.Println(hexutil.Encode(errors.ID[:4]), errors.Sig, errors.Name)
}
}
12 changes: 12 additions & 0 deletions rollup/cmd/rollup_relayer/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ func action(ctx *cli.Context) error {
}

initGenesis := ctx.Bool(utils.ImportGenesisFlag.Name)

// sanity check config
if cfg.L2Config.RelayerConfig.BatchSubmission == nil {
log.Crit("cfg.L2Config.RelayerConfig.BatchSubmission must not be nil")
}
if cfg.L2Config.RelayerConfig.BatchSubmission.MinBatches < 1 {
log.Crit("cfg.L2Config.RelayerConfig.SenderConfig.BatchSubmission.MinBatches must be at least 1")
}
if cfg.L2Config.RelayerConfig.BatchSubmission.MaxBatches < 1 {
log.Crit("cfg.L2Config.RelayerConfig.SenderConfig.BatchSubmission.MaxBatches must be at least 1")
}

l2relayer, err := relayer.NewLayer2Relayer(ctx.Context, l2client, db, cfg.L2Config.RelayerConfig, genesis.Config, initGenesis, relayer.ServiceTypeL2RollupRelayer, registry)
if err != nil {
log.Crit("failed to create l2 relayer", "config file", cfgFile, "error", err)
Expand Down
5 changes: 5 additions & 0 deletions rollup/conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"min_gas_tip": 100000000,
"max_pending_blob_txs": 3
},
"batch_submission": {
"min_batches": 1,
"max_batches": 6,
"timeout": 300
},
"gas_oracle_config": {
"min_gas_price": 0,
"gas_price_diff": 50000
Expand Down
4 changes: 2 additions & 2 deletions rollup/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ require (
github.com/holiman/uint256 v1.3.2
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/client_golang v1.16.0
github.com/scroll-tech/da-codec v0.1.3-0.20250206084714-d61e2cbe7cd5
github.com/scroll-tech/go-ethereum v1.10.14-0.20250205135740-4bdf6d096c38
github.com/scroll-tech/da-codec v0.1.3-0.20250227072756-a1482833595f
github.com/scroll-tech/go-ethereum v1.10.14-0.20250226024115-973bd915b5a2
github.com/smartystreets/goconvey v1.8.0
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
Expand Down
8 changes: 4 additions & 4 deletions rollup/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/scroll-tech/da-codec v0.1.3-0.20250206084714-d61e2cbe7cd5 h1:vsSXTjYDggo6TgHxS8KYl4IYHi+EawpzeqQ64X2W/cw=
github.com/scroll-tech/da-codec v0.1.3-0.20250206084714-d61e2cbe7cd5/go.mod h1:RCDoKwQgZMr/GbD1rKiLA90+0faOzOD6JJm0Bq/7vQs=
github.com/scroll-tech/go-ethereum v1.10.14-0.20250205135740-4bdf6d096c38 h1:IKkevP42IQx8DQvtVq9WOmZDQrto59CGdEheXPf20HA=
github.com/scroll-tech/go-ethereum v1.10.14-0.20250205135740-4bdf6d096c38/go.mod h1:Ik3OBLl7cJxPC+CFyCBYNXBPek4wpdzkWehn/y5qLM8=
github.com/scroll-tech/da-codec v0.1.3-0.20250227072756-a1482833595f h1:YYbhuUwjowqI4oyXtECRofck7Fyj18e1tcRjuQlZpJE=
github.com/scroll-tech/da-codec v0.1.3-0.20250227072756-a1482833595f/go.mod h1:xECEHZLVzbdUn+tNbRJhRIjLGTOTmnFQuTgUTeVLX58=
github.com/scroll-tech/go-ethereum v1.10.14-0.20250226024115-973bd915b5a2 h1:WwqAM3Tx7AEqBL6IJ1h+NPjKhCih/wE0JoBqpCK0E7o=
github.com/scroll-tech/go-ethereum v1.10.14-0.20250226024115-973bd915b5a2/go.mod h1:Oc2wkvXKf9pPdRO87ikCfanlOUkEQhraDte3d1WJaxA=
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/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
Expand Down
11 changes: 11 additions & 0 deletions rollup/internal/config/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ type SenderConfig struct {
MaxPendingBlobTxs int64 `json:"max_pending_blob_txs"`
}

type BatchSubmission struct {
// The minimum number of batches to submit in a single transaction.
MinBatches int `json:"min_batches"`
// The maximum number of batches to submit in a single transaction.
MaxBatches int `json:"max_batches"`
// The time in seconds after which a batch is considered stale and should be submitted ignoring the min batch count.
TimeoutSec int64 `json:"timeout"`
}

// ChainMonitor this config is used to get batch status from chain_monitor API.
type ChainMonitor struct {
Enabled bool `json:"enabled"`
Expand All @@ -48,6 +57,8 @@ type RelayerConfig struct {
GasPriceOracleContractAddress common.Address `json:"gas_price_oracle_contract_address"`
// sender config
SenderConfig *SenderConfig `json:"sender_config"`
// Config for batch submission
BatchSubmission *BatchSubmission `json:"batch_submission"`
// gas oracle config
GasOracleConfig *GasOracleConfig `json:"gas_oracle_config"`
// ChainMonitor config of monitoring service
Expand Down
Loading
Loading