Skip to content

Refactor storage into four per-phase structs to fix Yul stack-too-deep - #10

Merged
woolgathering merged 2 commits into
no-v4from
claude/review-uniswap-v4-integration-Y0avJ
May 21, 2026
Merged

Refactor storage into four per-phase structs to fix Yul stack-too-deep#10
woolgathering merged 2 commits into
no-v4from
claude/review-uniswap-v4-integration-Y0avJ

Conversation

@woolgathering

Copy link
Copy Markdown
Owner

Summary

  • Replace all per-auction flat mappings in CPAStorage with four scoped per-phase storage structs: ClockPhaseState, ProxyPhaseState, AllocationPhaseState, SettlementPhaseState
  • Each library function now receives only the struct(s) it needs, reducing simultaneous live stack variables below the Yul 16-slot limit — fixing the CPAClock6Decimals.t.sol stack-too-deep compilation error
  • Add explicit auctionId validation in CPAProxyPhase._isValidBundle (fixes regression in test_SubmitBundle_WrongAuctionIdInBundle)
  • Add NumeraireLib for native ETH support in all numeraire transfers
  • Remove Uniswap V4 hook, callback facets, and V4-only scripts/tests

Test plan

  • forge build compiles cleanly with no errors
  • forge test — 136/138 tests pass (1 pre-existing failure: test_RevertUndersoldPrices logic issue predating this PR)
  • All CPAClock6Decimals tests pass (was the failing suite)
  • test_SubmitBundle_WrongAuctionIdInBundle passes

https://claude.ai/code/session_01ETwaVj9w3YcML7GDGavvjU


Generated by Claude Code

claude added 2 commits May 21, 2026 06:14
Replace per-auction flat mappings with four scoped storage structs:
ClockPhaseState, ProxyPhaseState, AllocationPhaseState, SettlementPhaseState.
Each library function now receives only the struct(s) it needs, reducing
simultaneous live stack variables below the Yul 16-slot limit.

Also fixes test_SubmitBundle_WrongAuctionIdInBundle regression by adding
explicit auctionId validation in CPAProxyPhase._isValidBundle.

https://claude.ai/code/session_01ETwaVj9w3YcML7GDGavvjU
…tics

The test was ported from V4 (which tracked lastOversoldTick) to non-V4
without correctly adapting the price-reversion assertion. When the clock
phase ends with an undersold asset, revertUndersoldPrices() sets its price
back to lastOversoldPrice (the price before the round that caused oversell),
not the incremented price. Update the assertion and comments accordingly.

https://claude.ai/code/session_01ETwaVj9w3YcML7GDGavvjU
@woolgathering
woolgathering marked this pull request as ready for review May 21, 2026 20:08
@woolgathering
woolgathering merged commit 3f08e69 into no-v4 May 21, 2026
@woolgathering
woolgathering deleted the claude/review-uniswap-v4-integration-Y0avJ branch May 21, 2026 20:08
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