Repository navigation
tlv-account-resolution: reduce SBF PDA derivation cost - #212
beriktassuly wants to merge 2 commits into
Conversation
joncinque
left a comment
There was a problem hiding this comment.
We have the functions to do this more cheaply with Address::derive_program_address https://github.com/anza-xyz/solana-sdk/blob/8f48de5ed28208239775a90eba77f6fd5a95885c/address/src/derive.rs#L169
Let's use that instead of inlining all of the logic here
Switched to It needs Measured with
The extra 296 CU over the inline version most likely comes from the padding: |
Problem
Resolving PDA metas on SBF costs 1,500 CU per bump attempt via
try_find_program_address.Summary of changes
Resolve PDA metas with
Address::derive_program_address(solana-address 2.3.0) instead offind_program_address. Seed lists outside the valid range still go throughfind_program_address.In token-2022's
success_transfertest (two PDA metas), the Token-2022 transfer drops from 22,080 to 20,296 CU (−8.1%).