Commit 6151e75
authored
fix(token): bypass cache for payment-critical account reads (#418)
* fix(token): force fresh account reads in payment validation
Bypass Redis account cache for destination and mint lookups in
TokenUtil::find_payment_in_transaction to avoid stale account
state during payment authorization and pricing.
* fix(token2022): reject mutable transfer-hook authority in payments
Reject Token-2022 payment mints that carry a mutable TransferHook authority so post-sign hook updates cannot alter the execution surface Kora approved.
Apply the same guard for destination ATA-creation flows and extend mint test builders to configure TransferHook authority/program fields for coverage.
* fix(config): accept validation.token2022 alias
* fix(token): scope token2022 payment checks to payment candidates
Run Token-2022 extension and transfer-hook authority validation only after destination-owner matching in find_payment_in_transaction.
This avoids rejecting unrelated Token-2022 transfers that are not payment instructions while preserving the mutable transfer-hook guard for actual payment paths.
* fix(transaction): enforce signer-slot signature indexing
Restrict signer position lookup to the first num_required_signatures account keys so unsigned pubkey occurrences cannot be treated as signer slots.
Also switch both normal and bundle signing flows to checked signature-slot writes and return InvalidTransaction on slot mismatch instead of panicking.
Add coverage for rejecting unsigned fee payer occurrences in bundle signing tests.
* fix(validator): enforce disallowed accounts in instruction data
Extend parsed system and SPL/Token-2022 instruction data to retain destination authority/owner pubkeys carried in instruction bytes (e.g. AuthorizeNonceAccount new_authority, SetAuthority new_authority, InitializeMint freeze_authority).
Add a dedicated disallowed-instruction-data validation pass and run it during transaction validation so blacklisted pubkeys in instruction data are rejected the same way as account metas/program IDs.
Includes new validator tests for nonce authorize, SPL/Token-2022 set_authority, initialize_account2 owner, and initialize_mint2 freeze_authority bypass paths.
* fix(token): net token2022 inflows by transfer fee
Adjust SPL transfer value accounting so Token-2022 inflows to fee-payer-owned
accounts are credited at post-fee amounts, while outflows remain gross.
This closes the transfer-fee over-credit path where fee payer outflow was
underestimated against max_allowed_lamports.
* fix(validator): block confidential token2022 and parse reallocate
Reject confidential Token-2022 extension instruction families by default and
add explicit Token-2022 Reallocate parsing.
Also reject fee-payer-involved Token-2022 Reallocate usage in transaction
validation to close fee-payer policy bypass paths.
---------
Co-authored-by: Jo D <dev-jodee@users.noreply.github.com>1 parent 887a857 commit 6151e75
File tree
13 files changed
+969
-91
lines changed- crates/lib/src
- signer
- tests
- token
- transaction
- validator
- examples
- getting-started/demo/server
- jito-bundles/server
- x402/demo/kora
13 files changed
+969
-91
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
834 | 834 | | |
835 | 835 | | |
836 | 836 | | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
837 | 873 | | |
838 | 874 | | |
839 | 875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
215 | 222 | | |
216 | 223 | | |
217 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
| |||
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
94 | 115 | | |
95 | 116 | | |
96 | 117 | | |
| |||
143 | 164 | | |
144 | 165 | | |
145 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
146 | 192 | | |
147 | 193 | | |
148 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
| |||
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
| 331 | + | |
| 332 | + | |
329 | 333 | | |
330 | 334 | | |
331 | 335 | | |
| |||
365 | 369 | | |
366 | 370 | | |
367 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
368 | 382 | | |
369 | 383 | | |
370 | 384 | | |
| |||
472 | 486 | | |
473 | 487 | | |
474 | 488 | | |
475 | | - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
476 | 495 | | |
477 | 496 | | |
478 | 497 | | |
| |||
0 commit comments