perf(erc20spl-cached): gate recipient-ATA create in _transfer (~17K CU)#238
Merged
Conversation
…A exists Gates ensure_token_account(to) behind an overlay-aware try SplCached.account check (same pattern as approve), skipping the redundant idempotent create_ata round-trip on transfer-to-existing. ~17,387 CU saved per transfer (~6%); fresh-recipient auto-create preserved via the catch branch. Scoped to _transfer. Composition verified against the M0 balance-delta pattern; real-V3 mint/swap smoke is the pre-merge gate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ensure_token_account(to)in_transferbehind an overlay-awaretry SplCached.accountexistence check (same pattern asapprovefix(erc20spl-cached): ERC-20 spec compliance on uninitialized ATA (FB-2b/d/e) #216/fix(erc20spl-cached): overlay-aware balanceOf for V3 Pool.mint #217), skipping the redundant idempotentAssociatedSplCached.create_ataround-trip when the recipient ATA already exists._transfer;mint_tohas the same redundancy, left for a follow-up.Measured saving
ungated212,458 →gated195,071).Composition safety
try SplCached.accountread — NOT the legacy on-chainlamportsOfprobe whose staleness broke V3Pool.mint(M0) in the fix(erc20spl-cached): ERC-20 spec compliance on uninitialized ATA (FB-2b/d/e) #216→fix(erc20spl-cached): overlay-aware balanceOf for V3 Pool.mint #217 arc.transfer(sender) andtransferFrom(delegate) paths.eth_calland passed 4/4 (gated/ungated × existing/fresh ATA).Test plan
mint+swapsmoke on the deployed gated wrapper, during the factory/wrapper redeploy (fix(erc20spl-cached): overlay-aware balanceOf for V3 Pool.mint #217→ops(erc20spl): deploy ERC20SPLFactory to hadrian #218 rollout pattern)npx hardhat testerc20spl suite on a live devnet chain