From dce6ca7a5e6664fba23f863b146e87bb139ecd31 Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Thu, 17 Apr 2025 17:10:25 +0200 Subject: [PATCH 1/3] bump golangci version --- .golangci.yml | 75 +++++++++++-------- block/manager.go | 12 +-- block/manager_test.go | 2 +- docs/cmd/testapp.md | 15 ++-- docs/cmd/testapp_completion.md | 11 ++- docs/cmd/testapp_completion_bash.md | 7 +- docs/cmd/testapp_completion_fish.md | 3 +- docs/cmd/testapp_completion_powershell.md | 3 +- docs/cmd/testapp_completion_zsh.md | 7 +- docs/cmd/testapp_docs-gen.md | 2 +- docs/cmd/testapp_init.md | 2 +- docs/cmd/testapp_node-info.md | 2 +- docs/cmd/testapp_start.md | 2 +- docs/cmd/testapp_unsafe-clean.md | 2 +- docs/cmd/testapp_version.md | 2 +- rollups/evm/single/README.md | 6 +- .../adr-018-forced-inclusion-mechanism.md | 10 +-- types/block.go | 4 +- types/signed_header_test.go | 6 +- types/utils.go | 10 +-- 20 files changed, 95 insertions(+), 88 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index bbde7a81e3..69b60216e5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,41 +1,52 @@ +version: "2" run: - timeout: 5m modules-download-mode: readonly - linters: enable: - errorlint - - errcheck - - gofmt - - gci - gosec - - gosimple - - govet - - ineffassign - misspell - revive - - staticcheck - - typecheck - unconvert - - unused - -linters-settings: - gosec: - excludes: - - G115 - revive: - rules: - - name: package-comments - disabled: true - - name: duplicated-imports - severity: warning - - name: exported - arguments: - - disableStutteringCheck - gci: - custom-order: true - sections: - - standard # Standard section: captures all standard packages. - - default # Default section: contains all imports that could not be matched to another section type. - - prefix(github.com/rollkit) - - prefix(github.com/rollkit/rollkit) + settings: + gosec: + excludes: + - G115 + revive: + rules: + - name: package-comments + disabled: true + - name: duplicated-imports + severity: warning + - name: exported + arguments: + - disableStutteringCheck + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci + - gofmt + settings: + gci: + sections: + - standard + - default + - prefix(github.com/rollkit) + - prefix(github.com/rollkit/rollkit) + custom-order: true + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/block/manager.go b/block/manager.go index 7abe680dc5..6afd22b3a7 100644 --- a/block/manager.go +++ b/block/manager.go @@ -1216,7 +1216,7 @@ func (m *Manager) publishBlock(ctx context.Context) error { } // sanity check timestamp for monotonically increasing - if batchData.Time.Before(lastHeaderTime) { + if batchData.Before(lastHeaderTime) { return fmt.Errorf("timestamp is not monotonically increasing: %s < %s", batchData.Time, m.getLastBlockTime()) } m.logger.Info("Creating and publishing block", "height", newHeight) @@ -1263,7 +1263,7 @@ func (m *Manager) publishBlock(ctx context.Context) error { panic(err) } // Before taking the hash, we need updated ISRs, hence after ApplyBlock - header.Header.DataHash = data.Hash() + header.DataHash = data.Hash() signature, err = m.getSignature(header.Header) if err != nil { @@ -1540,7 +1540,7 @@ func (m *Manager) execCreateBlock(_ context.Context, height uint64, lastSignatur BaseHeader: types.BaseHeader{ ChainID: lastState.ChainID, Height: height, - Time: uint64(batchData.Time.UnixNano()), //nolint:gosec // why is time unix? (tac0turtle) + Time: uint64(batchData.UnixNano()), //nolint:gosec // why is time unix? (tac0turtle) }, LastHeaderHash: lastHeaderHash, DataHash: batchdata, @@ -1556,10 +1556,10 @@ func (m *Manager) execCreateBlock(_ context.Context, height uint64, lastSignatur } blockData := &types.Data{ - Txs: make(types.Txs, len(batchData.Batch.Transactions)), + Txs: make(types.Txs, len(batchData.Transactions)), } - for i := range batchData.Batch.Transactions { - blockData.Txs[i] = types.Tx(batchData.Batch.Transactions[i]) + for i := range batchData.Transactions { + blockData.Txs[i] = types.Tx(batchData.Transactions[i]) } return header, blockData, nil diff --git a/block/manager_test.go b/block/manager_test.go index 523699b53a..e6d88114d6 100644 --- a/block/manager_test.go +++ b/block/manager_test.go @@ -135,7 +135,7 @@ func TestHandleEmptyDataHash(t *testing.T) { // make sure that the store has the correct data d := dataCache.GetItem(header.Height()) require.NotNil(d) - require.Equal(d.Metadata.LastDataHash, lastDataHash) + require.Equal(d.LastDataHash, lastDataHash) require.Equal(d.Metadata.ChainID, header.ChainID()) require.Equal(d.Metadata.Height, header.Height()) require.Equal(d.Metadata.Time, header.BaseHeader.Time) diff --git a/docs/cmd/testapp.md b/docs/cmd/testapp.md index 1d819b0d12..9d5b52bc19 100644 --- a/docs/cmd/testapp.md +++ b/docs/cmd/testapp.md @@ -4,7 +4,6 @@ The first sovereign rollup framework that allows you to launch a sovereign, cust ### Synopsis - Rollkit is the first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. If the --home flag is not specified, the rollkit command will create a folder "~/.testapp" where it will store node keys, config, and data. @@ -20,10 +19,10 @@ If the --home flag is not specified, the rollkit command will create a folder "~ ### SEE ALSO -* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell -* [testapp docs-gen](testapp_docs-gen.md) - Generate documentation for rollkit CLI -* [testapp init](testapp_init.md) - Initialize rollkit config -* [testapp node-info](testapp_node-info.md) - Get information about a running node via RPC -* [testapp start](testapp_start.md) - Run the testapp node -* [testapp unsafe-clean](testapp_unsafe-clean.md) - Remove all contents of the data directory (DANGEROUS: cannot be undone) -* [testapp version](testapp_version.md) - Show version info +* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell +* [testapp docs-gen](testapp_docs-gen.md) - Generate documentation for rollkit CLI +* [testapp init](testapp_init.md) - Initialize rollkit config +* [testapp node-info](testapp_node-info.md) - Get information about a running node via RPC +* [testapp start](testapp_start.md) - Run the testapp node +* [testapp unsafe-clean](testapp_unsafe-clean.md) - Remove all contents of the data directory (DANGEROUS: cannot be undone) +* [testapp version](testapp_version.md) - Show version info diff --git a/docs/cmd/testapp_completion.md b/docs/cmd/testapp_completion.md index 59aed78bba..1def90bc78 100644 --- a/docs/cmd/testapp_completion.md +++ b/docs/cmd/testapp_completion.md @@ -7,7 +7,6 @@ Generate the autocompletion script for the specified shell Generate the autocompletion script for testapp for the specified shell. See each sub-command's help for details on how to use the generated script. - ### Options ``` @@ -25,8 +24,8 @@ See each sub-command's help for details on how to use the generated script. ### SEE ALSO -* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. -* [testapp completion bash](testapp_completion_bash.md) - Generate the autocompletion script for bash -* [testapp completion fish](testapp_completion_fish.md) - Generate the autocompletion script for fish -* [testapp completion powershell](testapp_completion_powershell.md) - Generate the autocompletion script for powershell -* [testapp completion zsh](testapp_completion_zsh.md) - Generate the autocompletion script for zsh +* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. +* [testapp completion bash](testapp_completion_bash.md) - Generate the autocompletion script for bash +* [testapp completion fish](testapp_completion_fish.md) - Generate the autocompletion script for fish +* [testapp completion powershell](testapp_completion_powershell.md) - Generate the autocompletion script for powershell +* [testapp completion zsh](testapp_completion_zsh.md) - Generate the autocompletion script for zsh diff --git a/docs/cmd/testapp_completion_bash.md b/docs/cmd/testapp_completion_bash.md index 26f66c1dfe..9ba5a12168 100644 --- a/docs/cmd/testapp_completion_bash.md +++ b/docs/cmd/testapp_completion_bash.md @@ -15,17 +15,16 @@ To load completions in your current shell session: To load completions for every new session, execute once: -#### Linux: +#### Linux testapp completion bash > /etc/bash_completion.d/testapp -#### macOS: +#### macOS testapp completion bash > $(brew --prefix)/etc/bash_completion.d/testapp You will need to start a new shell for this setup to take effect. - ``` testapp completion bash ``` @@ -48,4 +47,4 @@ testapp completion bash ### SEE ALSO -* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell +* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell diff --git a/docs/cmd/testapp_completion_fish.md b/docs/cmd/testapp_completion_fish.md index 95243db3fa..dde413d502 100644 --- a/docs/cmd/testapp_completion_fish.md +++ b/docs/cmd/testapp_completion_fish.md @@ -16,7 +16,6 @@ To load completions for every new session, execute once: You will need to start a new shell for this setup to take effect. - ``` testapp completion fish [flags] ``` @@ -39,4 +38,4 @@ testapp completion fish [flags] ### SEE ALSO -* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell +* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell diff --git a/docs/cmd/testapp_completion_powershell.md b/docs/cmd/testapp_completion_powershell.md index 4619c95645..391c9c15c6 100644 --- a/docs/cmd/testapp_completion_powershell.md +++ b/docs/cmd/testapp_completion_powershell.md @@ -13,7 +13,6 @@ To load completions in your current shell session: To load completions for every new session, add the output of the above command to your powershell profile. - ``` testapp completion powershell [flags] ``` @@ -36,4 +35,4 @@ testapp completion powershell [flags] ### SEE ALSO -* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell +* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell diff --git a/docs/cmd/testapp_completion_zsh.md b/docs/cmd/testapp_completion_zsh.md index 89ed99acef..282ace43c7 100644 --- a/docs/cmd/testapp_completion_zsh.md +++ b/docs/cmd/testapp_completion_zsh.md @@ -17,17 +17,16 @@ To load completions in your current shell session: To load completions for every new session, execute once: -#### Linux: +#### Linux testapp completion zsh > "${fpath[1]}/_testapp" -#### macOS: +#### macOS testapp completion zsh > $(brew --prefix)/share/zsh/site-functions/_testapp You will need to start a new shell for this setup to take effect. - ``` testapp completion zsh [flags] ``` @@ -50,4 +49,4 @@ testapp completion zsh [flags] ### SEE ALSO -* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell +* [testapp completion](testapp_completion.md) - Generate the autocompletion script for the specified shell diff --git a/docs/cmd/testapp_docs-gen.md b/docs/cmd/testapp_docs-gen.md index 0771ab4895..3d82d7ed8c 100644 --- a/docs/cmd/testapp_docs-gen.md +++ b/docs/cmd/testapp_docs-gen.md @@ -23,4 +23,4 @@ testapp docs-gen [flags] ### SEE ALSO -* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. +* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. diff --git a/docs/cmd/testapp_init.md b/docs/cmd/testapp_init.md index b25808fb3f..bfb930c58f 100644 --- a/docs/cmd/testapp_init.md +++ b/docs/cmd/testapp_init.md @@ -58,4 +58,4 @@ testapp init [flags] ### SEE ALSO -* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. +* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. diff --git a/docs/cmd/testapp_node-info.md b/docs/cmd/testapp_node-info.md index 964b75ee54..04e7aef9bf 100644 --- a/docs/cmd/testapp_node-info.md +++ b/docs/cmd/testapp_node-info.md @@ -27,4 +27,4 @@ testapp node-info [flags] ### SEE ALSO -* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. +* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. diff --git a/docs/cmd/testapp_start.md b/docs/cmd/testapp_start.md index 2ff016d611..d9a89243fe 100644 --- a/docs/cmd/testapp_start.md +++ b/docs/cmd/testapp_start.md @@ -54,4 +54,4 @@ testapp start [flags] ### SEE ALSO -* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. +* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. diff --git a/docs/cmd/testapp_unsafe-clean.md b/docs/cmd/testapp_unsafe-clean.md index 30f67f60c9..efebd09f27 100644 --- a/docs/cmd/testapp_unsafe-clean.md +++ b/docs/cmd/testapp_unsafe-clean.md @@ -28,4 +28,4 @@ testapp unsafe-clean [flags] ### SEE ALSO -* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. +* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. diff --git a/docs/cmd/testapp_version.md b/docs/cmd/testapp_version.md index aade27ff5c..eb65e43c52 100644 --- a/docs/cmd/testapp_version.md +++ b/docs/cmd/testapp_version.md @@ -23,4 +23,4 @@ testapp version [flags] ### SEE ALSO -* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. +* [testapp](testapp.md) - The first sovereign rollup framework that allows you to launch a sovereign, customizable blockchain as easily as a smart contract. diff --git a/rollups/evm/single/README.md b/rollups/evm/single/README.md index 1319d70da3..3acd2d33ab 100644 --- a/rollups/evm/single/README.md +++ b/rollups/evm/single/README.md @@ -14,18 +14,20 @@ This directory contains the implementation of a single EVM sequencer using Rollk 1. For the EVM layer, Reth can be conveniently run using `docker compose` from the go-execution-evm repository. 2. For the DA layer, local-da can be built and run from the `rollkit/da/cmd/local-da` directory. - 2. Build the sequencer: + ```bash go build -o evm-single ./cmd/ ``` 3. Initialize the sequencer: + ```bash ./evm-single init --rollkit.node.aggregator=true --rollkit.signer.passphrase secret ``` 4. Start the sequencer: + ```bash ./evm-single start \ --evm.jwt-secret $(cat /go-execution-evm/docker/jwttoken/jwt.hex) \ @@ -45,4 +47,4 @@ The sequencer can be configured using various command-line flags. The most impor - `--rollkit.signer.passphrase`: Passphrase for the signer - `--evm.jwt-secret`: JWT secret for EVM communication - `--evm.genesis-hash`: Genesis hash of the EVM chain -- `--rollkit.node.block_time`: Block time for the Rollkit node \ No newline at end of file +- `--rollkit.node.block_time`: Block time for the Rollkit node diff --git a/specs/lazy-adr/adr-018-forced-inclusion-mechanism.md b/specs/lazy-adr/adr-018-forced-inclusion-mechanism.md index 0cf20f4acc..04caff41c6 100644 --- a/specs/lazy-adr/adr-018-forced-inclusion-mechanism.md +++ b/specs/lazy-adr/adr-018-forced-inclusion-mechanism.md @@ -57,7 +57,7 @@ flowchart TB validate["Validate time windows"] validateDelay["Validate MinDADelay"] end - + subgraph FallbackMode["Fallback Mode"] detect["Detect sequencer down"] scan["Scan DA for direct txs"] @@ -135,7 +135,7 @@ type SequencerStatus struct { type DAClient interface { // Existing methods // ... - + // New method for forced inclusion GetDirectTransactions(ctx context.Context, fromTime, toTime uint64) ([][]byte, error) // Note: SubmitDirectTransaction is removed as it's not a responsibility of the rollup node @@ -312,7 +312,7 @@ sequenceDiagram S->>R: Sequencer Block N+1 DA->>S: DA Block N+2 S->>R: Sequencer Block N+2 - + Note over S,R: Sequencer Down DA->>R: DA Block N+3 (Direct Txs) Note over R: Fallback Mode Start @@ -321,7 +321,7 @@ sequenceDiagram R->>R: Create Block from Direct Txs DA->>R: DA Block N+5 (Direct Txs) R->>R: Create Block from Direct Txs - + Note over S,R: Sequencer Back Online DA->>S: DA Block N+6 S->>R: Sequencer Block N+6 @@ -438,4 +438,4 @@ Proposed - [Rollkit Single Sequencer ADR-013](https://github.com/rollkit/rollkit/blob/main/specs/lazy-adr/adr-013-single-sequencer.md) - [Rollkit Minimal Header ADR-015](https://github.com/rollkit/rollkit/blob/main/specs/lazy-adr/adr-015-rollkit-minimal-header.md) - [L2 Beat Stages Framework](https://forum.l2beat.com/t/the-stages-framework/291#p-516-stage-1-requirements-3) -- [GitHub Issue #1914: Add Forced Inclusion Mechanism from the DA layer](https://github.com/rollkit/rollkit/issues/1914) \ No newline at end of file +- [GitHub Issue #1914: Add Forced Inclusion Mechanism from the DA layer](https://github.com/rollkit/rollkit/issues/1914) diff --git a/types/block.go b/types/block.go index 5e6b1529d7..e4f3907712 100644 --- a/types/block.go +++ b/types/block.go @@ -99,7 +99,7 @@ func (d *Data) Height() uint64 { // LastHeader returns last header hash of the block. func (d *Data) LastHeader() Hash { - return d.Metadata.LastDataHash + return d.LastDataHash } // Time returns time of the block. @@ -114,7 +114,7 @@ func (d *Data) Verify(untrustedData *Data) error { } dataHash := d.Hash() // Check if the data hash of the untrusted block matches the last data hash of the trusted block - if !bytes.Equal(dataHash[:], untrustedData.Metadata.LastDataHash[:]) { + if !bytes.Equal(dataHash[:], untrustedData.LastDataHash[:]) { return errors.New("data hash of the trusted data does not match with last data hash of the untrusted data") } return nil diff --git a/types/signed_header_test.go b/types/signed_header_test.go index bddfada5b7..9332546d6a 100644 --- a/types/signed_header_test.go +++ b/types/signed_header_test.go @@ -58,7 +58,7 @@ func testVerify(t *testing.T, trusted *SignedHeader, untrustedAdj *SignedHeader, prepare: func() (*SignedHeader, bool) { // Checks for non-adjacency untrusted := *untrustedAdj - untrusted.Header.BaseHeader.Height++ + untrusted.BaseHeader.Height++ return &untrusted, true }, err: nil, @@ -69,7 +69,7 @@ func testVerify(t *testing.T, trusted *SignedHeader, untrustedAdj *SignedHeader, { prepare: func() (*SignedHeader, bool) { untrusted := *untrustedAdj - untrusted.Header.ProposerAddress = GetRandomBytes(32) + untrusted.ProposerAddress = GetRandomBytes(32) return &untrusted, true }, err: &header.VerifyError{ @@ -82,7 +82,7 @@ func testVerify(t *testing.T, trusted *SignedHeader, untrustedAdj *SignedHeader, { prepare: func() (*SignedHeader, bool) { untrusted := *untrustedAdj - untrusted.Header.ProposerAddress = GetRandomBytes(32) + untrusted.ProposerAddress = GetRandomBytes(32) untrusted.BaseHeader.Height++ return &untrusted, true }, diff --git a/types/utils.go b/types/utils.go index 08a4f30d51..ec6cd845c7 100644 --- a/types/utils.go +++ b/types/utils.go @@ -147,11 +147,11 @@ func GetRandomSignedHeaderCustom(config *HeaderConfig, chainID string) (*SignedH Header: GetRandomHeader(chainID), Signer: signer, } - signedHeader.Header.BaseHeader.Height = config.Height - signedHeader.Header.DataHash = config.DataHash - signedHeader.Header.ProposerAddress = signer.Address - signedHeader.Header.ValidatorHash = signer.Address - signedHeader.Header.BaseHeader.Time = uint64(time.Now().UnixNano()) + (config.Height)*10 + signedHeader.BaseHeader.Height = config.Height + signedHeader.DataHash = config.DataHash + signedHeader.ProposerAddress = signer.Address + signedHeader.ValidatorHash = signer.Address + signedHeader.BaseHeader.Time = uint64(time.Now().UnixNano()) + (config.Height)*10 signature, err := GetSignature(signedHeader.Header, config.PrivKey) if err != nil { From ffe41f47ec45bb05f6f3f794dcf1adeb267c1182 Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Fri, 18 Apr 2025 11:58:36 +0200 Subject: [PATCH 2/3] lint --- block/manager.go | 1 + block/reaper.go | 2 ++ block/reaper_test.go | 1 + rollups/evm/single/README.md | 2 +- sequencers/based/README.md | 5 +--- ...12-fully-decentralized-based-sequencing.md | 26 ++++++++++++++++++- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/block/manager.go b/block/manager.go index abb3724c82..3b6af30f05 100644 --- a/block/manager.go +++ b/block/manager.go @@ -19,6 +19,7 @@ import ( "google.golang.org/protobuf/proto" "github.com/rollkit/go-sequencing" + coreda "github.com/rollkit/rollkit/core/da" coreexecutor "github.com/rollkit/rollkit/core/execution" coresequencer "github.com/rollkit/rollkit/core/sequencer" diff --git a/block/reaper.go b/block/reaper.go index 330f5f9346..a517747bf0 100644 --- a/block/reaper.go +++ b/block/reaper.go @@ -8,7 +8,9 @@ import ( "cosmossdk.io/log" ds "github.com/ipfs/go-datastore" + "github.com/rollkit/go-sequencing" + coreexecutor "github.com/rollkit/rollkit/core/execution" coresequencer "github.com/rollkit/rollkit/core/sequencer" ) diff --git a/block/reaper_test.go b/block/reaper_test.go index c1183908e5..4c8a156d14 100644 --- a/block/reaper_test.go +++ b/block/reaper_test.go @@ -10,6 +10,7 @@ import ( "cosmossdk.io/log" ds "github.com/ipfs/go-datastore" dsync "github.com/ipfs/go-datastore/sync" + execution "github.com/rollkit/rollkit/core/execution" sequencer "github.com/rollkit/rollkit/core/sequencer" ) diff --git a/rollups/evm/single/README.md b/rollups/evm/single/README.md index eeafa11967..f9e1f21cd4 100644 --- a/rollups/evm/single/README.md +++ b/rollups/evm/single/README.md @@ -47,4 +47,4 @@ The sequencer can be configured using various command-line flags. The most impor - `--rollkit.signer.passphrase`: Passphrase for the signer - `--evm.jwt-secret`: JWT secret for EVM communication - `--evm.genesis-hash`: Genesis hash of the EVM chain -- `--rollkit.node.block_time`: Block time for the Rollkit node +- `--rollkit.node.block_time`: Block time for the Rollkit node diff --git a/sequencers/based/README.md b/sequencers/based/README.md index b1e95e7ddb..4b49edbc49 100644 --- a/sequencers/based/README.md +++ b/sequencers/based/README.md @@ -23,7 +23,7 @@ This implementation supports EVM execution via `go-execution-evm` and allows con based start [flags] ``` -### Example (Mocha Network with dummy DA): +### Example (Mocha Network with dummy DA) ```bash based start \ @@ -103,6 +103,3 @@ based start \ - Use `--based.max-height-drift` to control batching latency. --- - - - diff --git a/specs/lazy-adr/adr-012-fully-decentralized-based-sequencing.md b/specs/lazy-adr/adr-012-fully-decentralized-based-sequencing.md index 900de672ef..3703acc1c5 100644 --- a/specs/lazy-adr/adr-012-fully-decentralized-based-sequencing.md +++ b/specs/lazy-adr/adr-012-fully-decentralized-based-sequencing.md @@ -15,6 +15,7 @@ Most rollups today rely on centralized or semi-centralized sequencers to form ba Based sequencing eliminates this reliance by having the base layer determine transaction ordering. However, previous implementations still assumed the existence of a proposer to prepare rollup batches. This ADR proposes a **fully decentralized based sequencing model** in which **every full node acts as its own proposer** by independently: + - Reading rollup blobs from the base layer - Applying a deterministic forkchoice rule - Constructing rollup blocks @@ -25,14 +26,17 @@ This approach ensures consistency, removes the need for trusted intermediaries, ## Alternative Approaches ### Centralized Sequencer + - A designated sequencer collects rollup transactions and publishes them to the base layer. - Simpler for UX and latency control, but introduces centralization and failure points. ### Leader-Elected Proposer (e.g., BFT committee or rotating proposer) + - Some nodes are elected to act as proposers for efficiency. - Still introduces trust assumptions, coordination complexity, and MEV-related risks. ### Trusted Rollup Light Client Commitments + - Rollup blocks are committed to L1 (e.g., Ethereum) and verified by a light client. - Adds delay and dependency on L1 finality, and often still relies on centralized proposers. @@ -41,11 +45,13 @@ None of these provide the decentralization and self-sovereignty enabled by a ful ## Decision We adopt a fully decentralized based sequencing model where **every full node in the rollup network acts as its own proposer** by deterministically deriving the next batch using only: + - Base-layer data (e.g., Celestia blobs tagged by rollup ID) - A forkchoice rule: MaxBytes + Bounded L1 Height Drift (maxHeightDrift) - Local execution (e.g., EVM via reth) This model removes the need for: + - A designated sequencer - Coordination mechanisms - Sequencer signatures @@ -117,22 +123,27 @@ sequenceDiagram ## Detailed Design ### User Requirements + - Users submit transactions by: - Posting them directly to the base layer in tagged blobs, **or** - Sending them to any full node's RPC endpoint, which will relay them to the base layer on their behalf - Users can verify finality by checking rollup light clients or DA inclusion ### Systems Affected + - Rollup full nodes - Rollup light clients - Batch building and execution logic ### Forkchoice Rule + A batch is constructed when: + 1. The accumulated size of base-layer blobs >= `MAX_BYTES` 2. OR the L1 height difference since the last batch exceeds `MAX_HEIGHT_DRIFT` All rollup full nodes: + - Track base-layer heights and timestamps - Fetch all rollup-tagged blobs - Apply the rule deterministically @@ -141,21 +152,25 @@ All rollup full nodes: Without forkchoice parameters, full nodes cannot independently produce identical rollup blocks (i.e., matching state roots or headers), as they wouldn’t know how to consistently form batches—specifically, how many transactions to include per batch. The maxHeightDrift parameter addresses this by enabling progress when the maxBytes threshold isn’t met, without relying on global time synchronization. Relying on timestamps could lead to inconsistencies due to clock drift between nodes, so using L1-based timestamps or heights provides a reliable and deterministic reference for batching. #### Configurable Forkchoice rule + By default, the based sequencing supports max bytes along with max height drift as the forkchoice rule; however, this can be made configurable to support different forkchoice strategies, such as prioritizing highest to lowest fee-paying transactions, earliest submitted transactions, application-specific prioritization, or even hybrid strategies that balance throughput, latency, and economic incentives, allowing rollup operators to customize batch construction policies according to their needs. ### Rollup Light Clients Rollup light clients (once implemented) are not expected to re-execute transactions to derive rollup headers. Instead, they will perform verification only. These clients will typically receive headers either: + * via the p2p network along with accompanying proofs, or * from a connected full node, in which case they will still require validity proofs for the received headers. This design ensures that rollup light clients remain lightweight and efficient, relying on cryptographic proofs rather than execution to validate the rollup state. ### Data Structures + - Blob index: to track rollup blobs by height and timestamp - Batch metadata: includes L1 timestamps, blob IDs, and state roots ### APIs + - `GetNextBatch(lastBatchData, maxBytes, maxHeightDrift)`: deterministically builds batch, `maxHeightDrift` can be configured locally instead of passing on every call. - `VerifyBatch(batchData)`: re-derives and checks state - `SubmitRollupBatchTxs(batch [][]byte)`: relays a user transaction(s) to the base layer @@ -181,6 +196,7 @@ To achieve this, we leverage existing EVM transaction fee mechanisms and Engine The user transaction itself includes a maxFeePerGas and maxPriorityFeePerGas—standard EIP-1559 fields. These fees are used as usual by the execution engine during payload construction. Since the full node is named as the fee recipient, it directly receives the gas fees when the transaction is executed, effectively covering its cost of DA submission on the user’s behalf. This approach requires no changes to the EVM engine, remains backward compatible with Ethereum infrastructure, and aligns incentives for honest full nodes to participate in relaying and batching. This design ensures: + * Fee accountability: Users pay for DA inclusion via standard gas fees. * Node neutrality: Any full node can relay a transaction and get compensated. * No execution-layer changes: Works with unmodified reth/op-geth clients. @@ -189,26 +205,32 @@ This design ensures: Additional enhancements like dynamic fee markets, relayer reputation, or rollup-native incentives can be layered atop this base mechanism in the future. ### Efficiency + - Deterministic block production without overhead of consensus - Bound latency ensures timely progress even with low traffic ### Observability + - Each node can log forkchoice decisions, skipped blobs, and batch triggers ### Security + - No sequencer key or proposer trust required - Replayable from public data (DA layer) - Optional transaction relay must not allow censorship or injection ### Privacy + - No privacy regressions; same as base-layer visibility ### Testing + - Unit tests for forkchoice implementation - End-to-end replay tests against base-layer data - Mocked relayer tests for SubmitRollupTx ### Deployment + - No breaking changes to existing based rollup logic - Can be rolled out by disabling proposer logic - Optional relayer logic gated by config flag @@ -220,17 +242,20 @@ Proposed ## Consequences ### Positive + - Removes centralized sequencer - Fully deterministic and transparent - Enables trustless bridges and light clients - Optional relayer support improves UX for walletless or mobile users ### Negative + - Slight increase in complexity in forkchoice validation - Must standardize timestamp and blob access for determinism - Must prevent relayer misuse or spam ### Neutral + - Shifts latency tuning from proposer logic to forkchoice parameters ## References @@ -240,4 +265,3 @@ Proposed - [Surge](https://www.surge.wtf/) - [Spire](https://www.spire.dev/) - [Unifi from Puffer](https://www.puffer.fi/unifi) - From 6240bbef463625eb4bd427308eeed06284abe4c2 Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Fri, 18 Apr 2025 12:02:41 +0200 Subject: [PATCH 3/3] bump lint ci version --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7f538f8e8d..1920fba2fe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: **/**.go go.mod go.sum - - uses: golangci/golangci-lint-action@v6.5.2 + - uses: golangci/golangci-lint-action@v7.0.0 with: version: latest args: --timeout 10m