Skip to content

Commit 2079225

Browse files
randygroktac0turtlejulienrbrt
authored
feat: DA Client remove interface part 3, replace types with new code (#2910)
Remove core/da folder and da folder Replace the old jsonrpc and internal/da clients with new one based on blob endpoint. <!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview Closes: #2796 <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> --------- Co-authored-by: tac0turtle <marko@baricevic.me> Co-authored-by: Julien Robert <julien@rbrt.fr>
1 parent f446230 commit 2079225

File tree

117 files changed

+2629
-5895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2629
-5895
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
permissions:
6363
actions: read
6464
contents: read
65+
packages: read
6566
uses: ./.github/workflows/test.yml
6667
secrets: inherit
6768

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
unit_test:
3636
name: Run Unit Tests
3737
runs-on: ubuntu-latest
38+
permissions:
39+
contents: read
40+
packages: read
3841
steps:
3942
- uses: actions/checkout@v6
4043
- name: set up go
@@ -70,6 +73,9 @@ jobs:
7073
name: Run E2E System Tests
7174
needs: build_all-apps
7275
runs-on: ubuntu-latest
76+
permissions:
77+
contents: read
78+
packages: read
7379
steps:
7480
- uses: actions/checkout@v6
7581
- name: set up go

.mockery.yaml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ template: testify
22
template-data:
33
unroll-variadic: true
44
packages:
5-
github.com/evstack/ev-node/core/da:
6-
interfaces:
7-
DA:
8-
config:
9-
pkgname: mocks
10-
filename: da.go
11-
configs:
12-
- dir: ./da/internal/mocks
13-
- dir: ./test/mocks
145
github.com/evstack/ev-node/core/execution:
156
interfaces:
167
Executor:
@@ -67,11 +58,18 @@ packages:
6758
filename: broadcaster_mock.go
6859
github.com/evstack/ev-node/block/internal/da:
6960
interfaces:
70-
BlobAPI:
61+
Client:
7162
config:
72-
dir: ./block/internal/da
73-
pkgname: da
74-
filename: blob_api_mock.go
63+
dir: ./test/mocks
64+
pkgname: mocks
65+
filename: da.go
66+
github.com/evstack/ev-node/pkg/da/types:
67+
interfaces:
68+
Verifier:
69+
config:
70+
dir: ./test/mocks
71+
pkgname: mocks
72+
filename: da_verifier.go
7573
github.com/evstack/ev-node/pkg/da/jsonrpc:
7674
interfaces:
7775
BlobModule:

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727
### Removed
2828

2929
- **BREAKING:** Removed unused and confusing metrics from sequencers and block processing, including sequencer-specific metrics (gas price, blob size, transaction status, pending blocks), channel buffer metrics, overly granular error metrics, block production categorization metrics, and sync lag metrics. Essential metrics for DA submission health, block production, and performance monitoring are retained. [#2904](https://github.com/evstack/ev-node/pull/2904)
30+
- **BREAKING**: Removed `core/da` package and replaced DAClient with internal implementation. The DA client is exposed as `block.FullDAClient`, `block.DAClient`, `block.DAVerifier` without leaking implementation details. [#2910](https://github.com/evstack/ev-node/pull/2910)
31+
32+
## v1.0.0-beta.11
33+
34+
### Improvements
35+
36+
- Loosen syncer validation for allowing swapping sequencer and full node state [#2925](https://github.com/evstack/ev-node/pull/2925)
3037

3138
## v1.0.0-beta.10
3239

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The project uses a zero-dependency core package pattern:
5252

5353
- **Executor** (core/executor.go) - Handles state transitions
5454
- **Sequencer** (core/sequencer.go) - Orders transactions
55-
- **DA** (core/da.go) - Data availability layer abstraction
55+
- **DA** (pkg/da/types) - Data availability layer abstraction
5656

5757
### Modular Design
5858

@@ -120,7 +120,7 @@ go test -race ./package/...
120120

121121
### Adding a New DA Layer
122122

123-
1. Implement the `DA` interface from `core/da.go`
123+
1. Implement the `DA` interface from `pkg/da/types`
124124
2. Add configuration in the appropriate config package
125125
3. Wire it up in the initialization code
126126
4. Add tests following existing patterns

RELEASE.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ Packages must be released in the following order:
9797

9898
These packages only depend on `core` and can be released in parallel after `core`:
9999

100-
1. **github.com/evstack/ev-node/da** - Path: `./da`
101100
2. **github.com/evstack/ev-node** - Path: `./` (root)
102101
3. **github.com/evstack/ev-node/execution/evm** - Path: `./execution/evm`
103102

@@ -157,7 +156,6 @@ git tag execution/evm/v0.3.0
157156
git push origin execution/evm/v0.3.0
158157

159158
# Verify all are available
160-
go list -m github.com/evstack/ev-node/da@v0.3.0
161159
go list -m github.com/evstack/ev-node@v0.3.0
162160
go list -m github.com/evstack/ev-node/execution/evm@v0.3.0
163161
```
@@ -170,7 +168,6 @@ After all dependencies are available:
170168

171169
# Update and release apps/evm
172170
go get github.com/evstack/ev-node/core@v0.3.0
173-
go get github.com/evstack/ev-node/da@v0.3.0
174171
go get github.com/evstack/ev-node/execution/evm@v0.3.0
175172
go get github.com/evstack/ev-node@v0.3.0
176173
go mod tidy

apps/evm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This directory contains the implementation of a single EVM sequencer using Ev-no
1111

1212
1. Both EVM and DA layers must be running before starting the sequencer
1313
1. For the EVM layer, Reth can be conveniently run using `docker compose` from <path_to>/execution/evm/docker.
14-
2. For the DA layer, local-da can be built and run from the `ev-node/da/cmd/local-da` directory.
14+
2. For the DA layer, local-da can be built and run from the `ev-node/tools/local-da` directory.
1515

1616
2. Build the sequencer:
1717

apps/evm/cmd/post_tx_cmd.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import (
1111
"github.com/spf13/cobra"
1212

1313
evblock "github.com/evstack/ev-node/block"
14-
"github.com/evstack/ev-node/core/da"
15-
"github.com/evstack/ev-node/da/jsonrpc"
1614
rollcmd "github.com/evstack/ev-node/pkg/cmd"
1715
rollconf "github.com/evstack/ev-node/pkg/config"
16+
blobrpc "github.com/evstack/ev-node/pkg/da/jsonrpc"
17+
da "github.com/evstack/ev-node/pkg/da/types"
1818
genesispkg "github.com/evstack/ev-node/pkg/genesis"
19-
seqcommon "github.com/evstack/ev-node/sequencers/common"
2019
"github.com/evstack/ev-node/types"
2120
)
2221

@@ -117,12 +116,11 @@ func postTxRunE(cmd *cobra.Command, args []string) error {
117116

118117
logger.Info().Str("namespace", namespace).Float64("gas_price", gasPrice).Int("tx_size", len(txData)).Msg("posting transaction to DA layer")
119118

120-
daClient, err := jsonrpc.NewClient(
119+
daClient, err := blobrpc.NewClient(
121120
cmd.Context(),
122-
logger,
123121
nodeConfig.DA.Address,
124122
nodeConfig.DA.AuthToken,
125-
seqcommon.AbsoluteMaxBlobSize,
123+
"",
126124
)
127125
if err != nil {
128126
return fmt.Errorf("failed to create DA client: %w", err)
@@ -134,7 +132,7 @@ func postTxRunE(cmd *cobra.Command, args []string) error {
134132
blobs := [][]byte{txData}
135133
options := []byte(nodeConfig.DA.SubmitOptions)
136134

137-
dac := evblock.NewDAClient(&daClient.DA, nodeConfig, logger)
135+
dac := evblock.NewDAClient(daClient, nodeConfig, logger)
138136
result := dac.Submit(cmd.Context(), blobs, gasPrice, namespaceBz, options)
139137

140138
// Check result

apps/evm/cmd/run.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,20 @@ import (
1414
"github.com/spf13/cobra"
1515

1616
"github.com/evstack/ev-node/block"
17-
"github.com/evstack/ev-node/core/da"
1817
"github.com/evstack/ev-node/core/execution"
1918
coresequencer "github.com/evstack/ev-node/core/sequencer"
20-
"github.com/evstack/ev-node/da/jsonrpc"
2119
"github.com/evstack/ev-node/execution/evm"
2220
"github.com/evstack/ev-node/node"
2321
rollcmd "github.com/evstack/ev-node/pkg/cmd"
2422
"github.com/evstack/ev-node/pkg/config"
23+
blobrpc "github.com/evstack/ev-node/pkg/da/jsonrpc"
24+
da "github.com/evstack/ev-node/pkg/da/types"
2525
"github.com/evstack/ev-node/pkg/genesis"
2626
genesispkg "github.com/evstack/ev-node/pkg/genesis"
2727
"github.com/evstack/ev-node/pkg/p2p"
2828
"github.com/evstack/ev-node/pkg/p2p/key"
2929
"github.com/evstack/ev-node/pkg/store"
3030
"github.com/evstack/ev-node/sequencers/based"
31-
seqcommon "github.com/evstack/ev-node/sequencers/common"
3231
"github.com/evstack/ev-node/sequencers/single"
3332

3433
"github.com/evstack/ev-node/apps/evm/server"
@@ -56,6 +55,13 @@ var RunCmd = &cobra.Command{
5655

5756
logger := rollcmd.SetupLogger(nodeConfig.Log)
5857

58+
blobClient, err := blobrpc.NewClient(context.Background(), nodeConfig.DA.Address, nodeConfig.DA.AuthToken, "")
59+
if err != nil {
60+
return fmt.Errorf("failed to create blob client: %w", err)
61+
}
62+
63+
daClient := block.NewDAClient(blobClient, nodeConfig, logger)
64+
5965
// Attach logger to the EVM engine client if available
6066
if ec, ok := executor.(*evm.EngineClient); ok {
6167
ec.SetLogger(logger.With().Str("module", "engine_client").Logger())
@@ -66,11 +72,6 @@ var RunCmd = &cobra.Command{
6672

6773
logger.Info().Str("headerNamespace", headerNamespace.HexString()).Str("dataNamespace", dataNamespace.HexString()).Msg("namespaces")
6874

69-
daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, seqcommon.AbsoluteMaxBlobSize)
70-
if err != nil {
71-
return err
72-
}
73-
7475
datastore, err := store.NewDefaultKVStore(nodeConfig.RootDir, nodeConfig.DBPath, evmDbName)
7576
if err != nil {
7677
return err
@@ -87,7 +88,7 @@ var RunCmd = &cobra.Command{
8788
}
8889

8990
// Create sequencer based on configuration
90-
sequencer, err := createSequencer(context.Background(), logger, datastore, &daJrpc.DA, nodeConfig, genesis)
91+
sequencer, err := createSequencer(context.Background(), logger, datastore, nodeConfig, genesis, daClient)
9192
if err != nil {
9293
return err
9394
}
@@ -116,7 +117,7 @@ var RunCmd = &cobra.Command{
116117

117118
forceInclusionServer, err := server.NewForceInclusionServer(
118119
forceInclusionAddr,
119-
&daJrpc.DA,
120+
daClient,
120121
nodeConfig,
121122
genesis,
122123
logger,
@@ -140,7 +141,7 @@ var RunCmd = &cobra.Command{
140141
}()
141142
}
142143

143-
return rollcmd.StartNode(logger, cmd, executor, sequencer, &daJrpc.DA, p2pClient, datastore, nodeConfig, genesis, node.NodeOptions{})
144+
return rollcmd.StartNode(logger, cmd, executor, sequencer, p2pClient, datastore, nodeConfig, genesis, node.NodeOptions{})
144145
},
145146
}
146147

@@ -156,11 +157,10 @@ func createSequencer(
156157
ctx context.Context,
157158
logger zerolog.Logger,
158159
datastore datastore.Batching,
159-
da da.DA,
160160
nodeConfig config.Config,
161161
genesis genesis.Genesis,
162+
daClient block.FullDAClient,
162163
) (coresequencer.Sequencer, error) {
163-
daClient := block.NewDAClient(da, nodeConfig, logger)
164164
fiRetriever := block.NewForcedInclusionRetriever(daClient, genesis, logger)
165165

166166
if nodeConfig.Node.BasedSequencer {
@@ -186,7 +186,7 @@ func createSequencer(
186186
ctx,
187187
logger,
188188
datastore,
189-
da,
189+
daClient,
190190
[]byte(genesis.ChainID),
191191
nodeConfig.Node.BlockTime.Duration,
192192
nodeConfig.Node.Aggregator,

apps/evm/go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ replace github.com/celestiaorg/go-header => github.com/julienrbrt/go-header v0.0
77
replace (
88
github.com/evstack/ev-node => ../../
99
github.com/evstack/ev-node/core => ../../core
10-
github.com/evstack/ev-node/da => ../../da
1110
github.com/evstack/ev-node/execution/evm => ../../execution/evm
1211
)
1312

@@ -16,7 +15,6 @@ require (
1615
github.com/ethereum/go-ethereum v1.16.7
1716
github.com/evstack/ev-node v1.0.0-beta.10
1817
github.com/evstack/ev-node/core v1.0.0-beta.5
19-
github.com/evstack/ev-node/da v0.0.0-00010101000000-000000000000
2018
github.com/evstack/ev-node/execution/evm v1.0.0-beta.3
2119
github.com/ipfs/go-datastore v0.9.0
2220
github.com/rs/zerolog v1.34.0

0 commit comments

Comments
 (0)