-
Notifications
You must be signed in to change notification settings - Fork 177
SIMD-0186: Clarify program/loader validation #311
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,35 @@ Account size for programs owned by LoaderV4 is left undefined. This SIMD should | |
be amended to define the required semantics before LoaderV4 is enabled on any | ||
network. | ||
|
||
### Sidebar: Program ID and Loader Validation | ||
|
||
After all accounts are loaded, if the transaction's size comes at or under its | ||
loaded accounts data size limit, the program IDs of each instruction, along with | ||
their program owners, are validated. This process is unrelated to the rest of | ||
this SIMD, but is not defined elsewhere, so we define it here. | ||
|
||
The process is as follows; for each instruction's program ID: | ||
|
||
* Verify the account exists. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add the expected error for this check? ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* If [SIMD-0162]( | ||
https://github.com/solana-foundation/solana-improvement-documents/pull/162) | ||
has not been activated, verify the program account is marked executable. When | ||
SIMD-0162 is active, skip this step. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: SIMD-0162 is activated on all clusters so we can remove this now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* Verify the program account's owner is one of: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, can you add the expected error if this check fails? ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* `NativeLoader1111111111111111111111111111111` | ||
* `BPFLoader1111111111111111111111111111111111` | ||
* `BPFLoader2111111111111111111111111111111111` | ||
* `BPFLoaderUpgradeab1e11111111111111111111111` | ||
* `LoaderV411111111111111111111111111111111111` | ||
|
||
If any of these conditions are violated, loading is aborted and the transaction | ||
pays fees. | ||
|
||
Previously, these checks were skipped if the program ID was | ||
`NativeLoader1111111111111111111111111111111` itself. This special case has been | ||
removed, and `NativeLoader1111111111111111111111111111111` behaves like any | ||
other account. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should also say that previously the program id's owner was validated by checking if it was equal to the native loader or, if not, was loaded and validated by checking that it was executable and that the owner's owner == native loader. |
||
## Alternatives Considered | ||
|
||
* Transaction data size accounting is already enabled, so the null option is to | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fair to say that it is related to this SIMD because now that we don't need to load the owner account to track its size, we are able to make this simplification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill reword it, im trying to adhere to the philosophy that the simd document is primary and the solana validators are concrete implementations of the simd. its unrelated in the sense that this simd is exclusively about how sizes are determined so the validation is sort of a tangent