Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertEq in forge tests returns unknown selector 0x98296c54 for VmCalls #7402

Closed
2 tasks done
xsubject opened this issue Mar 14, 2024 · 14 comments
Closed
2 tasks done
Labels
T-bug Type: bug

Comments

@xsubject
Copy link

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (03f5a95 2024-01-17T16:58:19.312489000Z)

What command(s) is the bug in?

forge test

Operating System

macOS (Intel)

Describe the bug

test-forge » forge init
...
Resolving deltas: 100% (1461/1461), done.
    Installed forge-std v1.8.0
    Initialized forge project
test-forge (master) » forge test -vvv --evm-version shanghai                                                                                              
[⠢] Compiling...
[⠒] Compiling 27 files with 0.8.21
[⠘] Solc 0.8.21 finished in 4.46sCompiler run successful!
[⠃] Solc 0.8.21 finished in 4.46s

Running 2 tests for test/Counter.t.sol:CounterTest
[FAIL. Reason: unknown selector `0x98296c54` for VmCalls; counterexample: calldata=0x5c7f60d70000000000000000000000000000000000000000000000000000000000000000 args=[0]] testFuzz_SetNumber(uint256) (runs: 0, μ: 0, ~: 0)
Traces:
  [11336] CounterTest::testFuzz_SetNumber(0)
    ├─ [2387] Counter::setNumber(0)
    │   └─ ← ()
    ├─ [281] Counter::number() [staticcall]
    │   └─ ← 0
    ├─ [0] VM::assertEq(0, 0) [staticcall]
    │   └─ ← unknown selector `0x98296c54` for VmCalls
    └─ ← unknown selector `0x98296c54` for VmCalls

[FAIL. Reason: unknown selector `0x98296c54` for VmCalls] test_Increment() (gas: 31211)
Traces:
  [31211] CounterTest::test_Increment()
    ├─ [22337] Counter::increment()
    │   └─ ← ()
    ├─ [281] Counter::number() [staticcall]
    │   └─ ← 1
    ├─ [0] VM::assertEq(1, 1) [staticcall]
    │   └─ ← unknown selector `0x98296c54` for VmCalls
    └─ ← unknown selector `0x98296c54` for VmCalls

Test result: FAILED. 0 passed; 2 failed; 0 skipped; finished in 1.55ms
 
Ran 1 test suites: 0 tests passed, 2 failed, 0 skipped (2 total tests)

Failing tests:
Encountered 2 failing tests in test/Counter.t.sol:CounterTest
[FAIL. Reason: unknown selector `0x98296c54` for VmCalls; counterexample: calldata=0x5c7f60d70000000000000000000000000000000000000000000000000000000000000000 args=[0]] testFuzz_SetNumber(uint256) (runs: 0, μ: 0, ~: 0)
[FAIL. Reason: unknown selector `0x98296c54` for VmCalls] test_Increment() (gas: 31211)

Encountered a total of 2 failing tests, 0 tests succeeded

@xsubject xsubject added the T-bug Type: bug label Mar 14, 2024
@xsubject
Copy link
Author

but my old projects are working correctly

@xsubject
Copy link
Author

its works with forge-std (v1.7.6)

@klkvr
Copy link
Member

klkvr commented Mar 14, 2024

Please run foundryup, we've recently migrated to native assertions and your current foundry version does not include them.

@E-Zbox
Copy link

E-Zbox commented Mar 14, 2024

I'm facing the same issue when I run forge test.
After running foundryup and re-installing forge-std the error persists.

These are my specs:

Foundry Version
forge 0.2.0 (d4e6b43 2023-12-03T18:16:56.713331000Z)

Operating System
macOS (Intel)

@klkvr
Copy link
Member

klkvr commented Mar 14, 2024

@E-Zbox your forge version is from 3d December, latest nightly is forge 0.2.0 (545cd0b 2024-03-14T00:20:00.210934000Z)

@klkvr
Copy link
Member

klkvr commented Mar 14, 2024

via foundryup, what's the output of foundryup when invoked?

@E-Zbox
Copy link

E-Zbox commented Mar 14, 2024

@klkvr After running foundryup successfully, it logged removing chisel using rm ~/.cargo/bin/chisel or updating path with /Users/username/.foundry/bin

@maxsiz
Copy link

maxsiz commented Mar 16, 2024

Please run foundryup, we've recently migrated to native assertions and your current foundry version does not include them.

Same problem. That's works for me, thanks

@anindyasroy
Copy link

still facing this issue after upgrade

forge 0.2.0 (3e962e2 2023-11-20T00:24:11.858869000Z)

@E-Zbox
Copy link

E-Zbox commented Apr 10, 2024

When I faced this same issue, there was a prompt after running foundryup command listing some directories in your HOME_DIR to be removed. For the upgrade to work, you might have to remove ~/.cargo/bin/anvil, ~/.cargo/bin/forge, ~/.cargo/bin/cast

@miguelsophiaverse
Copy link

facing this problem has well, most recent version

@DaniPopes
Copy link
Member

still facing this issue after upgrade

forge 0.2.0 (3e962e2 2023-11-20T00:24:11.858869000Z)

@anindyasroy your upgrade was not successful, the latest version has the date of yesterday or today. You might have binaries taking precedence over the foundryup-installed ones, as @E-Zbox suggested.

facing this problem has well, most recent version

@miguelsophiaverse can you please provide version information and what error you're getting? Please also see if the solution above works for you too.

@Jouzep
Copy link

Jouzep commented Apr 17, 2024

Please run foundryup, we've recently migrated to native assertions and your current foundry version does not include them.

Solved my problems thanks

@joelsjoyt
Copy link

Please run foundryup, we've recently migrated to native assertions and your current foundry version does not include them.

This fixed my issue, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

9 participants