Skip to content

SIMD-0161: SBPF versioning and feature gating #161

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Jul 26, 2024

No description provided.

@Lichtso Lichtso changed the title SIMD-XXXX: Explicit versioning and feature gating of SBPF programs SIMD-0161: Explicit versioning and feature gating of SBPF programs Jul 26, 2024
@Lichtso Lichtso changed the title SIMD-0161: Explicit versioning and feature gating of SBPF programs SIMD-0161: SBPF versioning and feature gating Jul 26, 2024
@Lichtso Lichtso force-pushed the sbpf-feature-gating branch from 5ad5633 to cba7237 Compare July 26, 2024 12:50
@Lichtso Lichtso force-pushed the sbpf-feature-gating branch from cba7237 to ab8e75a Compare July 26, 2024 12:53
Block explorers are recommended to display this SBPF version field for program
accounts.

For each SBPF version two feature gates will control its availability:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that we need such a strict system. I think we could probably have several versions active and deployable at the same time, without forcing people to update toolchain and redeploy or pay extra costs.

Take the following examples:

  • dynamic frames: from the vm perspective, it is cheaper to use dynamic frames, because programs potentially page in less memory if an X-deep call stack fits in 1 page vs taking X pages because of fixed framing. We might want to push people to update to increase performance.

  • the sub imm operand swap change: this doesn't materially change anything. It's a nice thing for us to fix for aesthetic reasons, but it doesn't really change anything for developers.

I think I'd prefer an ad-hoc system where depending on the impact of a new SBPF version, we decide whether and how to rug earlier versions (in practice I expect this to happen very rarely).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mandating that all deployments are targeting the newest version does not force anybody to redeploy. It only means that dapp devs have to keep their toolchain updated when they re/deploy. You are right in that it is not necessary to be this strict, but it has the nice effect of allowing us to get more testing exposure for the newest toolchain version.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we shouldn't force re-deployments. Mandating that when you do deploy, you can only deploy the latest SBPF version is a reasonable tradeoff between usability and actually getting new versions adopted.

Comment on lines 69 to 72
| SBPF version | becomes deployable and executable | ceases to be deployable |
| ------------ | --------------------------------- | ----------------------- |
| v1 | | Feature gate A |
| v2 | Feature gate A | Feature gate B |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this purely an example, or are we considering only one version to be able to deploy at a time? It might be helpful to include the number of simultaneous SBPF versions that the network will allow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the proposal right now says that there can only be one deployable version at a time (but many executable versions). See the discussion above.

@Lichtso Lichtso force-pushed the sbpf-feature-gating branch from acc594c to 0cc74f8 Compare October 23, 2024 13:04
Comment on lines +61 to +65
- Another to first disincentivize (via CU costs) and later disable execution
of that SBPF version, so that the runtime and virtual machine can reduce their
complexity again. This feature gate can be shared by multiple SBPF versions,
effectively deprecating larger blocks of versions in order to reduce the amount
of redeployment required from dapp developers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by the word "later" - are we suggesting that the semantics of the feature gate will change over time? Or will there be one feature gate for disincentivization and another for disabling deployment?

Copy link

@topointon-jump topointon-jump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. It's not clear how exactly deprecating older versions will work - could we elaborate on this a bit more in the SIMD?

Block explorers are recommended to display this SBPF version field for program
accounts.

For each SBPF version two feature gates will control its availability:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we shouldn't force re-deployments. Mandating that when you do deploy, you can only deploy the latest SBPF version is a reasonable tradeoff between usability and actually getting new versions adopted.

Comment on lines 67 to 73
### Version discriminator

Currently the protocol deems every value of `e_flags` which is not `0x0020` as
being SBPF v0 and thus valid. This clearly does not scale for multiple versions
and must therefore be changed. With the activation of the first feature gate
which enables the deployment and execution of the first new SBPF version the
discriminator must switch to directly interpret `e_flags` as SBPF version.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we describe exactly how to parse and interpret this field?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a line to describe that via example.

and provide new, better features to dapp developers.

Today, the only way to introduce changes to the program runtime is via feature
gates [link that explains what feature gates are]. For example we have used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link is missing.


## Summary

An explicit versioning system for SBPF programs, that allows enabling or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An explicit versioning system for SBPF programs, that allows enabling or
An explicit versioning system for SBPF programs, which allows enabling or

by their users to redeploy their programs once the deprecation CU cost ramps
up.

Finalized programs which simply can not be redeployed will instead have their
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Finalized programs which simply can not be redeployed will instead have their
Finalized programs that simply can not be redeployed will instead have their

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants