@@ -53,10 +53,15 @@ additional instructions to the program:
53531 . [ ` withdraw_excess_lamports ` ] ( https://github.com/solana-program/token/blob/main/p-token/src/processor/withdraw_excess_lamports.rs )
5454 (instruction discriminator ` 38 ` ): allow recovering "bricked" SOL from mint
5555 (e.g., USDC mint as ` ~323 ` SOL in excess) and multisig accounts. The logic of
56- this instruction is the same as the current SPL Token-2022 instruction. There
57- could be economic consequences depending on the amount of "unbricked" SOL
58- &mdash ; the total amount of SOL that could be freed up this way has not been
59- calculated.
56+ this instruction is similar to the current SPL Token-2022 instruction: the mint
57+ authority must be a signer (for mint accounts) or the multisig (for multisig
58+ accounts) to authorize the withdraw. Additionally, for mint accounts that do
59+ not have a mint authority set, it is possible to authorize the withdraw using
60+ the mint account as the signing authority &mdash ; the instruction will need to
61+ be signed using the mint private key. Note that economic consequences may occur
62+ depending on the quantity of "unbricked" SOL; the total amount of SOL that could
63+ be freed up in this manner has yet to be calculated.
64+
60652 . [ ` batch ` ] ( https://github.com/solana-program/token/blob/main/p-token/src/processor/batch.rs )
6166 (instruction discriminator ` 255 ` ): enable efficient CPI interaction with the
6267 Token program. This is a new instruction that can execute a variable number on
@@ -104,6 +109,16 @@ Logging the instruction name consumes around `103` compute units, which in some
104109cases reprensents almost the same amount required to execute the instruction,
105110although removing the logs can be too disruptive to anyone relying on them.
106111
112+ Sample CU consumption for ` p-token ` without logs:
113+ | Instruction | ` p-token ` * - logs* (CU) | ` p-token ` (CU) |
114+ | ----------------------| -----------------------| ----------------------|
115+ | ` InitializeMint ` | 118 | 221 |
116+ | ` InitializeAccount ` | 170 | 273 |
117+ | ` Transfer ` | 146 | 249 |
118+ | ` MintTo ` | 144 | 247 |
119+ | ` Burn ` | 202 | 316 |
120+ | ` CloseAccount ` | 152 | 255 |
121+
107122## Impact
108123
109124The main impact is freeing up block CUs, allowing more transactions to be packed
@@ -115,31 +130,43 @@ current SPL Token program. In bracket is the percentage of CUs used in relation
115130to the current SPL Token consumption &mdash ; the lower the percentage, the
116131better the gains in CUs consumption.
117132
118- | Instruction | CU ( ` p-token ` ) | CU ( ` p-token ` ) + logging | CU ( ` spl-token ` ) |
119- | -------------| ---------------- | -------------------------- | -----------------|
120- | ` InitializeMint ` | 118 (4 %) | 221 (7%) | 2967 |
121- | ` InitializeAccount ` | 170 (4 %) | 273 (6%) | 4527 |
122- | ` InitializeMultisig ` | 239 (8 %) | 348 (12%) | 2973 |
123- | ` Transfer ` | 146 (3 %) | 249 (5%) | 4645 |
124- | ` Approve ` | 150 (5 %) | 268 (9%) | 2904 |
125- | ` Revoke ` | 124 (5 %) | 237 (9%) | 2677 |
126- | ` SetAuthority ` | 159 (5 %) | 261 (8%) | 3167 |
127- | ` MintTo ` | 144 (3 %) | 247 (5%) | 4538 |
128- | ` Burn ` | 202 (4 %) | 316 (7%) | 4753 |
129- | ` CloseAccount ` | 152 (5 %) | 255 (9%) | 2916 |
130- | ` FreezeAccount ` | 170 (4 %) | 287 (7%) | 4265 |
131- | ` ThawAccount ` | 169 (4 %) | 283 (7%) | 4267 |
133+ | Instruction | ` p-token ` (CU) | ` spl-token ` (CU ) |
134+ | ----------------------| ----------------| - -----------------|
135+ | ` InitializeMint ` | 221 (7 %) | 2967 |
136+ | ` InitializeAccount ` | 273 (6 %) | 4527 |
137+ | ` InitializeMultisig ` | 348 (12 %) | 2973 |
138+ | ` Transfer ` | 249 (5 %) | 4645 |
139+ | ` Approve ` | 268 (9 %) | 2904 |
140+ | ` Revoke ` | 237 (9 %) | 2677 |
141+ | ` SetAuthority ` | 261 (8 %) | 3167 |
142+ | ` MintTo ` | 247 (5 %) | 4538 |
143+ | ` Burn ` | 316 (7 %) | 4753 |
144+ | ` CloseAccount ` | 255 (9 %) | 2916 |
145+ | ` FreezeAccount ` | 287 (7 %) | 4265 |
146+ | ` ThawAccount ` | 283 (7 %) | 4267 |
132147
133148## Security Considerations
134149
135150` p-token ` must be guaranteed to follow the same instructions and accounts
136151layout, as well as have the same behaviour than the current Token
137152implementation.
138153
139- Any potential risk will be mitigated by extensive fixture testing (_ status_ :
140- [ completed] ( https://github.com/solana-program/token/blob/main/.github/workflows/main.yml#L284-L313 ) ),
141- formal verification (_ status_ : started) and audits (_ status_ : scheduled). Since
142- there are potentially huge economic consequences of this change, the feature
154+ Any potential risk will be mitigated by extensive testing and auditing:
155+
156+ - ✅ ** [ COMPLETED] ** Existing SPL Token test [ fixtures] ( https://github.com/solana-program/token/blob/main/.github/workflows/main.yml#L284-L313 )
157+
158+ - ✅ ** [ COMPLETED] ** Fuzzing using Firedancer tooling
159+ ([ solfuzz_agave] ( https://github.com/firedancer-io/solfuzz-agave ) ): this
160+ includes executing past mainnet instructions &mdash ; with or without random
161+ modifications amounting to millions of individual instructions &mdash ; and
162+ verifying that the complete program output (i.e., both the program result
163+ and accounts' state) matches.
164+
165+ - ⏳ * [ IN PROGRESS] * Formal Verification
166+
167+ - ⏳ * [ IN PROGRESS] * Audits
168+
169+ Since there are potentially huge economic consequences of this change, the feature
143170will be put to a validator vote.
144171
145172The replacement of the program requires breaking consensus on a non-native
0 commit comments