Skip to content

Commit 66a0d14

Browse files
committed
use footer instead of header
1 parent 154d60a commit 66a0d14

File tree

1 file changed

+46
-35
lines changed

1 file changed

+46
-35
lines changed

proposals/0307-add-block-header.md renamed to proposals/0307-add-block-footer.md

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
simd: '0307'
3-
title: Add Block Header
3+
title: Add Block Footer
44
authors:
55
- jherrera-jump (Firedancer)
66
category: Standard
@@ -14,7 +14,7 @@ development:
1414

1515
## Summary
1616

17-
Add a block header to solana blocks and expose header fields in the
17+
Add a block footer to Solana blocks and expose Footer fields in the
1818
`getBlock` rpc endpoint.
1919

2020
## Motivation
@@ -34,7 +34,7 @@ timestamps. Unfortunately there are some problems with the current approach:
3434
- Vote timestamps will be removed with Alpenglow.
3535

3636
This SIMD solves these issues by including relevant information in a static
37-
block header.
37+
block footer.
3838

3939
## New Terminology
4040

@@ -63,19 +63,19 @@ set contains a handful of shreds (~32). Once sufficient shreds are available
6363
the raw block data is reconstructed and reinterpreted as an array of entry
6464
batches. Entry batches do not cross shred boundaries.
6565

66-
This SIMD add the following header at the beginning of the raw block data. This
66+
This SIMD add the following footer at the end of the raw block data. This
6767
puts it on the same abstraction layer as serialized entry batch data. Put
68-
differently, the serialized header will be prepended to the first serialized
68+
differently, the serialized footer will be appended after the last serialized
6969
entry batch in the block.
7070

7171
```
72-
Block Header Layout
72+
Block Footer Layout
7373
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
74-
| block_header_flag (64 bits) |
74+
| block_footer_flag (64 bits) |
7575
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
7676
| version (64 bits) |
7777
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
78-
| header_length (16 bits) |
78+
| footer_length (16 bits) |
7979
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
8080
| block_producer_time_nanos (64 bits) |
8181
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -84,25 +84,29 @@ entry batch in the block.
8484
| block_user_agent (0-255 bytes) |
8585
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
8686
87-
Note that header fields are packed together without any alignment requirements
87+
Note that footer fields are packed together without any alignment requirements
8888
or padding.
8989
```
9090

91-
- `block_header_flag: u64` will always be zero. The first 8 bytes of an entry
91+
- `block_footer_flag: u64` will always be zero. The first 8 bytes of an entry
9292
batch are always a positive number (the number of entries in the batch), so
93-
this flag allows parsers to differentiate between a normal entry batch and one
94-
with a header prepended. Though not strictly necessary, this may facilitate
95-
parsing block data, and allows us to make the header optional if we ever need
96-
to.
93+
this flag allows parsers to differentiate the footer from a normal entry batch.
94+
This facilitates parsing block data and would also allow us to make the footer
95+
optional if that's ever needed.
9796

9897
- `version: u64` is a positive integer which changes anytime a change is made to
99-
the header. The initial version will be 1.
98+
the footer. The initial version will be 1.
10099

101-
- `header_length: u16` is the length of the rest of the header in bytes (i.e.
102-
not including the `block_header_flag`, `version`, and `header_length` fields).
100+
- `footer_length: u16` is the length of the rest of the footer in bytes (i.e.
101+
not including the `block_footer_flag`, `version`, and `footer_length` fields).
103102

104103
- `block_producer_time_nanos: u64` is a nanosecond UNIX timestamp representing
105104
the time when the block producer started constructing the block.
105+
"started constructing" is the point at which, from the perspective of the
106+
leader, all of the consensus checks required for assuming leadership have
107+
"just passed". For example, in Agave's pre-alpenglow implementations, this would
108+
be in replay/maybe_start_leader. In a post-Alpenglow implementation, this would
109+
be after receiving the proper vote/skip certificate for the previous slot.
106110

107111
- `block_user_agent_len: u8` the length of the `block_user_agent` string in
108112
bytes.
@@ -111,16 +115,16 @@ bytes.
111115
provides identifying information about the block producer.
112116

113117
Any other fields that are deemed necessary in the future may be added with a
114-
corresponding change to `version` / `header_length`. For example, SIMD
118+
corresponding change to `version` / `footer_length`. For example, SIMD
115119
[0298](https://github.com/solana-foundation/solana-improvement-documents/pull/298)
116-
proposes a field header, which could be added as a subsequent SIMD (or even
120+
proposes a header field, which could be added as a subsequent SIMD (or even
117121
folded into this one).
118122

119-
### Header Field Specification
123+
### Footer Field Specification
120124

121-
Header fields will be unilaterally populated by their respective block producer
125+
Footer fields will be unilaterally populated by their respective block producer
122126
without any enforced constraint on their contents. This SIMD includes the
123-
following fields in the header
127+
following fields in the footer
124128

125129
- `block_producer_time_nanos`: u64
126130
- `block_user_agent_len`: u8
@@ -180,10 +184,10 @@ agave/v3.0.0 (doublezero) greedy-scheduler/v3 (mode:perf; another-flag)
180184

181185
### RPC Protocol Changes
182186

183-
The `getBlock` RPC response will be extended to, optionally, include all header
184-
fields. The request will be extended with the `header` parameter, which lets
185-
the client signal that they want the header fields in the response. By default,
186-
header fields will be included in the response.
187+
The `getBlock` RPC response will be extended to, optionally, include all footer
188+
fields. The request will be extended with the `footer` parameter, which lets
189+
the client signal that they want the footer fields in the response. By default,
190+
footer fields will be included in the response.
187191

188192
Sample Request Payload
189193

@@ -199,7 +203,7 @@ Sample Request Payload
199203
"maxSupportedTransactionVersion": 0,
200204
"transactionDetails": "full",
201205
"rewards": false,
202-
"header": true
206+
"footer": true
203207
}
204208
]
205209
}
@@ -217,7 +221,7 @@ Sample Response Payload
217221
"blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
218222
"parentSlot": 429,
219223
"previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
220-
"header": {
224+
"footer": {
221225
"blockProducerTimeNanos": 1750176982899968023,
222226
"blockUserAgent": "agave/v3.0.0 (doublezero) greedy-scheduler/v3 (mode:perf; another-flag)",
223227
},
@@ -246,7 +250,7 @@ Sample Response Payload
246250
"SysvarC1ock11111111111111111111111111111111",
247251
"Vote111111111111111111111111111111111111111"
248252
],
249-
"header": {
253+
"footer": {
250254
"numReadonlySignedAccounts": 0,
251255
"numReadonlyUnsignedAccounts": 3,
252256
"numRequiredSignatures": 1
@@ -272,14 +276,21 @@ Sample Response Payload
272276
```
273277
<!-- markdownlint-restore -->
274278

279+
### Mandating the block footer
280+
281+
While it is possible to make the block footer optional thanks to the
282+
`block_footer_flag` field, this proposal makes it mandatory. Blocks that don't
283+
include a valid footer in the block payload will be flagged as dead blocks and
284+
skipped by the other nodes in the cluster.
285+
275286
## Alternatives Considered
276287

277288
- Do nothing
278289
- We can't estimate block time / duration with sufficient granularity. We
279290
won't be able to estimate at all when votes are changed in alpenglow.
280291
- We will continue to have an incomplete, ephemeral record of who produced
281292
blocks.
282-
- derive timestamp header field from consensus and enforce user agent format
293+
- derive timestamp footer field from consensus and enforce user agent format
283294
- This can and probably should be implemented as a future SIMD. Meanwhile,
284295
these fields are still useful since
285296
1. most of the cluster is expected to
@@ -297,11 +308,11 @@ Sample Response Payload
297308
This change will enable more reliable monitoring and benchmarking for operators
298309
and for the community. Clients and indexers will need to extend both in-memory
299310
and long-term block storage to be aware of the new columns added to the block
300-
header. The client rpc engine will need to change to support the new fields.
311+
footer. The client rpc engine will need to change to support the new fields.
301312

302313
## Security Considerations
303314

304-
- The header fields are untrusted and purely informational. Tools that expose
315+
- The footer fields are untrusted and purely informational. Tools that expose
305316
these fields to external users should clearly communicate their untrusted
306317
nature.
307318

@@ -314,6 +325,6 @@ header. The client rpc engine will need to change to support the new fields.
314325
- RPC requests for old slots should properly document and return a suitable
315326
default value (e.g. None).
316327
- Clients that don't implement this SIMD will reject new blocks because they
317-
will fail to parse the new header.
318-
- Because this header is mandatory, leaders that produce blocks without a
319-
header will skip, since the header is required.
328+
will fail to parse the new footer.
329+
- Because this footer is mandatory, leaders that produce blocks without a
330+
footer will skip.

0 commit comments

Comments
 (0)