Skip to content

Commit 154d60a

Browse files
committed
change header_length type, change block_producer_time_nanos description
1 parent 5100ff7 commit 154d60a

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

proposals/0307-add-block-header.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,23 @@ differently, the serialized header will be prepended to the first serialized
6969
entry batch in the block.
7070

7171
```
72-
< -- 64 bits -->
73-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
74-
| block_header_flag |
75-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
76-
| version |
77-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
78-
| header_length |
79-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
80-
| block_producer_time_nanos |
81-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
82-
| block_user_agent |
83-
| |
84-
⋮ +30 ⋮
85-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
86-
| ... future fields ... |
87-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
72+
Block Header Layout
73+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
74+
| block_header_flag (64 bits) |
75+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
76+
| version (64 bits) |
77+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
78+
| header_length (16 bits) |
79+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
80+
| block_producer_time_nanos (64 bits) |
81+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
82+
| block_user_agent_len (8 bits) |
83+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
84+
| block_user_agent (0-255 bytes) |
85+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
86+
87+
Note that header fields are packed together without any alignment requirements
88+
or padding.
8889
```
8990

9091
- `block_header_flag: u64` will always be zero. The first 8 bytes of an entry
@@ -97,22 +98,23 @@ to.
9798
- `version: u64` is a positive integer which changes anytime a change is made to
9899
the header. The initial version will be 1.
99100

100-
- `header_length: u64` is the length of the rest of the header in bytes (i.e.
101+
- `header_length: u16` is the length of the rest of the header in bytes (i.e.
101102
not including the `block_header_flag`, `version`, and `header_length` fields).
102103

103104
- `block_producer_time_nanos: u64` is a nanosecond UNIX timestamp representing
104-
the time when the block producer became leader and started constructing the
105-
block.
105+
the time when the block producer started constructing the block.
106106

107-
- `block_user_agent: [u8; 256]` is a string that provides identifying
108-
information about the block producer.
107+
- `block_user_agent_len: u8` the length of the `block_user_agent` string in
108+
bytes.
109109

110-
- `future fields` any other fields that are deemed necessary in the future may
111-
be added with a corresponding change to `version` / `header_length`. For
112-
example, SIMD
110+
- `block_user_agent: String` is a variable length utf-8 encoded string that
111+
provides identifying information about the block producer.
112+
113+
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
113115
[0298](https://github.com/solana-foundation/solana-improvement-documents/pull/298)
114-
proposes a field header, which could be added as a subsequent SIMD (or folded
115-
into this one).
116+
proposes a field header, which could be added as a subsequent SIMD (or even
117+
folded into this one).
116118

117119
### Header Field Specification
118120

@@ -121,18 +123,17 @@ without any enforced constraint on their contents. This SIMD includes the
121123
following fields in the header
122124

123125
- `block_producer_time_nanos`: u64
124-
- `block_user_agent`: [u8; 256]
126+
- `block_user_agent_len`: u8
127+
- `block_user_agent`: String
125128

126129
Because it is desirable to maintain cluster-wide diagnostics this SIMD provides
127130
a suggested format for the `block_user_agent` string which includes basic
128-
information about the block producer. This should be an UTF-8 encoded, null
129-
terminated string. The null character should terminate valid UTF-8 data. Any
130-
data following the null character is ignored by parsers and may contain
131-
arbitrary information. It is expected that all producers use this format,
132-
though this will not be enforced. Clients that choose to opt out of the
133-
suggested format should set the first byte of the field to 0 (i.e. the null
134-
character). The format is loosely based on HTTP `user-agent` header format
135-
specification:
131+
information about the block producer. This should be a UTF-8 encoded variable
132+
length string (up to 255 bytes long). It is not necessarily null-terminated. It
133+
is expected that all producers use the format specified here, though this will
134+
not be enforced. Clients are encouraged to at the very least use a valid utf-8
135+
string and include extraneous data in a way that coheres with the specification.
136+
The format is loosely based on HTTP `user-agent` header format specification:
136137

137138
```
138139
<product>/<product-version> <comment>

0 commit comments

Comments
 (0)