Skip to content

perf(erc20spl-cached): collapse ATA-existence gate to one SplCached.account(address,mint) read#240

Merged
anil-rome merged 2 commits into
masterfrom
b-wrapper-account-mint
Jun 15, 2026
Merged

perf(erc20spl-cached): collapse ATA-existence gate to one SplCached.account(address,mint) read#240
anil-rome merged 2 commits into
masterfrom
b-wrapper-account-mint

Conversation

@anil-rome

Copy link
Copy Markdown
Contributor

What

balanceOf, allowance, approve, and _transfer derived the target ATA via the legacy HelperProgram.ata(x, mint_id) (0xff..09) then read it via SplCached.account(ata) — two EVM→precompile round-trips per gate. They now make a single SplCached.account(x, mint_id) call; the precompile derives external_auth(owner) → ATA(mint) internally.

  • interface.sol: adds ISplCached.account(address owner, bytes32 mint) (0xf9827227), mirroring account(address) with an explicit mint.
  • examples/cached.sol: worked example spl_account_mint.
  • Behaviour unchanged — same overlay-aware existence check, same auto-create on the catch branch.

Requires the paired upstream Rome EVM SplCached.account(address,bytes32) read selector.

Verify

npx hardhat compile — clean (86 files, solc 0.8.28).

Pending before merge

Per-op CU A/B and derivation parity (account(address,mint) == HelperProgram.ata) on a rebuilt wrapper (Phase 0).

…ccount(address,mint) read

balanceOf/allowance/approve/_transfer derived the target ATA via legacy
HelperProgram.ata then read it via SplCached.account(ata) — two EVM->precompile
round-trips per gate. The new ISplCached.account(address,bytes32) overload derives
external_auth(owner)->ATA internally, so each gate is a single read. Behaviour
unchanged. Requires the paired upstream Rome EVM SplCached read selector.
…r -> user

Parity with the existing account(address user) overload.
@anil-rome anil-rome merged commit 987010a into master Jun 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants