Skip to content

Commit 16889f5

Browse files
committed
move to sequencer
1 parent 2c5fdbf commit 16889f5

38 files changed

Lines changed: 380 additions & 182 deletions

.mockery.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ packages:
4848
filename: external/hstore.go
4949
github.com/evstack/ev-node/block/internal/syncing:
5050
interfaces:
51+
DARetriever:
52+
config:
53+
dir: ./block/internal/syncing
54+
pkgname: syncing
55+
filename: da_retriever_mock.go
5156
p2pHandler:
5257
config:
5358
dir: ./block/internal/syncing
@@ -60,8 +65,3 @@ packages:
6065
dir: ./block/internal/common
6166
pkgname: common
6267
filename: broadcaster_mock.go
63-
DARetriever:
64-
config:
65-
dir: ./block/internal/common
66-
pkgname: common
67-
filename: da_retriever_mock.go

apps/evm/single/cmd/run.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,29 @@ func createSequencer(
140140
return nil, fmt.Errorf("failed to create single sequencer metrics: %w", err)
141141
}
142142

143+
// Create DA retriever for forced inclusion support
144+
var daRetriever single.DARetriever
145+
if nodeConfig.Node.Aggregator {
146+
commonDARetriever, err := block.NewDARetriever(da, nodeConfig, genesis, logger)
147+
if err != nil {
148+
return nil, fmt.Errorf("failed to create DA retriever: %w", err)
149+
}
150+
151+
// Adapter function to convert between common and single event types
152+
adapterFunc := func(ctx context.Context, daHeight uint64) (*single.ForcedInclusionEvent, error) {
153+
event, err := commonDARetriever.RetrieveForcedIncludedTxsFromDA(ctx, daHeight)
154+
if err != nil {
155+
return nil, err
156+
}
157+
return &single.ForcedInclusionEvent{
158+
Txs: event.Txs,
159+
StartDaHeight: event.StartDaHeight,
160+
EndDaHeight: event.EndDaHeight,
161+
}, nil
162+
}
163+
daRetriever = single.NewDARetrieverAdapter(adapterFunc)
164+
}
165+
143166
sequencer, err := single.NewSequencer(
144167
ctx,
145168
logger,
@@ -149,11 +172,19 @@ func createSequencer(
149172
nodeConfig.Node.BlockTime.Duration,
150173
singleMetrics,
151174
nodeConfig.Node.Aggregator,
175+
1000,
176+
daRetriever,
177+
genesis,
152178
)
153179
if err != nil {
154180
return nil, fmt.Errorf("failed to create single sequencer: %w", err)
155181
}
156182

183+
logger.Info().
184+
Bool("forced_inclusion_enabled", daRetriever != nil).
185+
Str("forced_inclusion_namespace", nodeConfig.DA.GetForcedInclusionNamespace()).
186+
Msg("single sequencer initialized")
187+
157188
return sequencer, nil
158189
}
159190

apps/evm/single/go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ go 1.24.6
44

55
replace github.com/celestiaorg/go-header => github.com/julienrbrt/go-header v0.0.0-20251008134330-747c8c192fa8 // TODO: to remove after https://github.com/celestiaorg/go-header/pull/347
66

7-
replace github.com/evstack/ev-node => ../../../
7+
replace (
8+
github.com/evstack/ev-node => ../../../
9+
github.com/evstack/ev-node/core => ../../../core
10+
github.com/evstack/ev-node/sequencers/single => ../../../sequencers/single
11+
)
812

913
require (
1014
github.com/celestiaorg/go-header v0.7.3

apps/evm/single/go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,10 @@ github.com/ethereum/go-ethereum v1.16.5 h1:GZI995PZkzP7ySCxEFaOPzS8+bd8NldE//1qv
103103
github.com/ethereum/go-ethereum v1.16.5/go.mod h1:kId9vOtlYg3PZk9VwKbGlQmSACB5ESPTBGT+M9zjmok=
104104
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
105105
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
106-
github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo=
107-
github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
108106
github.com/evstack/ev-node/da v1.0.0-beta.5 h1:rWs/H0Nkj9uwTqD7Tzu+PpaNHGFE71B1ZVKCFLx0yVI=
109107
github.com/evstack/ev-node/da v1.0.0-beta.5/go.mod h1:lJ7vGlczBwiqTaTE9C4zV9tEsQO+oi0sqyUyYzj3zpo=
110108
github.com/evstack/ev-node/execution/evm v1.0.0-beta.3 h1:xo0mZz3CJtntP1RPLFDBubBKpNkqStImt9H9N0xysj8=
111109
github.com/evstack/ev-node/execution/evm v1.0.0-beta.3/go.mod h1:yazCKZaVczYwizfHYSQ4KIYqW0d42M7q7e9AxuSXV3s=
112-
github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3 h1:BT/UeH7Tf8z0btzomCzTbbDDZGAT8/yHcd6xY6P/aaw=
113-
github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3/go.mod h1:eCkDecdJ3s7TB3R5nFdPDyz7jjRmwYen6lGe9D2sSH4=
114110
github.com/ferranbt/fastssz v0.1.4 h1:OCDB+dYDEQDvAgtAGnTSidK1Pe2tW3nFV40XyMkTeDY=
115111
github.com/ferranbt/fastssz v0.1.4/go.mod h1:Ea3+oeoRGGLGm5shYAeDgu6PGUlcvQhE2fILyD9+tGg=
116112
github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU=

apps/grpc/single/cmd/run.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,28 @@ func createSequencer(
149149
return nil, fmt.Errorf("failed to create single sequencer metrics: %w", err)
150150
}
151151

152+
// Create DA retriever for forced inclusion support
153+
var daRetriever single.DARetriever
154+
if nodeConfig.Node.Aggregator {
155+
commonDARetriever, err := block.NewDARetriever(da, nodeConfig, genesis, logger)
156+
if err != nil {
157+
return nil, fmt.Errorf("failed to create DA retriever: %w", err)
158+
}
159+
// Adapter function to convert between common and single event types
160+
adapterFunc := func(ctx context.Context, daHeight uint64) (*single.ForcedInclusionEvent, error) {
161+
event, err := commonDARetriever.RetrieveForcedIncludedTxsFromDA(ctx, daHeight)
162+
if err != nil {
163+
return nil, err
164+
}
165+
return &single.ForcedInclusionEvent{
166+
Txs: event.Txs,
167+
StartDaHeight: event.StartDaHeight,
168+
EndDaHeight: event.EndDaHeight,
169+
}, nil
170+
}
171+
daRetriever = single.NewDARetrieverAdapter(adapterFunc)
172+
}
173+
152174
sequencer, err := single.NewSequencer(
153175
ctx,
154176
logger,
@@ -158,11 +180,19 @@ func createSequencer(
158180
nodeConfig.Node.BlockTime.Duration,
159181
singleMetrics,
160182
nodeConfig.Node.Aggregator,
183+
1000,
184+
daRetriever,
185+
genesis,
161186
)
162187
if err != nil {
163188
return nil, fmt.Errorf("failed to create single sequencer: %w", err)
164189
}
165190

191+
logger.Info().
192+
Bool("forced_inclusion_enabled", daRetriever != nil).
193+
Str("forced_inclusion_namespace", nodeConfig.DA.GetForcedInclusionNamespace()).
194+
Msg("single sequencer initialized")
195+
166196
return sequencer, nil
167197
}
168198

apps/grpc/single/go.mod

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ module github.com/evstack/ev-node/apps/grpc/single
22

33
go 1.24.6
44

5+
replace (
6+
github.com/evstack/ev-node => ../../../
7+
github.com/evstack/ev-node/core => ../../../core
8+
github.com/evstack/ev-node/execution/grpc => ../../../execution/grpc
9+
github.com/evstack/ev-node/sequencers/single => ../../../sequencers/single
10+
)
11+
512
require (
613
github.com/evstack/ev-node v1.0.0-beta.9
714
github.com/evstack/ev-node/core v1.0.0-beta.4
@@ -73,7 +80,7 @@ require (
7380
github.com/libp2p/go-reuseport v0.4.0 // indirect
7481
github.com/libp2p/go-yamux/v5 v5.0.1 // indirect
7582
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
76-
github.com/mattn/go-colorable v0.1.13 // indirect
83+
github.com/mattn/go-colorable v0.1.14 // indirect
7784
github.com/mattn/go-isatty v0.0.20 // indirect
7885
github.com/miekg/dns v1.1.68 // indirect
7986
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
@@ -163,8 +170,3 @@ require (
163170
gopkg.in/yaml.v3 v3.0.1 // indirect
164171
lukechampine.com/blake3 v1.4.1 // indirect
165172
)
166-
167-
replace (
168-
github.com/evstack/ev-node => ../../../
169-
github.com/evstack/ev-node/execution/grpc => ../../../execution/grpc
170-
)

apps/grpc/single/go.sum

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
6262
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
6363
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
6464
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
65-
github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo=
66-
github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
6765
github.com/evstack/ev-node/da v1.0.0-beta.5 h1:rWs/H0Nkj9uwTqD7Tzu+PpaNHGFE71B1ZVKCFLx0yVI=
6866
github.com/evstack/ev-node/da v1.0.0-beta.5/go.mod h1:lJ7vGlczBwiqTaTE9C4zV9tEsQO+oi0sqyUyYzj3zpo=
69-
github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3 h1:BT/UeH7Tf8z0btzomCzTbbDDZGAT8/yHcd6xY6P/aaw=
70-
github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3/go.mod h1:eCkDecdJ3s7TB3R5nFdPDyz7jjRmwYen6lGe9D2sSH4=
7167
github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU=
7268
github.com/filecoin-project/go-clock v0.1.0/go.mod h1:4uB/O4PvOjlx1VCMdZ9MyDZXRm//gkj1ELEbxfI1AZs=
7369
github.com/filecoin-project/go-jsonrpc v0.9.0 h1:G47qEF52w7GholpI21vPSTVBFvsrip6geIoqNiqyZtQ=
@@ -235,8 +231,9 @@ github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm
235231
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
236232
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk=
237233
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU=
238-
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
239234
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
235+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
236+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
240237
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
241238
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
242239
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=

apps/testapp/cmd/run.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,29 @@ func createSequencer(
146146
return nil, fmt.Errorf("failed to create single sequencer metrics: %w", err)
147147
}
148148

149+
// Create DA retriever for forced inclusion support
150+
var daRetriever single.DARetriever
151+
if nodeConfig.Node.Aggregator {
152+
commonDARetriever, err := block.NewDARetriever(da, nodeConfig, genesis, logger)
153+
if err != nil {
154+
return nil, fmt.Errorf("failed to create DA retriever: %w", err)
155+
}
156+
157+
// Adapter function to convert between common and single event types
158+
adapterFunc := func(ctx context.Context, daHeight uint64) (*single.ForcedInclusionEvent, error) {
159+
event, err := commonDARetriever.RetrieveForcedIncludedTxsFromDA(ctx, daHeight)
160+
if err != nil {
161+
return nil, err
162+
}
163+
return &single.ForcedInclusionEvent{
164+
Txs: event.Txs,
165+
StartDaHeight: event.StartDaHeight,
166+
EndDaHeight: event.EndDaHeight,
167+
}, nil
168+
}
169+
daRetriever = single.NewDARetrieverAdapter(adapterFunc)
170+
}
171+
149172
sequencer, err := single.NewSequencer(
150173
ctx,
151174
logger,
@@ -155,10 +178,18 @@ func createSequencer(
155178
nodeConfig.Node.BlockTime.Duration,
156179
singleMetrics,
157180
nodeConfig.Node.Aggregator,
181+
1000,
182+
daRetriever,
183+
genesis,
158184
)
159185
if err != nil {
160186
return nil, fmt.Errorf("failed to create single sequencer: %w", err)
161187
}
162188

189+
logger.Info().
190+
Bool("forced_inclusion_enabled", daRetriever != nil).
191+
Str("forced_inclusion_namespace", nodeConfig.DA.GetForcedInclusionNamespace()).
192+
Msg("single sequencer initialized")
193+
163194
return sequencer, nil
164195
}

apps/testapp/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/celestiaorg/go-header v0.7.3
1616
github.com/evstack/ev-node v1.0.0-beta.9
1717
github.com/evstack/ev-node/core v1.0.0-beta.4
18-
github.com/evstack/ev-node/da v0.0.0-00010101000000-000000000000
18+
github.com/evstack/ev-node/da v1.0.0-beta.5
1919
github.com/evstack/ev-node/sequencers/single v0.0.0-00010101000000-000000000000
2020
github.com/ipfs/go-datastore v0.9.0
2121
github.com/rs/zerolog v1.34.0
@@ -82,7 +82,7 @@ require (
8282
github.com/libp2p/go-reuseport v0.4.0 // indirect
8383
github.com/libp2p/go-yamux/v5 v5.0.1 // indirect
8484
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
85-
github.com/mattn/go-colorable v0.1.13 // indirect
85+
github.com/mattn/go-colorable v0.1.14 // indirect
8686
github.com/mattn/go-isatty v0.0.20 // indirect
8787
github.com/miekg/dns v1.1.68 // indirect
8888
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect

apps/testapp/go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm
229229
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
230230
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk=
231231
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU=
232-
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
233232
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
233+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
234+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
234235
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
235236
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
236237
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=

0 commit comments

Comments
 (0)