@@ -69,22 +69,23 @@ differently, the serialized header will be prepended to the first serialized
69
69
entry batch in the block.
70
70
71
71
```
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.
88
89
```
89
90
90
91
- ` block_header_flag: u64 ` will always be zero. The first 8 bytes of an entry
97
98
- ` version: u64 ` is a positive integer which changes anytime a change is made to
98
99
the header. The initial version will be 1.
99
100
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.
101
102
not including the ` block_header_flag ` , ` version ` , and ` header_length ` fields).
102
103
103
104
- ` 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.
106
106
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 .
109
109
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
113
115
[ 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).
116
118
117
119
### Header Field Specification
118
120
@@ -121,18 +123,17 @@ without any enforced constraint on their contents. This SIMD includes the
121
123
following fields in the header
122
124
123
125
- ` block_producer_time_nanos ` : u64
124
- - ` block_user_agent ` : [ u8; 256]
126
+ - ` block_user_agent_len ` : u8
127
+ - ` block_user_agent ` : String
125
128
126
129
Because it is desirable to maintain cluster-wide diagnostics this SIMD provides
127
130
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:
136
137
137
138
```
138
139
<product>/<product-version> <comment>
0 commit comments