You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This branch (`perf/block-optimization`) introduces breaking changes to maximize performance in the `block/` package. It is **not wire-compatible** with the main branch.
4
+
5
+
## 1. Combined Header+Data Blobs
6
+
7
+
**Main**: Headers and data are submitted as separate blobs to separate DA namespaces (`HeaderNamespace`, `DataNamespace`). On retrieval, the DA retriever fetches from both namespaces, decodes headers and data independently, then matches them by block height.
8
+
9
+
**This branch**: Headers and data are combined into a single blob using a custom binary encoding (`common.MarshalBlockBlob`/`UnmarshalBlockBlob`). Each blob contains the proto-encoded header, proto-encoded data, and the envelope signature, separated by length prefixes with a magic number prefix (`0x45564E44`). Only the `HeaderNamespace` is used.
10
+
11
+
### Why
12
+
- Eliminates matching overhead (no separate header/data pending maps)
13
+
- Halves DA submission round trips (one blob per block instead of two)
14
+
- Simplifies DA inclusion tracking (single check per block)
15
+
- Removes the `DAHeaderEnvelope` protobuf wrapper and the separate `SignedData` protobuf wrapper
16
+
17
+
## 2. Custom Binary Blob Encoding
18
+
19
+
**Main**: DA blobs use protobuf encoding (`DAHeaderEnvelope` for headers, `SignedData` for data). Each involves allocating proto message structs, converting Go types to proto types, and calling `proto.Marshal`.
20
+
21
+
**This branch**: The combined blob wrapper uses a custom binary format: `[magic 4B][header_len 4B][header_bytes][data_len 4B][data_bytes][sig_len 4B][sig_bytes]`. Individual header and data fields are still proto-encoded internally (hash computation requires it), but the envelope wrapper avoids all proto overhead.
22
+
23
+
### Why
24
+
- Zero allocation for the blob wrapper (direct length-prefixed binary)
25
+
- No proto message pool management for the envelope
26
+
- No `ToProto`/`FromProto` conversion for the DA envelope or signed data
27
+
- Simpler and faster encode/decode path
28
+
29
+
## 3. P2P Sync Removed
30
+
31
+
**Main**: Full nodes sync from both P2P (via `go-header``HeaderSyncService`/`DataSyncService`) and DA. The executor broadcasts produced blocks to P2P peers. P2P events include DA height hints for targeted DA retrieval. The syncer runs a P2P worker loop alongside the DA follower.
32
+
33
+
**This branch**: All P2P sync is removed. Nodes sync exclusively from DA. No P2P broadcasting, no P2P stores, no P2P handler, no DA height hints.
- P2P broadcasting in `executing/executor.go` removed
40
+
- P2P worker loop in syncer removed
41
+
-`SourceP2P` event source removed
42
+
-`DaHeightHints` field removed from `DAHeightEvent`
43
+
-`headerStore`/`dataStore` parameters removed from `NewSyncer` and component constructors
44
+
-`headerSyncService`/`dataSyncService` parameters removed from aggregator component constructors
45
+
-`DAHintAppender` interface removed from DA submitter
46
+
- Separate `SubmitHeaders`/`SubmitData` replaced with single `SubmitBlocks`
47
+
48
+
### Why
49
+
- Removes network overhead from P2P gossip
50
+
- Eliminates the complexity of two sync sources competing
51
+
- DA is the single source of truth, reducing consistency issues
52
+
- Removes libp2p dependency from the block package's hot path
53
+
- Simplifies the syncer from 3 worker loops to 2 (process loop + pending worker)
54
+
55
+
## 4. DA Submitter Simplified
56
+
57
+
**Main**: `DASubmitterAPI` has two methods: `SubmitHeaders` and `SubmitData`, each with separate batching strategies, mutex locks, and retry loops.
58
+
59
+
**This branch**: `DASubmitterAPI` has a single `SubmitBlocks` method that takes headers and data together, creates combined blobs, signs them, and submits to a single namespace. One batching strategy, one mutex, one retry loop.
60
+
61
+
### Why
62
+
- Halves the submission loop complexity
63
+
- Eliminates the envelope cache (no more retry-signing concern)
64
+
- Single retry loop instead of two
65
+
- Combined blobs submitted atomically — no partial header-without-data states
66
+
67
+
## Migration Notes
68
+
69
+
- Existing DA data from main branch is **not readable** by this branch (different blob format)
70
+
- This branch requires a fresh start or a migration tool
71
+
- The `P2PSignedHeader` and `P2PData` types still exist in `types/` but are no longer used by the block package
72
+
- External consumers of `NewSyncComponents` and `NewAggregatorWithCatchupComponents` must update their call sites
0 commit comments