Skip to content

Commit 8b99828

Browse files
committed
Merge branch 'main' into alex/2609_hints
* main: chore: fix some minor issues in the comments (#2955) feat: make reaper poll duration configurable (#2951) chore!: move sequencers to pkg (#2931) feat: Ensure Header integrity on DA (#2948) feat(testda): add header support with GetHeaderByHeight method (#2946) chore: improve code comments clarity (#2947) chore(sequencers): optimize store check (#2945)
2 parents 993c2b1 + f14c6a7 commit 8b99828

40 files changed

+519
-108
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
coverage.txt
2+
*.out
23
proto/pb
34
proto/tendermint
45
types/pb/tendermint
@@ -30,3 +31,4 @@ docs/.vitepress/cache
3031
.claude
3132
.gocache
3233
.gomodcache
34+
/.cache

CLAUDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ The project uses a zero-dependency core package pattern:
4444

4545
- **core/** - Contains only interfaces and types, no external dependencies
4646
- **block/** - Block management, creation, validation, and synchronization
47-
- **p2p/** - Networking layer built on libp2p
48-
- **sequencing/** - Modular sequencer implementations
49-
- **testapp/** - Reference implementation for testing
47+
- **pkg/p2p/** - Networking layer built on libp2p
48+
- **pkg/sequencers/** - Modular sequencer implementations
49+
- **apps/testapp/** - Reference implementation for testing
5050

5151
### Key Interfaces
5252

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

5757
### Modular Design
5858

apps/evm/cmd/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import (
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"
29+
"github.com/evstack/ev-node/pkg/sequencers/based"
30+
"github.com/evstack/ev-node/pkg/sequencers/single"
2931
"github.com/evstack/ev-node/pkg/store"
30-
"github.com/evstack/ev-node/sequencers/based"
31-
"github.com/evstack/ev-node/sequencers/single"
3232

3333
"github.com/evstack/ev-node/apps/evm/server"
3434
)

apps/grpc/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ COPY go.mod go.sum ./
1212
COPY apps/grpc/go.mod apps/grpc/go.sum ./apps/grpc/
1313
COPY core/go.mod ./core/
1414
COPY execution/grpc/go.mod execution/grpc/go.sum ./execution/grpc/
15-
COPY sequencers/single/go.mod sequencers/single/go.sum ./sequencers/single/
1615

1716
# Download dependencies
1817
RUN go mod download

apps/grpc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,4 @@ If you have issues connecting to the DA layer:
151151

152152
- [Evolve Documentation](https://ev.xyz)
153153
- [gRPC Execution Interface](../../execution/grpc/README.md)
154-
- [Single Sequencer Documentation](../../sequencers/single/README.md)
154+
- [Single Sequencer Documentation](../../pkg/sequencers/single/README.md)

apps/grpc/cmd/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
rollgenesis "github.com/evstack/ev-node/pkg/genesis"
2323
"github.com/evstack/ev-node/pkg/p2p"
2424
"github.com/evstack/ev-node/pkg/p2p/key"
25+
"github.com/evstack/ev-node/pkg/sequencers/based"
26+
"github.com/evstack/ev-node/pkg/sequencers/single"
2527
"github.com/evstack/ev-node/pkg/store"
26-
"github.com/evstack/ev-node/sequencers/based"
27-
"github.com/evstack/ev-node/sequencers/single"
2828
)
2929

3030
const (

apps/testapp/cmd/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"github.com/evstack/ev-node/pkg/genesis"
2121
"github.com/evstack/ev-node/pkg/p2p"
2222
"github.com/evstack/ev-node/pkg/p2p/key"
23+
"github.com/evstack/ev-node/pkg/sequencers/based"
24+
"github.com/evstack/ev-node/pkg/sequencers/single"
2325
"github.com/evstack/ev-node/pkg/store"
24-
"github.com/evstack/ev-node/sequencers/based"
25-
"github.com/evstack/ev-node/sequencers/single"
2626
)
2727

2828
const testDbName = "testapp"

block/components.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func NewAggregatorComponents(
226226
logger,
227227
executor,
228228
cacheManager,
229-
reaping.DefaultInterval,
229+
config.Node.ScrapeInterval.Duration,
230230
)
231231
if err != nil {
232232
return nil, fmt.Errorf("failed to create reaper: %w", err)

block/internal/reaping/reaper.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ import (
1919
)
2020

2121
const (
22-
// DefaultInterval is the default reaper interval
23-
DefaultInterval = 1 * time.Second
2422
// MaxBackoffInterval is the maximum backoff interval for retries
2523
MaxBackoffInterval = 30 * time.Second
26-
// BackoffMultiplier is the multiplier for exponential backoff
27-
BackoffMultiplier = 2
2824
)
2925

3026
// Reaper is responsible for periodically retrieving transactions from the executor,

block/internal/submitting/da_submitter.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"time"
99

1010
"github.com/rs/zerolog"
11-
"google.golang.org/protobuf/proto"
1211

1312
"github.com/evstack/ev-node/block/internal/cache"
1413
"github.com/evstack/ev-node/block/internal/common"
@@ -171,7 +170,7 @@ func (s *DASubmitter) recordFailure(reason common.DASubmitterFailureReason) {
171170
}
172171

173172
// SubmitHeaders submits pending headers to DA layer
174-
func (s *DASubmitter) SubmitHeaders(ctx context.Context, cache cache.Manager) error {
173+
func (s *DASubmitter) SubmitHeaders(ctx context.Context, cache cache.Manager, signer signer.Signer) error {
175174
headers, err := cache.GetPendingHeaders(ctx)
176175
if err != nil {
177176
return fmt.Errorf("failed to get pending headers: %w", err)
@@ -181,15 +180,29 @@ func (s *DASubmitter) SubmitHeaders(ctx context.Context, cache cache.Manager) er
181180
return nil
182181
}
183182

183+
if signer == nil {
184+
return fmt.Errorf("signer is nil")
185+
}
186+
184187
s.logger.Info().Int("count", len(headers)).Msg("submitting headers to DA")
185188

186189
return submitToDA(s, ctx, headers,
187190
func(header *types.SignedHeader) ([]byte, error) {
188-
headerPb, err := header.ToProto()
191+
// A. Marshal the inner SignedHeader content to bytes (canonical representation for signing)
192+
// This effectively signs "Fields 1-3" of the intended DAHeaderEnvelope.
193+
contentBytes, err := header.MarshalBinary()
189194
if err != nil {
190-
return nil, fmt.Errorf("failed to convert header to proto: %w", err)
195+
return nil, fmt.Errorf("failed to marshal signed header for envelope signing: %w", err)
191196
}
192-
return proto.Marshal(headerPb)
197+
198+
// B. Sign the contentBytes with the envelope signer (aggregator)
199+
envelopeSignature, err := signer.Sign(contentBytes)
200+
if err != nil {
201+
return nil, fmt.Errorf("failed to sign envelope: %w", err)
202+
}
203+
204+
// C. Create the envelope and marshal it
205+
return header.MarshalDAEnvelope(envelopeSignature)
193206
},
194207
func(submitted []*types.SignedHeader, res *datypes.ResultSubmit) {
195208
hashes := make([]types.Hash, len(submitted))

0 commit comments

Comments
 (0)