Skip to content

Commit 956c898

Browse files
committed
Merge branch 'main' into julien/fi-p2p
2 parents f728ec2 + e8e8946 commit 956c898

15 files changed

Lines changed: 40 additions & 37 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
## v1.0.0-rc.2
13+
1214
### Changes
1315

1416
- Improve cache handling when there is a significant backlog of pending headers and data. ([#3030](https://github.com/evstack/ev-node/pull/3030))

apps/evm/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ replace (
99

1010
require (
1111
github.com/ethereum/go-ethereum v1.16.8
12-
github.com/evstack/ev-node v1.0.0-rc.1
12+
github.com/evstack/ev-node v1.0.0-rc.2
1313
github.com/evstack/ev-node/core v1.0.0-rc.1
14-
github.com/evstack/ev-node/execution/evm v1.0.0-rc.1
14+
github.com/evstack/ev-node/execution/evm v1.0.0-rc.2
1515
github.com/ipfs/go-datastore v0.9.0
1616
github.com/rs/zerolog v1.34.0
1717
github.com/spf13/cobra v1.10.2

apps/grpc/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ replace (
88
)
99

1010
require (
11-
github.com/evstack/ev-node v1.0.0-rc.1
11+
github.com/evstack/ev-node v1.0.0-rc.2
1212
github.com/evstack/ev-node/core v1.0.0-rc.1
1313
github.com/evstack/ev-node/execution/grpc v1.0.0-rc.1
1414
github.com/ipfs/go-datastore v0.9.0

apps/testapp/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/evstack/ev-node/apps/testapp
33
go 1.25.0
44

55
require (
6-
github.com/evstack/ev-node v1.0.0-rc.1
6+
github.com/evstack/ev-node v1.0.0-rc.2
77
github.com/evstack/ev-node/core v1.0.0-rc.1
88
github.com/ipfs/go-datastore v0.9.0
99
github.com/rs/zerolog v1.34.0

apps/testapp/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6Ni
365365
github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss=
366366
github.com/envoyproxy/protoc-gen-validate v1.0.1/go.mod h1:0vj8bNkYbSTNS2PIyH87KZaeN4x9zpL9Qt8fQC7d+vs=
367367
github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
368-
github.com/evstack/ev-node v1.0.0-rc.1 h1:MO7DT3y1X4WK7pTgl/867NroqhXJ/oe2NbmvMr3jqq8=
369-
github.com/evstack/ev-node v1.0.0-rc.1/go.mod h1:JtbvY2r6k6ZhGYMeDNZk7cx6ALj3d0f6dVyyJmJHBd4=
368+
github.com/evstack/ev-node v1.0.0-rc.2 h1:gUQzLTkCj6D751exm/FIR/yw2aXWiW2aEREEwtxMvw0=
369+
github.com/evstack/ev-node v1.0.0-rc.2/go.mod h1:Qa2nN1D6PJQRU2tiarv6X5Der5OZg/+2QGY/K2mA760=
370370
github.com/evstack/ev-node/core v1.0.0-rc.1 h1:Dic2PMUMAYUl5JW6DkDj6HXDEWYzorVJQuuUJOV0FjE=
371371
github.com/evstack/ev-node/core v1.0.0-rc.1/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
372372
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=

block/internal/submitting/submitter.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,11 @@ func (s *Submitter) Start(ctx context.Context) error {
129129
// Start DA submission loop if signer is available (aggregator nodes only)
130130
if s.signer != nil {
131131
s.logger.Info().Msg("starting DA submission loop")
132-
s.wg.Add(1)
133-
go func() {
134-
defer s.wg.Done()
135-
s.daSubmissionLoop()
136-
}()
132+
s.wg.Go(s.daSubmissionLoop)
137133
}
138134

139135
// Start DA inclusion processing loop (both sync and aggregator nodes)
140-
s.wg.Add(1)
141-
go func() {
142-
defer s.wg.Done()
143-
s.processDAInclusionLoop()
144-
}()
136+
s.wg.Go(s.processDAInclusionLoop)
145137

146138
return nil
147139
}
@@ -345,9 +337,9 @@ func (s *Submitter) processDAInclusionLoop() {
345337

346338
s.logger.Debug().Uint64("height", nextHeight).Msg("advancing DA included height")
347339

348-
// Set sequencer height to DA height mapping using already retrieved data
349-
if err := s.setSequencerHeightToDAHeight(s.ctx, nextHeight, header, data, currentDAIncluded == 0); err != nil {
350-
s.logger.Error().Err(err).Uint64("height", nextHeight).Msg("failed to set sequencer height to DA height mapping")
340+
// Set node height to DA height mapping using already retrieved data
341+
if err := s.setNodeHeightToDAHeight(s.ctx, nextHeight, header, data, currentDAIncluded == 0); err != nil {
342+
s.logger.Error().Err(err).Uint64("height", nextHeight).Msg("failed to set node height to DA height mapping")
351343
break
352344
}
353345

@@ -435,14 +427,14 @@ func (s *Submitter) sendCriticalError(err error) {
435427
}
436428
}
437429

438-
// setSequencerHeightToDAHeight stores the mapping from a ev-node block height to the corresponding
430+
// setNodeHeightToDAHeight stores the mapping from a ev-node block height to the corresponding
439431
// DA (Data Availability) layer heights where the block's header and data were included.
440432
// This mapping is persisted in the store metadata and is used to track which DA heights
441433
// contain the block components for a given ev-node height.
442434
//
443435
// For blocks with empty transactions, both header and data use the same DA height since
444436
// empty transaction data is not actually published to the DA layer.
445-
func (s *Submitter) setSequencerHeightToDAHeight(ctx context.Context, height uint64, header *types.SignedHeader, data *types.Data, genesisInclusion bool) error {
437+
func (s *Submitter) setNodeHeightToDAHeight(ctx context.Context, height uint64, header *types.SignedHeader, data *types.Data, genesisInclusion bool) error {
446438
headerHash, dataHash := header.Hash(), data.DACommitment()
447439

448440
headerDaHeightBytes := make([]byte, 8)

block/internal/submitting/submitter_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ func TestSubmitter_setSequencerHeightToDAHeight(t *testing.T) {
191191
mockStore.On("SetMetadata", mock.Anything, dataKey, dBz).Return(nil).Once()
192192
mockStore.On("SetMetadata", mock.Anything, store.GenesisDAHeightKey, gBz).Return(nil).Once()
193193

194-
require.NoError(t, s.setSequencerHeightToDAHeight(ctx, 1, h, d, true))
194+
require.NoError(t, s.setNodeHeightToDAHeight(ctx, 1, h, d, true))
195195
}
196196

197-
func TestSubmitter_setSequencerHeightToDAHeight_Errors(t *testing.T) {
197+
func TestSubmitter_setNodeHeightToDAHeight_Errors(t *testing.T) {
198198
ctx := t.Context()
199199
cm, st := newTestCacheAndStore(t)
200200

@@ -205,11 +205,11 @@ func TestSubmitter_setSequencerHeightToDAHeight_Errors(t *testing.T) {
205205
// No cache entries -> expect error on missing header
206206
_, ok := cm.GetHeaderDAIncluded(h.Hash().String())
207207
assert.False(t, ok)
208-
assert.Error(t, s.setSequencerHeightToDAHeight(ctx, 1, h, d, false))
208+
assert.Error(t, s.setNodeHeightToDAHeight(ctx, 1, h, d, false))
209209

210210
// Add header, missing data
211211
cm.SetHeaderDAIncluded(h.Hash().String(), 10, 1)
212-
assert.Error(t, s.setSequencerHeightToDAHeight(ctx, 1, h, d, false))
212+
assert.Error(t, s.setNodeHeightToDAHeight(ctx, 1, h, d, false))
213213
}
214214

215215
func TestSubmitter_initializeDAIncludedHeight(t *testing.T) {

block/internal/syncing/da_retriever.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,11 @@ func (r *daRetriever) QueuePriorityHeight(daHeight uint64) {
7979
r.priorityMu.Lock()
8080
defer r.priorityMu.Unlock()
8181

82-
// Skip if already queued
83-
if slices.Contains(r.priorityHeights, daHeight) {
84-
return
82+
idx, found := slices.BinarySearch(r.priorityHeights, daHeight)
83+
if found {
84+
return // Already queued
8585
}
86-
87-
r.priorityHeights = append(r.priorityHeights, daHeight)
88-
// Keep sorted in ascending order so we process lower heights first
89-
slices.Sort(r.priorityHeights)
86+
r.priorityHeights = slices.Insert(r.priorityHeights, idx, daHeight)
9087
}
9188

9289
// PopPriorityHeight returns the next priority height to fetch, or 0 if none.

block/internal/syncing/syncer_backoff_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ func TestSyncer_BackoffOnDAError(t *testing.T) {
7676
syncer.p2pHandler = p2pHandler
7777
p2pHandler.On("SetProcessedHeight", mock.Anything).Return().Maybe()
7878

79+
// Mock PopPriorityHeight to always return 0 (no priority heights)
80+
daRetriever.On("PopPriorityHeight").Return(uint64(0)).Maybe()
81+
7982
// Create mock stores for P2P
8083
mockHeaderStore := extmocks.NewMockStore[*types.SignedHeader](t)
8184
mockHeaderStore.EXPECT().Height().Return(uint64(0)).Maybe()
@@ -164,6 +167,9 @@ func TestSyncer_BackoffResetOnSuccess(t *testing.T) {
164167
syncer.p2pHandler = p2pHandler
165168
p2pHandler.On("SetProcessedHeight", mock.Anything).Return().Maybe()
166169

170+
// Mock PopPriorityHeight to always return 0 (no priority heights)
171+
daRetriever.On("PopPriorityHeight").Return(uint64(0)).Maybe()
172+
167173
// Create mock stores for P2P
168174
mockHeaderStore := extmocks.NewMockStore[*types.SignedHeader](t)
169175
mockHeaderStore.EXPECT().Height().Return(uint64(0)).Maybe()
@@ -246,6 +252,9 @@ func TestSyncer_BackoffBehaviorIntegration(t *testing.T) {
246252
syncer.daRetriever = daRetriever
247253
syncer.p2pHandler = p2pHandler
248254

255+
// Mock PopPriorityHeight to always return 0 (no priority heights)
256+
daRetriever.On("PopPriorityHeight").Return(uint64(0)).Maybe()
257+
249258
// Create mock stores for P2P
250259
mockHeaderStore := extmocks.NewMockStore[*types.SignedHeader](t)
251260
mockHeaderStore.EXPECT().Height().Return(uint64(0)).Maybe()

block/internal/syncing/syncer_benchmark_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ func newBenchFixture(b *testing.B, totalHeights uint64, shuffledTx bool, daDelay
136136

137137
// Mock DA retriever to emit exactly totalHeights events, then HFF and cancel
138138
daR := NewMockDARetriever(b)
139+
daR.On("PopPriorityHeight").Return(uint64(0)).Maybe()
139140
for i := uint64(0); i < totalHeights; i++ {
140141
daHeight := i + daHeightOffset
141142
daR.On("RetrieveFromDA", mock.Anything, daHeight).

0 commit comments

Comments
 (0)