Skip to content

fix(StdCheats): enable packed slots when dealing token balances#888

Open
Yonkoo11 wants to merge 1 commit into
foundry-rs:masterfrom
Yonkoo11:fix/deal-enable-packed-slots-293
Open

fix(StdCheats): enable packed slots when dealing token balances#888
Yonkoo11 wants to merge 1 commit into
foundry-rs:masterfrom
Yonkoo11:fix/deal-enable-packed-slots-293

Conversation

@Yonkoo11

Copy link
Copy Markdown

Summary

deal wrote balances through stdstore without packed mode. Tokens that store balance in a packed slot (e.g. post-upgrade USDC, Optimism sUSD) fail find or would clobber neighbor fields. Use enable_packed_slots() for balance writes in deal / dealERC1155 / dealERC721.

Linked issue

Fixes #293

Test plan

  • Existing test_Deal* suite passes
  • New test_DealTokenPackedBalance (balance in low 128 bits; high bits preserved)

AI assistance

Prepared with AI assistance; I reviewed and tested the change.

Risk

Packed mode is slightly more expensive on find. Unpacked ERC20s still work (covered by existing tests).

Tokens that pack balance into a shared storage word (USDC-class,
Optimism sUSD) fail stdstore find without packed mode. Use
enable_packed_slots() for ERC20/1155/721 balance writes so deal
updates only the balance bits and preserves neighboring data.

Fixes foundry-rs#293
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.

bug(StdCheats): deal fails on Optimism sUSD due to packed slot

1 participant