coinspect/learn-evm-attacks

Error when running `forge test`

mikerudenko opened this issue · 3 comments

When I am running this command
forge test --match-contract Exploit_MBCToken -vvv

I am getting this error:
2023-03-24T08:42:22.475520Z ERROR sharedbackend: Failed to send/recv basicerr=GetAccount(0x55d398326f99059ff775485246999027b3197955, (code: -32002, message: the resource eth_getBalance is not available., data: None)) address=0x55d398326f99059ff775485246999027b3197955 2023-03-24T08:42:22.601997Z ERROR sharedbackend: Failed to send/recvbasicerr=GetAccount(0x9f8ccdafcc39f3c7d6ebf637c9151673cbc36b88, (code: -32002, message: the resource eth_getTransactionCount is not available., data: None)) address=0x9f8ccdafcc39f3c7d6ebf637c9151673cbc36b88 The application panicked (crashed). Message: calledOption::unwrap()on aNone value

Does anybody faced this issue before?

Same error here!

Hi. Thanks for the report. Seems like the issue is affecting some test and not others.

➜ learn-evm-attacks (master) ✗ forge test --match-contract Exploit_CreamFinance
[⠰] Compiling...
No files changed, compilation skipped

Running 1 test for test/Reentrancy/CreamFinance/CreamFinance.attack.sol:Exploit_CreamFinance
[PASS] test_attack() (gas: 3282492)
Test result: ok. 1 passed; 0 failed; finished in 35.17s

I can consistently reproduce with MBCToken. We believe it has to do with the JSON-RPC behaving inconsistently, please try to modify foundry.toml and set:

bsc = "https://rpc.ankr.com/bsc"

instead of the default.

I'm closing this unless we can confirm the issue is not with the JSON-RPCs.