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

bug(cast run): local execution of transaction on BSC fails even though transaction originally succeeded on-chain #2997

Closed
2 tasks done
wp-lai opened this issue Aug 29, 2022 · 6 comments
Assignees
Labels
C-cast Command: cast T-bug Type: bug
Milestone

Comments

@wp-lai
Copy link
Contributor

wp-lai commented Aug 29, 2022

Component

Cast

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (307576d 2022-08-29T00:05:05.72678Z)

What command(s) is the bug in?

cast run

Operating System

No response

Describe the bug

Regarding this tx in bsc chain,

command

cast run 0xaa081672f7ad60e49000cb3520df1dce395d55d59ea31918adca41408f7fe28f --rpc-url https://rpc.ankr.com/bsc

produced an unexpected result

Executing previous transactions from the block.
Traces:
  [0] 0x0000…0000::fallback()
    └─ ← ()


Transaction failed.
Gas used: 0

while both cast tx 0xaa081672f7ad60e49000cb3520df1dce395d55d59ea31918adca41408f7fe28f --rpc-url https://rpc.ankr.com/bsc and cast receipt 0xaa081672f7ad60e49000cb3520df1dce395d55d59ea31918adca41408f7fe28f --rpc-url https://rpc.ankr.com/bsc produced expected result.

@wp-lai wp-lai added the T-bug Type: bug label Aug 29, 2022
@gakonst gakonst added this to Foundry Aug 29, 2022
@gakonst gakonst moved this to Todo in Foundry Aug 29, 2022
@rkrasiuk rkrasiuk added the C-cast Command: cast label Aug 29, 2022
@minaminao
Copy link
Contributor

In my environment, a more detailed trace is shown, but it is weird because the transaction is successful but shows OutOfGas. The RPC used is Quicknode.

$ cast run 0xaa081672f7ad60e49000cb3520df1dce395d55d59ea31918adca41408f7fe28f
Executing previous transactions from the block.
Traces:
  [28142] BEP20USDT::transfer(0x085747a5b761ab8682be10f2597674e8aa688c66, 22000000000000000000) 
    └─ ← "EvmError: OutOfGas"


Transaction failed.
Gas used: 51115

@mattsse mattsse self-assigned this Sep 9, 2022
@zerosnacks
Copy link
Member

In my environment, a more detailed trace is shown, but it is weird because the transaction is successful but shows OutOfGas. The RPC used is Quicknode.

$ cast run 0xaa081672f7ad60e49000cb3520df1dce395d55d59ea31918adca41408f7fe28f
Executing previous transactions from the block.
Traces:
  [28142] BEP20USDT::transfer(0x085747a5b761ab8682be10f2597674e8aa688c66, 22000000000000000000) 
    └─ ← "EvmError: OutOfGas"


Transaction failed.
Gas used: 51115

able to reproduce this result

https://bscscan.com/tx/0xaa081672f7ad60e49000cb3520df1dce395d55d59ea31918adca41408f7fe28f indeed shows the transaction was succesful

requires further investigation

@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@zerosnacks zerosnacks changed the title cast run failed when executing a tx from bsc chain bug(cast run): local execution of transaction on BSC fails even though transaction originally succeeded on-chain Aug 2, 2024
@zerosnacks
Copy link
Member

As a sanity check, was able to run a random recent transaction on BSC cast run 0xf9450d2831320782ca16bf3afa3e6c9bc3812ae9532f074a2ce6015f2355d4bf --rpc-url https://bsc-dataseed.bnbchain.org without issue.

@alexanderhawl
Copy link

Today, I also met this problem. I wanna transfer token ,but it report outofgas.
IERC20(0xf3100086E52180b31fE39EF4a09e5BEE4E7D62EF).transfer(0x72AdEBF8F20d144c60db0677F20D19f0Ce89e11A, 0.01 ether);
fork rpc is https://rpc.ankr.com/bsc
foundry version : forge 0.2.0 (3ff3d05 2024-10-01T00:25:45.808130533Z)

@grandizzy
Copy link
Collaborator

the problem here is that we're simulating tx with a different EVM version than chain's at the time tx happened, if passing --evm-version istanbul option then it shows proper result

cast run 0xaa081672f7ad60e49000cb3520df1dce395d55d59ea31918adca41408f7fe28f --rpc-url https://rpc.ankr.com/bsc --evm-version istanbul

Traces:
  [29471] 0x55d398326f99059fF775485246999027B3197955::transfer(0x085747A5B761AB8682Be10F2597674e8AA688C66, 22000000000000000000 [2.2e19])
    ├─ emit Transfer(param0: 0xd9fcDa91103C9D082518350c1d2a437DA8C4f7d4, param1: 0x085747A5B761AB8682Be10F2597674e8AA688C66, param2: 22000000000000000000 [2.2e19])
    └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001

This is a broader issue (and affects test/script executions too) which we're going to address by autodetecting EVM version.

Ref:
#6228
#8614

@grandizzy
Copy link
Collaborator

same as #8446 we're going to close this one as dupe and track fix in 8446. thank you!

@grandizzy grandizzy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Oct 25, 2024
@grandizzy grandizzy moved this from Done to Completed in Foundry Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast T-bug Type: bug
Projects
Status: Completed
Development

No branches or pull requests

7 participants