Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Open
Yonkoo11 wants to merge 2 commits into
foundry-rs:masterfoundry-rs/forge-std:masterfrom
Yonkoo11:fix/deal-enable-packed-slots-293Yonkoo11/forge-std:fix/deal-enable-packed-slots-293Copy head branch name to clipboard
Open

fix(StdCheats): enable packed slots when dealing token balances#888
Yonkoo11 wants to merge 2 commits into
foundry-rs:masterfoundry-rs/forge-std:masterfrom
Yonkoo11:fix/deal-enable-packed-slots-293Yonkoo11/forge-std:fix/deal-enable-packed-slots-293Copy head branch name to clipboard

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

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.