Skip to content

Commit 2447158

Browse files
committed
docs(p2p/webrtc): Add section about leveraging local pools to reduce block sizes
1 parent 8d0624b commit 2447158

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

p2p/readme.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,37 @@ to propagate and we keep sending the next (+ jumping to the next index)
151151
until we reach the end of the pool. This way we have to keep minimal data
152152
with each peer and it efficiently avoids sending the same data twice.
153153

154+
## Appendix: Future Ideas
155+
156+
### Leveraging Local Pools for Smaller Blocks
157+
158+
Nodes already maintain local pools of transactions and snarks. Many of these stored items later appear in blocks. By using data the node already has, we reduce the amount of information needed for each new block.
159+
160+
#### Motivation
161+
As nodes interact with the network, they receive, verify, and store transactions and snarks in local pools. When a new block arrives, it often includes some of these items. Because the node already has them, the sender need not retransmit the data. This approach offers:
162+
163+
1. **Reduced Bandwidth Usage:**
164+
Eliminating redundant transmissions of known snarks and transactions reduces block size and prevents wasted data exchange.
165+
166+
2. **Decreased Parsing and Validation Overhead:**
167+
With fewer embedded items, nodes spend less time parsing and validating large blocks and their contents, and can more quickly integrate them into local state.
168+
169+
3. **Memory Footprint Optimization:**
170+
By avoiding duplicate data, nodes can maintain more stable memory usage.
171+
172+
#### Practical Considerations
173+
- **Snarks:**
174+
Snarks, being large, benefit most from this approach. Skipping their retransmission saves significant bandwidth.
175+
176+
- **Ensuring Synchronization:**
177+
This approach assumes nodes maintain consistent local pools. The poll-based model and eventual consistency ensure nodes receive needed items before they appear in a block, making it likely that a node has them on hand.
178+
179+
- **Adjusting the Block Format:**
180+
This idea may require altering the protocol so the block references, rather than embeds, items nodes probably have. The node would fetch only missing pieces if a reference does not match its local data.
181+
182+
#### Outcome
183+
By using local data, the network can propagate smaller blocks, improving scalability, reducing resource usage, and speeding propagation.
184+
154185
# OCaml node compatibility
155186
In order to be compatible with the current OCaml node p2p implementation,
156187
we have [libp2p implementation](./libp2p.md) as well. So communication between OCaml

0 commit comments

Comments
 (0)