Skip to content

Commit

Permalink
Further clarifications after implementing integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Nov 19, 2024
1 parent 80d9562 commit 434071b
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions proposals/0167-loader-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ None.

## Detailed Design

`LoaderV411111111111111111111111111111111111` program management and execution
must be enabled with the associated feature gate, which simultaneously disables
new deployments on loader-v3 (`BPFLoaderUpgradeab1e11111111111111111111111`),
The associated feature gate must:

- add loader-v4 to the write lock demotion exceptions
- enable loader-v4 `LoaderV411111111111111111111111111111111111` program
management and execution
- simultaneously disable new deployments on loader-v3
(`BPFLoaderUpgradeab1e11111111111111111111111`),
throwing `InvalidIstructionData` if `DeployWithMaxDataLen` is called.

### Owned Program Accounts
Expand Down Expand Up @@ -86,19 +90,20 @@ otherwise throw `Immutable`

Invoking programs owned by loader-v4 checks in the following order that:

- the owner of the program account is loader-v4,
otherwise throw `UnsupportedProgramId`
- the program account is at least as long enough for the header,
otherwise throw `AccountDataTooSmall`
- the status stored in the program account is not retracted,
otherwise throw `UnsupportedProgramId`
- the program account was not deployed within the current slot
(delay visibility), otherwise throw `UnsupportedProgramId`
- the owner of the program account is loader-v4
- the program account is at least as long enough for the header
- the status stored in the program account is not retracted
- the program account was not deployed within the current slot (delay
visibility)
- the executable file stored in the program account passes executable
verification, otherwise throw `UnsupportedProgramId`
verification

failing any of the above checks must throw `UnsupportedProgramId`.

### Program Management Instructions

All program management instructions must cost 2000 CUs.

#### Write

- Instruction accounts:
Expand Down Expand Up @@ -187,8 +192,10 @@ verification, otherwise throw `UnsupportedProgramId`
otherwise throw `InvalidArgument`
- Check that the executable file stored in the source program account
passes executable verification
- The feature set that the executable file is verified against is not
necessarily the current one, but the one of the epoch of the next slot
- The feature set that the executable file is verified against is not
necessarily the current one, but the one of the epoch of the next slot
- Also, during deployment certain deprecated syscalls are disabled,
this stays the same as in the older loaders
- Copy the entire source program account into the program account
- Set the length of the source program account to zero
- Transfer all funds of the source program account to the program
Expand Down

0 comments on commit 434071b

Please sign in to comment.