Skip to content

test: skip the Zap4 and constituent-audit fork suites when not on a fork - #2

Open
hey-research-lab wants to merge 1 commit into
vimenprotocol:mainfrom
hey-research-lab:fix/fork-suites-skip-offline
Open

hey-research-lab wants to merge 1 commit into
vimenprotocol:mainfrom
hey-research-lab:fix/fork-suites-skip-offline

Conversation

@hey-research-lab

Copy link
Copy Markdown

Problem

contracts/README.md documents forge test as the local test command and says the fork suites self-skip when no fork is configured. On main (e36785c) a plain forge test in contracts/ fails:

Ran 22 test suites: 214 tests passed, 3 failed, 25 skipped (242 total tests)
[FAIL: EvmError: Revert] test_audit_allCandidates()                      (NewConstituentAuditFork)
[FAIL: NotAContract(0x3746a5ebCA295Dee695dd1bcba50A8626Df3099C)] setUp()  (VimenZap4Fork)
[FAIL: NotAContract(0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC)] setUp()  (VimenZap4RialtoFork)

These three suites are meant to run with --fork-url $RH_RPC (as their headers say) and construct a BasketToken over mainnet tokens or read mainnet pools in setUp. Without a fork those addresses have no code, so setUp reverts — unlike Fork.t.sol, VimenZap*.fork.t.sol and TwapOracle.fork.t.sol, which skip. (VimenZap4RialtoFork already has an onlyFork chain-id check on its tests, but its setUp fails before that check is reached.)

Fix

First line of each of the three setUps: vm.skip(block.chainid != 4663);. Off a fork the suites are reported as skipped; with --fork-url on Robinhood Chain they run exactly as before. Test-only change.

Validation

  • forge build && forge test (Foundry 1.5.1, no RPC): before 214 passed / 3 failed / 25 skipped; after 214 passed / 0 failed / 28 skipped.
  • forge test --match-contract "VimenZap4Fork|NewConstituentAuditFork" --fork-url https://rpc.mainnet.chain.robinhood.com: 5 passed (4 + 1), same as without the change.
  • forge test --match-contract VimenZap4RialtoFork --fork-url https://rpc.mainnet.chain.robinhood.com: 2 passed, same as without the change.

VimenZap4Fork, VimenZap4RialtoFork and NewConstituentAuditFork build
against mainnet contracts in setUp but, unlike the other fork suites, do
not skip when no fork is active, so a plain forge test fails with three
errors (NotAContract in two setUps, a revert in the audit).
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