@@ -48,6 +48,9 @@ beneficial.
48
48
that will own all feature accounts.
49
49
- ** Staged Features PDA:** A PDA under the Feature Gate program used to track
50
50
features submitted for activation per epoch.
51
+ - ** Validator Support Signal PDA:** A PDA under the Feature Gate program used to
52
+ track a validator's support signal bitmask, which signals which features they
53
+ support.
51
54
- ** Get Epoch Stake Syscall:** The new syscall introduced in
52
55
[ SIMD 0133] ( ./0133-syscall-get-epoch-stake.md )
53
56
that returns the current epoch stake for a given vote account address.
@@ -172,12 +175,49 @@ supported by their software.
172
175
173
176
A node signals its support for staged features by invoking another new Feature
174
177
Gate program instruction: ` SignalSupportForStagedFeatures ` . This instruction
175
- expects:
178
+ expects the Validator Support Signal PDA (defined below) to either exist or be
179
+ funded with enough rent-exempt lamports to initialize state. The processor will
180
+ allocate, assign, and initialize the account if it does not exist.
181
+
182
+ The ` SignalSupportForStagedFeatures ` instruction is structured as follows:
176
183
177
184
- Data: A ` u8 ` bit mask of the staged features.
178
185
- Accounts:
179
186
- Staged Features PDA: writable
180
- - Vote account: signer
187
+ - Validator Support Signal PDA: writable
188
+ - Vote account
189
+ - Authorized voter: signer
190
+ - System program (required only for initializing)
191
+
192
+ The authorized voter signer must match the authorized voter stored in the vote
193
+ account's state.
194
+
195
+ The ` SignalSupportForStagedFeatures ` instruction processor will provide the
196
+ vote account's address to the ` GetEpochStake ` syscall to retrieve the stake
197
+ delegated to that vote account for the epoch. Then, using the ` 1 ` values
198
+ provided in the bitmask (defined below), the processor will add this stake value
199
+ to each corresponding feature ID's stake support in the Staged Features PDA.
200
+
201
+ A node's stake support for features is always accounted for using their most
202
+ recently sent bitmask. Each time a node sends a bitmask, if a previous bitmask
203
+ was already sent for that node, their previous bitmask is first used to deduct
204
+ stake support before adding stake support for the features signalled by the new
205
+ bitmask.
206
+
207
+ Similar to the ` StageFeatureForActivation ` instruction, the Clock sysvar will be
208
+ used to ensure the Staged Features PDA corresponding to the * current* epoch ` N ` was
209
+ provided.
210
+
211
+ If a node does not send this instruction successfully during the current epoch,
212
+ their stake is not tallied. This is analogous to a node signalling support for
213
+ zero features.
214
+
215
+ If a feature is revoked, the list of staged features will not change, and nodes
216
+ may still signal support for this feature. However, the runtime will not
217
+ activate this feature if its corresponding feature account no longer exists
218
+ on-chain.
219
+
220
+ #### Signal Bitmask
181
221
182
222
A bit mask is used as a compressed ordered list of indices. This has two main
183
223
benefits:
@@ -194,24 +234,61 @@ A `1` bit represents support for a feature. For example, for staged features
194
234
` [A, B, C, D, E, F, G, H] ` , if a node wishes to signal support for all features
195
235
except ` E ` and ` H ` , their ` u8 ` value would be 246, or ` 11110110 ` .
196
236
197
- The ` SignalSupportForStagedFeatures ` instruction processor will provide the
198
- vote account's address to the ` GetEpochStake ` syscall to retrieve the stake
199
- delegated to that vote account for the epoch. Then, using the ` 1 ` values
200
- provided in the bitmask, the processor will add this stake value to each
201
- corresponding feature ID's stake support in the Staged Features PDA.
237
+ #### Validator Support Signal PDA State
202
238
203
- Similar to the ` StageFeatureForActivation ` instruction, the Clock sysvar will be
204
- used to ensure the Staged Features PDA corresponding to the * current* epoch ` N ` was
205
- provided.
239
+ A Validator Support Signal PDA will be created for each vote account. It will
240
+ store the node's submitted bitmasks.
206
241
207
- If a node does not send this instruction successfully during the current epoch,
208
- their stake is not tallied. This is analogous to a node signalling support for
209
- zero features.
242
+ As mentioned previously, a node's most recently submitted bitmask is considered
243
+ their signal for the epoch. Validator Support Signal state allows one bitmask
244
+ per epoch, but can store multiple epochs of historical bitmasks. This is useful
245
+ for querying stake support post-epoch. When a new bitmask is submitted for an
246
+ epoch with an existing entry in the account state, it is overwritten.
210
247
211
- If a feature is revoked, the list of staged features will not change, and nodes
212
- may still signal support for this feature. However, the runtime will not
213
- activate this feature if its corresponding feature account no longer exists
214
- on-chain.
248
+ These accounts are never garbage collected since they are reused every epoch.
249
+ This means nodes are only required to pay for rent-exemption once.
250
+
251
+ The address of the Validator Support Signal PDA (for a given epoch?) is derived
252
+ as follows, where ` vote_address ` is the 32 bytes of the validator's vote address.
253
+
254
+ ```
255
+ "support_signal" <vote_address>
256
+ ```
257
+
258
+ The data for the Validator Support Signal PDA will be structured as follows:
259
+
260
+ ``` c
261
+ #define MAX_SIGNALS 4
262
+
263
+ /* *
264
+ * A validator's support signal bitmask along with the epoch the signal
265
+ * corresponds to.
266
+ */
267
+ typedef struct {
268
+ /**
269
+ * The epoch the support signal corresponds to (u64 serialized to
270
+ * little-endian).
271
+ */
272
+ uint8_t epoch[8];
273
+ /** The support signal bitmask. */
274
+ u8 signal;
275
+ /** Padding for 8-byte alignment. */
276
+ uint8_t _padding[7];
277
+ } SupportSignalWithEpoch;
278
+
279
+ /* *
280
+ * A validator's support signal bitmasks with their corresponding epochs.
281
+ */
282
+ typedef struct {
283
+ /**
284
+ * The support signal bitmasks with their corresponding epochs.
285
+ */
286
+ SupportSignalWithEpoch signals[MAX_SIGNALS];
287
+ } ValidatorSupportSignal;
288
+ ```
289
+
290
+ As depicted in the above layout, a validator's signal can be stored (and
291
+ queried) for up to 4 epochs.
215
292
216
293
### Step 4: Feature Activation
217
294
0 commit comments