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

Base fee causes error in forked Rinkeby network on first transaction #1863

Closed
2 tasks done
antazoey opened this issue Jun 7, 2022 · 7 comments · Fixed by #1865
Closed
2 tasks done

Base fee causes error in forked Rinkeby network on first transaction #1863

antazoey opened this issue Jun 7, 2022 · 7 comments · Fixed by #1865
Labels
C-anvil Command: anvil T-bug Type: bug T-question Type: question

Comments

@antazoey
Copy link

antazoey commented Jun 7, 2022

Component

Anvil

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (3fc1491 2022-06-06T00:14:30.023454Z)

What command(s) is the bug in?

anvil --mnemonic "test test test test test test test test test test test junk" --accounts 10 --derivation-path "m/44'/60'/0'" --fork-url https://eth-rinkeby.alchemyapi.io/v2/key-that-i-did-not-paste

Operating System

macOS (Intel)

Describe the bug

Steps to repro:

Step 1: Launch anvil using a forked Rinkeby network
Step 2: Make any transaction and set the base fee to the base fee of the "latest" block (e.g. the default way to do it?)
Step 3: Notice the transaction fails
Step 4: Make transaction again
Step 5: Notice everything works as expected after first transaction (consistently)

Reasons maybe:

The base fee on the latest block from Rinkeby is minute, e.g. 14 last I checked
Every subsequent block in Anvil uses 1000000000. If I manually set my base fee to 1000000000 on the first transaction, it will succeed.

NOTE: When using Hardhat, I do not have this problem.

@antazoey antazoey added the T-bug Type: bug label Jun 7, 2022
@mattsse
Copy link
Member

mattsse commented Jun 7, 2022

thanks for reporting,

if I read that correctly it looks like we should be using the basefee of the last block when in fork mode?

@antazoey
Copy link
Author

antazoey commented Jun 7, 2022

That would make sense, but then the problem is that rinkeby's non-existent >0 base fee causes transaction errors but I am not sure why.

Possibly unrelated, but I am also unable to deploy (using RPCs / Anvil only) when using a forked network and an account from the mnemonic. The transaction always fails and does not give any reason.

@mattsse
Copy link
Member

mattsse commented Jun 7, 2022

mind trying again with this PR #1865 ?

@mattsse mattsse added the T-question Type: question label Jun 7, 2022
@antazoey
Copy link
Author

antazoey commented Jun 7, 2022

mind trying again with this PR #1865 ?

Amazing! this seems to fix the problem entirely :)
Sorry for the delay - that was my first time installing Foundry from source

@gakonst
Copy link
Member

gakonst commented Jun 8, 2022

@mattsse I think like in that other case we had encountered (around the EVM gasprice when forking), we should be making the anvil basefee config an Option, and if we're forking and the basefee is None use the remote network's basefee, otherwise use ours. So I like the solution here https://github.com/foundry-rs/foundry/pull/1865/files unless you think we should not do it for some other reason

@onbjerg onbjerg added the C-anvil Command: anvil label Jun 9, 2022
@mattsse
Copy link
Member

mattsse commented Jun 10, 2022

unless you think we should not do it for some other reason

currently, we have gas_price and base_fee as separate values, we should initialize them to the same value (basefee of last block) then, right?

@gakonst
Copy link
Member

gakonst commented Jun 11, 2022

Yep, I think so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug T-question Type: question
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants