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-0094: deprecate executable update for bpf loader #94

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Changes from 4 commits
Commits
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
67 changes: 67 additions & 0 deletions proposals/0094-deprecate-executable-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
simd: '0094'
title: Deprecate executable update in bpf loader
authors:
- Haoran Yi
category: Standard
type: Core
status: Draft
created: 2023-12-13
feature: (fill in with feature tracking issues once accepted)
extends: 0162
---

## Summary

Deprecate executable update during bpf program deployment.

## Motivation

Currently, when a program is deployed, the "executable" flag on the account is
set to true for legacy reasons. However, (a) old bpf loaders, such as v1 and v2,
are disabled on mainnet (SIMD-0093); (b) we are going to remove accounts
executable checks for runtime execution (SIMD-0162). (c) the future bpf
loader-v4 no longer need "executable" flag.

Because of these above reasons, "executable" flag becomes irrelevant and
provides no functional benefit for runtime execution. Therefore, we want to
deprecate its update during bpf program deployment for loader-v3.

## Alternatives Considered

None

## New Terminology

None

## Detailed Design

When the feature - "deprecate executable update" is activated, the bpf loader-V3
will no longer update *executable* flag to true after program deployment.

The "executable" flag remains false after program deployment.

## Impact

This will affect the following scenarios.

- program accounts hash after deployment. Since this change is guarded by a
feature, program accounts hash change won't break consensus.
- any dapps that depend on `is_executable` to be true on the serialized
instruction accounts. Existing program deployed on chain will work fine.
However, if the program is redeployed, it may be broken. Before redeployment,
dapps developer will need to check and update the program if it depends on
`is_executable`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly a big deal for dApp developers, cc @acheroncrypto

Copy link
Contributor Author

@HaoranYi HaoranYi Oct 7, 2024

Choose a reason for hiding this comment

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

Yes, it is a bit disruptive. But it is a good step to move forward.
Once this change is done, we can skip serialize "executable" flag at all, which is a good win to serialization time too.

Choose a reason for hiding this comment

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

Possibly a big deal for dApp developers, cc @acheroncrypto

It shouldn't affect Anchor as long as AccountInfo.executable doesn't change (see solana-labs/solana#34425 (comment)).

Choose a reason for hiding this comment

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

The usage of is_executable and executable is a bit confusing. I think using something like <TYPE>.is_executable would help resolve this ambiguity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't affect Anchor as long as AccountInfo.executable doesn't change (see solana-labs/solana#34425 (comment)).

Yeah. updated.

Copy link
Contributor Author

@HaoranYi HaoranYi Oct 7, 2024

Choose a reason for hiding this comment

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

It shouldn't affect Anchor as long as AccountInfo.executable doesn't change (see solana-labs/solana#34425 (comment)).

@acheroncrypto With this proposal, AccountInfo.executable will change. In the original implementation that you mentioned above, AccountInfo.executable doesn't change because we emulate it at serialization time. But that turns out to be very expensive - 10X increase of serialization. Therefore, in this proposal, we won't emulate executable at serialization time. Hence, dapp can't depend on AccountInfo.executable directly. Is that going to be an issue?

- CPI won't ignore changes made by caller to instruction accounts (Currently CPI
ignores changes made by the caller to instruction accounts which has the
`is_executable` flag set). For correctness, this change will be fine. It just
becomes a bit less efficient with more checks.
buffalojoec marked this conversation as resolved.
Show resolved Hide resolved

## Security Considerations

None

## Backwards Compatibility

Incompatible.
Loading