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:
- checkout: https://github.com/bgd-labs/proposal-3.0.1-upgrade/blob/feat/reproduction/scripts/DeployPayloads.s.sol#L298
- run
make recover-optimism-ledgerwith a connected ledger. - Review the txn on your ledger and notice
network 0
References:
- this issue is part of https://github.com/foundry-rs/foundry/issues/4346 but dedicated a new issue as the other reported problems are
ux issueswhile this one seems to be a real blocker for using foundry with optimism.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 23 (22 by maintainers)
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
0oh I think I’ve found it