foundry: Foundry breaks chainId on optimism mainnet deployment

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 (550c548 2023-02-13T00:11:18.976721967Z)

What command(s) is the bug in?

forge script

Operating System

Linux

Describe the bug

For certain transactions on optimism network - i can’t determine what is the condition, but managed to create a reliable reproduction - foundry sends chainId 0.

Things I tried:

  • ensure the chainId in the correct inside the script - checked via require(block.chainId)
  • I checked with multiple RPCs to eliminate RPC issues
  • tried different systems (linux, macos)
  • tried different ledgers

Reproduction:

References:

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 23 (22 by maintainers)

Most upvoted comments

not in nightly yet, triggering release now, should be available in ~45min

Just tested, and have confirmed that https://github.com/gakonst/ethers-rs/pull/2192 will mitigate. Device now shows Optimism 😃

oh nevermind, I did not. rlp encoding seems okay when we hand it over to ledger

I does not make any sense why ledger would see the chain id as 0

oh I think I’ve found it