Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIMD 0072: Feature Gate Threshold Automation #72

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
013d0e7
feature-gate-threshold-automation init
buffalojoec Oct 12, 2023
9b601c1
bump to 0072
buffalojoec Oct 19, 2023
24bc2c5
address minor corrections
buffalojoec Oct 19, 2023
fa1f218
revise based on related SIMDs
buffalojoec Dec 15, 2023
4a65303
add garbage collection process
buffalojoec Dec 15, 2023
a7d6a49
add PDA details
buffalojoec Dec 15, 2023
843c83e
revise signal cadence
buffalojoec Dec 15, 2023
e513e82
add instruction layout example
buffalojoec Dec 15, 2023
d705e54
add state layout examples
buffalojoec Dec 15, 2023
a63abbb
add multi-sig activation gate
buffalojoec Dec 15, 2023
7a6c3fc
add additional elaboration
buffalojoec Jan 25, 2024
23f1b24
init new version of 0072
buffalojoec Feb 5, 2024
f830338
add reusable support signal PDA
buffalojoec Mar 14, 2024
2fb901b
update to use validator epoch stake syscall
buffalojoec Mar 14, 2024
ab95740
add updates from SIMD 0133
buffalojoec May 9, 2024
1a8f21a
add some context and wording
buffalojoec May 13, 2024
ea129ba
add c struct for PDA layout
buffalojoec May 13, 2024
bb1c797
hard-coded threshold
buffalojoec May 16, 2024
b85755d
change deadline to 4500 slots
buffalojoec May 16, 2024
66e6371
clarity suggestions
buffalojoec May 22, 2024
58cb436
add more program specification
buffalojoec May 22, 2024
da132f7
one PDA per epoch
buffalojoec Jun 3, 2024
4de5abd
remove slots remaining constraint
buffalojoec Jun 3, 2024
072344f
Update proposals/0072-feature-gate-threshold-automation.md
buffalojoec Jun 3, 2024
9296061
instruction clarity
buffalojoec Jun 3, 2024
458b3ac
update `StageFeatureForActivation` instruction
buffalojoec Aug 14, 2024
d9f399d
update `SignalSupportForStagedFeatures` instruction
buffalojoec Aug 14, 2024
b87cadb
update runtime step
buffalojoec Aug 14, 2024
6e74a91
update state init requirement
buffalojoec Dec 9, 2024
4591f55
mark as idea
buffalojoec Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions proposals/0072-feature-gate-threshold-automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ Feature Gate program. They are detailed in this proposal.
The new process is comprised of the following steps:

1. **Feature Creation:** Contributors create feature accounts as they do now.
2. **Staging Features for Activation:** In some epoch N, a multi-signature
2. **Staging Features for Activation:** In some epoch `N-1`, a multi-signature
authority stages for activation some or all of the features created in step
1, to be activated at the end of the *next epoch*.
3. **Signaling Support for Staged Features:** During the next epoch (epoch N+1),
1, to be activated at the end of the *next epoch* (epoch `N`).
3. **Signaling Support for Staged Features:** During the next epoch (epoch `N`),
validators signal which of the staged feature-gates they support in their
software.
4. **Feature Activation:** At the end of epoch N+1, the runtime activates the
4. **Feature Activation:** At the end of epoch `N`, the runtime activates the
feature-gates that have the required stake support.

### Step 1: Feature Creation
Expand All @@ -102,8 +102,24 @@ expects:
- Staged Features PDA: writable
- Multi-signature authority: signer

One single PDA will be used to store two lists of features. Its data will be
structured as follows:
A PDA will be created for each epoch in which features are staged to be
activated. If no features are staged for a given epoch, that epoch's
corresponding PDA is not created.

These PDAs will not be garbage collected and can be referenced for historical
purposes.

When the first feature for an epoch is staged, the PDA is created. The
`StageFeatureForActivation` processor will debit from the multisig enough
buffalojoec marked this conversation as resolved.
Show resolved Hide resolved
lamports to allocate the new Staged Features PDA.

The address of the Staged Features PDA for a given epoch is derived as follows:

```
"staged_features" + < epoch number >
buffalojoec marked this conversation as resolved.
Show resolved Hide resolved
```

buffalojoec marked this conversation as resolved.
Show resolved Hide resolved
The data for the Staged Features PDA will be structured as follows:

```c
#define FEATURE_ID_SIZE 32
Expand All @@ -123,26 +139,26 @@ typedef struct {
* Staged features for activation.
*/
typedef struct {
/** The current epoch (little-endian u64). */
uint8_t current_epoch[8];
/**
* Features staged for activation at the end of the current epoch, with
* their corresponding signalled stake support.
*/
FeatureStake current_feature_stakes[MAX_FEATURES];

/** The next epoch (little-endian u64). */
uint8_t next_epoch[8];
/** Feature IDs staged for the _next_ epoch. */
uint8_t next_features[MAX_FEATURES][FEATURE_ID_SIZE];
} StagedFeatures;
```

`StageFeatureForActivation` will add the provided feature ID to the **next
epoch's** set of staged features.
`StageFeatureForActivation` may only be invoked during epoch `N-1`, where `N` is
the epoch number used to derive the Staged Features program-derived address.
This is checked by the Feature Gate program using the Clock sysvar.

Features staged during epoch `N-1` are staged to be activated at the end of
epoch `N`.

The Staged Features PDA will be derived simply from one literal seed:
`"staged_features"`.
`StageFeatureForActivation` will add the provided feature ID to the list with
stake support initialized to `0`.

As depicted in the above layout, a maximum of 8 features can be staged for a
given epoch.

### Step 3: Signaling Support for Staged Features

Expand Down Expand Up @@ -180,6 +196,10 @@ delegated to that vote account for the epoch. Then, using the `1` values
provided in the bitmask, the processor will add this stake value to each
corresponding feature ID's stake support in the Staged Features PDA.

Just like the `StageFeatureForActivation` instruction, the Clock sysvar will be
used to ensure the Staged Features PDA corresponding to the *current* epoch was
provided.
buffalojoec marked this conversation as resolved.
Show resolved Hide resolved

Nodes should submit a transaction containing this instruction:

- Any time at least 4500 slots before the end of the epoch.
Expand Down Expand Up @@ -215,22 +235,6 @@ calculated stake support.
If a feature is not activated, either because it has been revoked or it did not
meet the required stake support, it must be resubmitted according to Step 2.

Once the epoch rollover is complete, the Feature Gate program will reset the
Staged Features PDA for the new epoch the very first time it is invoked
without error in the new epoch. Both instructions - `StageFeatureForActivation`
and `SignalSupportForStagedFeature` - will check the value for `next_epoch`
against the *current epoch* value in the `Clock` sysvar before executing the
steps outlined previously in this proposal. If a match is detected, the account
state is reset for the new epoch as follows:

1. The `current_feature_stakes` list is reset to an empty list.
2. The `current_epoch` is set to the value of `next_epoch`.
3. The feature IDs from the `next_features` list are written into the
`current_feature_stakes` list with stake support initialized to zero.
4. The `next_epoch` value is set to the *next* upcoming epoch number
(`current_epoch` + 1).
5. The `next_features` list is reset to an empty list.

## Alternatives Considered

## Impact
Expand Down
Loading