Skip to content

SIMD-0162: Remove Accounts is_executable Flag Checks#162

Merged
joncinque merged 2 commits into
solana-foundation:mainfrom
Lichtso:remove-accounts-executable-flag-checks
Nov 25, 2024
Merged

SIMD-0162: Remove Accounts is_executable Flag Checks#162
joncinque merged 2 commits into
solana-foundation:mainfrom
Lichtso:remove-accounts-executable-flag-checks

Conversation

@Lichtso
Copy link
Copy Markdown
Contributor

@Lichtso Lichtso commented Jul 31, 2024

No description provided.


Error codes of these conditions, which are rarely triggered, will change.

The only consensus relevant change is that it will become possible (for
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this change open doors for user to withdraw funds from program accounts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, it seems that this change will open doors for modifying data on executable account, and reset executable flag itself on executable account. Are there any concerns about this for consensus? Should we document the impact of these changes in the SIMD?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Users will remain unable to: Withdraw funds from program accounts, reset the is_executable flag, or change the data directly without going through the loaders program managements instructions. That is because for that you need to be the owner, but programs are owned by a loader. Thus, the loader decides what happens to program accounts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah. Make sense.

Copy link
Copy Markdown
Contributor

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Looks good. I'm just curious how buffer accounts will be handled going forward. I'm assuming that it will simply be the header of the account data UpgradeableLoaderState::Buffer, but maybe mentioning how loaders v3 and v4 distinguish between buffer accounts and programs might be useful, even if unchanged, with this flag removed.

flag can be addressed in a subsequent proposal. Thus, the following must remain
unaffected for now:

- Setting of the `is_executable` flag during program deployment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we specify that this is for both loaders - v3 and v4?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Loader-v4 will get its own SIMD explaining it in full detail.

Comment thread proposals/0162-remove-accounts-executable-flag-checks.md Outdated
Comment thread proposals/0162-remove-accounts-executable-flag-checks.md
Copy link
Copy Markdown
Contributor

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Nice, looks good!

Copy link
Copy Markdown
Contributor

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

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

I like it. Lgtm!

With this SIMD, it will help us to move one step closer to SIMD-0094, i.e. we no longer need to worry about "simulating" executable flag for accounts updates during the runtime execution.

Copy link
Copy Markdown
Contributor

@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.

It's great to simplify things here!

A bit concerned that it's easy to make mistakes here and unintentionally introduce consensus violations, so there will need to be very thorough testing around the failure cases. We have a lot of tooling which can help here.

@joncinque
Copy link
Copy Markdown
Contributor

It looks like there's consensus here. If no one objects within the next week, I'll merge this on 25 November.

Copy link
Copy Markdown
Contributor

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Just a nit as I'm re-reviewing some of these SIMDs. This proposal leans into the second and third constraints for identifying verified on-chain programs:

  • Is owned by a loader
  • Contains a successfully verified ELF, contains the address of a program data
    account which does or is a built-in program

However, it doesn't mention how the third constraint is actually verified. If we're going to make the rule: "only programs owned by any of the four loaders can be considered verified ELFs, and each loader imposes its own standard for querying that verification status", then this proposal should state that more explicitly.

@Lichtso Lichtso deleted the remove-accounts-executable-flag-checks branch June 18, 2025 09:55
Comment on lines +69 to +70
- CPI ignores changes made by the caller to instruction accounts which have
the `is_executable` flag set
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm confused why this was left in because by allowing executable accounts to be written, it becomes important that any changes to executable accounts are handled properly.

Without this change, not only does CPI ignore changes made my the caller, it also ignores changes made by the callee. In the latter case, when the caller returns, the runtime will fail the transaction because it will think that the caller tried to revert the callee changes.

Also imagine if during a CPI, both the caller and callee program sent a lamport to an executable account from a non executable writable account. The caller sends the lamport first, then when the callee is cpi'd it hasn't seen the lamport change so when it sends a lamport, the balance is updated to the value that was already updated to by the caller. When the caller returns, the executable account has only received 1 lamport but the sender non executable account has sent two lamports. This leads to a surprising lamport imbalance error.

Copy link
Copy Markdown
Contributor Author

@Lichtso Lichtso Jul 4, 2025

Choose a reason for hiding this comment

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

Sorry for the ambiguous formulation. What is meant is not that is_executable flag can be set (you can not change the is_executable flag inside the VM anyway), instead it means that CPI behavior was dependent on the state of the is_executable for instruction accounts, and we do not change any of that in this SIMD ("the following must remain unaffected for now").

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We had to leave it in because direct mapping would break otherwise. We can only remove it after activating and cleaning up the feature gate of direct mapping.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry for the ambiguous formulation. What is meant is not that is_executable flag can be set (you can not change the is_executable flag inside the VM anyway)

I think the SIMD was clear. I wasn't thinking you meant that the is_executable flag can be set. I meant that other fields in executable accounts can be modified now but this CPI behavior would cause surprising errors when executable accounts are modified in otherwise valid ways (e.g. adding lamports as you noted in the impact section)

We had to leave it in because direct mapping would break otherwise. We can only remove it after activating and cleaning up the feature gate of direct mapping.

Surely there was some way to make it work before direct mapping is enabled without breaking direct mapping? Especially if we can remove after direct mapping is activated?

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants