Skip to content

feat: add L2 revm swap integration test and update pool data contracts#14

Merged
Will-Smith11 merged 18 commits intomainfrom
integration-tests
Mar 6, 2026
Merged

feat: add L2 revm swap integration test and update pool data contracts#14
Will-Smith11 merged 18 commits intomainfrom
integration-tests

Conversation

@Will-Smith11
Copy link
Copy Markdown
Contributor

  • Add SwapQuoter test contract and L2 revm swap test
  • Update GetUniswapV4PoolData contract with minor fixes
  • Add alloy-node-bindings dependency for testing
  • Fix update provider imports for L2 and pool providers

Will-Smith11 and others added 18 commits March 5, 2026 20:57
- Add SwapQuoter test contract and L2 revm swap test
- Update GetUniswapV4PoolData contract with minor fixes
- Add alloy-node-bindings dependency for testing
- Fix update provider imports for L2 and pool providers

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…ogic

- Fix TAXED_GAS constant (100k → 120k) to match AngstromL2.sol
- Fix test PoolKey fee: use actual registry fee instead of hardcoded 0x800000
- Restructure fee application: deduct fees from input before AMM via
  BeforeSwapDelta model instead of applying after AMM on output
- Expose pool registry from PoolManagerService

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
The L2 hook's `_getSwapTaxAmount()` computes `tx.gasprice - block.basefee`
using uint256 arithmetic. Without setting gas_price, eth_call defaults to 0,
causing an underflow revert that the quoter misparses as garbage amounts.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…s it

L2FeeConfiguration::swap_fee() returned 0, but on-chain V4 charges the
pool's static LP fee from PoolKey.fee. Added lp_fee field and wired
hook_fee through both pool creation paths.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…_ticks

The Solidity contract scans bitmap positions (each tick_spacing apart),
so advancing by num_ticks raw tick units caused ~88% overlap between
batches and insufficient tick coverage for large swaps.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…expected

Swaps that exceed the loaded tick window now gracefully continue instead
of panicking, since the finite tick range is a known constraint.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…mination

L2 BeforeSwapDelta (protocol fee + MEV tax before AMM) was running for
L1 pools too. Gate it behind FeeConfig::l2_fees() and add the missing
L1 after-swap protocol fee on the output token.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…hain over 100 blocks

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
Set _lastBlockUpdated in slot 3 to current block number before each
SwapQuoter call so beforeSwap doesn't revert with CannotSwapWhileLocked.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
Set _lastBlockUpdated to current_block instead of current_block + 1 so
_isUnlocked() returns true during eth_call which uses block.number = latest.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…limiting

Shrink tick range from 6000 to 400 and load in a single batch per direction,
cutting RPC calls from ~1200 to 2 per pool and preventing 429 errors.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
The deploy-based tick loader exceeds contract size limit at 400 ticks per
batch. 100 keeps batches within EVM limits while still minimizing RPC calls.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…on non-QuoteResult reverts

The quoter catch clause now checks for the QuoteResult selector and minimum
data length before decoding. Non-QuoteResult reverts (e.g. HookDeltaExceedsSwapAmount,
WrappedError) now surface as UnexpectedRevert instead of returning uninitialized memory.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
…ully

Lower priority_fee from 1 gwei to 10M wei (~2x basefee) to avoid MEV tax
exceeding swap output on small amounts, and skip on-chain reverts instead
of panicking when the hook correctly rejects economically nonsensical swaps.

Co-Authored-By: Frankenstein <263438330+frankenstien-dev@users.noreply.github.com>
@Will-Smith11 Will-Smith11 merged commit a1fcc75 into main Mar 6, 2026
5 checks passed
@Will-Smith11 Will-Smith11 deleted the integration-tests branch March 6, 2026 20:04
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.

1 participant