Skip to content

Switch from ganachr to foundry-anvil for v4 tests#453

Merged
liquid-8 merged 10 commits into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC
May 12, 2026
Merged

Switch from ganachr to foundry-anvil for v4 tests#453
liquid-8 merged 10 commits into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC

Conversation

@liquid-8
Copy link
Copy Markdown
Member

No description provided.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 12, 2026

Greptile Summary

This PR migrates the Uniswap v4 test infrastructure from Ganache to Foundry Anvil and wires it into CI as a dedicated matrix slot. pytestmark guards are added to test_uniswap.py, test_uniswap4.py, and test_cli.py so each test file only executes under the correct UNISWAP_VERSION.

  • CI workflow: uniswap-version: 4 is added to the matrix; the previous wget | bash Foundry install is replaced with the official foundry-rs/foundry-toolchain@v1 action; the arbitrum matrix include is commented out.
  • Anvil fixture (test_uniswap4.py): GanacheInstance/ganache() replaced with AnvilInstance/anvil() using correct Anvil CLI flags; default account index 9 address and private key used; port changed to 10998 to avoid conflict with the Ganache fixture.
  • Test isolation: pytestmark skip conditions ensure v1/v2/v3 tests are skipped on the v4 job and vice versa, with CLI tests also skipped under v4.

Confidence Score: 5/5

The migration is self-contained and the test isolation guards are logically sound; safe to merge.

All functional changes — the Anvil fixture, the pytestmark guards, and the foundry-toolchain action — are correct. The stale account-index comment and unconditional ganache/foundry installs are cleanup items that do not affect test correctness or CI reliability.

No files require special attention; minor issues are confined to a comment in tests/test_uniswap4.py and the install steps in .github/workflows/test.yml.

Important Files Changed

Filename Overview
.github/workflows/test.yml Adds v4 to the matrix, replaces wget
tests/test_uniswap4.py Migrates fixture from Ganache to Anvil, adds pytestmark skip guard, renames class and dataclass; stale comment on line 107 misidentifies the account index
tests/test_uniswap.py Adds pytestmark to skip v1/v2/v3 tests when UNISWAP_VERSION=4; minor code formatting changes throughout
tests/test_cli.py Adds pytestmark to skip CLI tests when UNISWAP_VERSION=4, since CLI is not supported in v4

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Matrix["CI Matrix\nuniswap-version: 1 | 2 | 3 | 4"] --> Job["test job"]
    Job --> InstallDeps["Install dependencies\npoetry install + ganache\n(all versions)"]
    Job --> InstallFoundry["Install Foundry toolchain\n(all versions)"]
    InstallDeps --> TestStep["Test Step: make test"]
    InstallFoundry --> TestStep
    TestStep --> CheckVersion{UNISWAP_VERSION}
    CheckVersion -- "1, 2, or 3" --> SkipV4["Skip test_uniswap4.py"]
    CheckVersion -- "4" --> SkipV123["Skip test_uniswap.py + test_cli.py"]
    SkipV4 --> GanacheFixture["Ganache fixture port 10999"]
    SkipV123 --> AnvilFixture["Anvil fixture port 10998 fork mainnet"]
    GanacheFixture --> V123Tests["TestUniswap v1/v2/v3"]
    AnvilFixture --> V4Tests["TestUniswap4 v4"]
Loading

Reviews (8): Last reviewed commit: "fix" | Re-trigger Greptile

Comment thread .github/workflows/test.yml Outdated
Comment thread tests/test_uniswap4.py
Comment thread tests/test_uniswap4.py
Comment thread .github/workflows/test.yml Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.98%. Comparing base (7b92231) to head (dcdae41).
⚠️ Report is 21 commits behind head on dev/v4-fin.

Additional details and impacted files
@@               Coverage Diff               @@
##           dev/v4-fin     #453       +/-   ##
===============================================
+ Coverage       34.40%   52.98%   +18.57%     
===============================================
  Files              12       12               
  Lines            2241     2229       -12     
===============================================
+ Hits              771     1181      +410     
+ Misses           1470     1048      -422     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@liquid-8 liquid-8 merged commit 6dee9fd into uniswap-python:dev/v4-fin May 12, 2026
5 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.

1 participant