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
Copy file name to clipboardExpand all lines: docs/learn/specs/header-sync.md
+56-8Lines changed: 56 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@
4
4
5
5
The nodes in the P2P network sync headers and data using separate sync services that implement the [go-header][go-header] interface. Evolve uses a header/data separation architecture where headers and transaction data are synchronized independently through parallel services. Each sync service consists of several components as listed below.
6
6
7
-
|Component|Description|
8
-
|---|---|
9
-
|store| a prefixed [datastore][datastore] where synced items are stored (`headerSync` prefix for headers, `dataSync` prefix for data)|
10
-
|subscriber| a [libp2p][libp2p] node pubsub subscriber for the specific data type|
11
-
|P2P server| a server for handling requests between peers in the P2P network|
12
-
|exchange| a client that enables sending in/out-bound requests from/to the P2P network|
13
-
|syncer| a service for efficient synchronization. When a P2P node falls behind and wants to catch up to the latest network head via P2P network, it can use the syncer.|
|store| a prefixed [datastore][datastore] where synced items are stored (`headerSync` prefix for headers, `dataSync` prefix for data)|
10
+
|subscriber| a [libp2p][libp2p] node pubsub subscriber for the specific data type|
11
+
|P2P server| a server for handling requests between peers in the P2P network|
12
+
|exchange| a client that enables sending in/out-bound requests from/to the P2P network|
13
+
|syncer| a service for efficient synchronization. When a P2P node falls behind and wants to catch up to the latest network head via P2P network, it can use the syncer.|
14
14
15
15
## Details
16
16
@@ -22,7 +22,7 @@ Evolve implements two separate sync services:
22
22
- Used by all node types (sequencer, full, and light)
23
23
- Essential for maintaining the canonical view of the chain
24
24
25
-
### Data Sync Service
25
+
### Data Sync Service
26
26
27
27
- Synchronizes `Data` structures containing transaction data
28
28
- Used only by full nodes and sequencers
@@ -90,6 +90,54 @@ The block components integrate with both services through:
90
90
- The Executor component publishes headers and data through broadcast channels
91
91
- Separate stores and channels manage header and data synchronization
92
92
93
+
## DA Height Hints
94
+
95
+
DA Height Hints (DAHint) provide an optimization for P2P synchronization by indicating which DA layer height contains a block's header or data. This allows syncing nodes to fetch missing DA data directly instead of performing sequential DA scanning.
|`DAHeightHint`| Internal struct field storing the hint value |
104
+
|`DAHint()`| Getter method returning the DA height hint |
105
+
|`SetDAHint()`| Setter method for the DA height hint |
106
+
|`P2PSignedHeader`| Wrapper around `SignedHeader` that includes `DAHeightHint`|
107
+
|`P2PData`| Wrapper around `Data` that includes `DAHeightHint`|
108
+
109
+
The term "hint" is used deliberately because:
110
+
111
+
1.**It's advisory, not authoritative**: The hint suggests where to find data on the DA layer, but the authoritative source is always the DA layer itself
112
+
2.**It may be absent**: Hints are only populated during certain sync scenarios (see below)
113
+
3.**It optimizes but doesn't replace**: Nodes can still function without hints by scanning the DA layer sequentially
114
+
115
+
### When DAHints Are Populated
116
+
117
+
DAHints are **only populated when a node catches up from P2P** and is not yet synced to the head. When a node is already synced to the head:
118
+
119
+
- The executor broadcasts headers/data immediately after block creation
120
+
- At this point, DA submission has not occurred yet (it happens later in the flow)
121
+
- Therefore, the broadcasted P2P messages do not contain DA hints
122
+
123
+
This means:
124
+
125
+
-**Syncing nodes** (catching up): Receive headers/data with DA hints populated
126
+
-**Synced nodes** (at head): Receive headers/data without DA hints
127
+
128
+
The DA hints are set by the DA submitter after successful inclusion on the DA layer and stored for later P2P propagation to syncing peers.
129
+
130
+
### Implementation Details
131
+
132
+
The P2P wrapper types (`P2PSignedHeader` and `P2PData`) extend the base types with an optional `DAHeightHint`.
133
+
134
+
The hint is:
135
+
136
+
1.**Set by the DA Submitter** when headers/data are successfully included on the DA layer
137
+
2.**Stored in the P2P store** alongside the header/data
138
+
3.**Propagated via P2P** when syncing nodes request blocks
139
+
4.**Used by the Syncer** to trigger targeted DA retrieval instead of sequential scanning
0 commit comments