ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.65k stars 3.28k forks source link

op-deployer does not support L1 chainID past u32 #12837

Open Rjected opened 1 week ago

Rjected commented 1 week ago

Bug Description op-deployer currently panics if you provide a l1 chain id outside of the range:

panic: failed to derive key of path m/44'/60'/2'/4294967296/6 (key description: chain(4294967296)-l1-proxy-admin-owner): component 4294967296 out of allowed range [0, 4294967295]

goroutine 1 [running]:
github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer.Init.func1(...)
 /home/dan/optimism/op-deployer/pkg/deployer/init.go:108
github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer.Init({{0x112fd1d, 0x4}, 0x100000000, {0xc000038004, 0x22}, {0xc000118860, 0x1, 0x1}})
 /home/dan/optimism/op-deployer/pkg/deployer/init.go:113 +0x10da
main.main.InitCLI.func1(0xc00016ae00)
 /home/dan/optimism/op-deployer/pkg/deployer/init.go:69 +0x330
github.com/urfave/cli/v2.(*Command).Run(0xc000330000, 0xc00016ae00, {0xc0000f8690, 0x5, 0x5})
 /home/dan/go/pkg/mod/github.com/urfave/cli/v2@v2.27.5/command.go:276 +0x97d
github.com/urfave/cli/v2.(*Command).Run(0xc0003306e0, 0xc00016abc0, {0xc0000361e0, 0x6, 0x6})
 /home/dan/go/pkg/mod/github.com/urfave/cli/v2@v2.27.5/command.go:269 +0xbb7
github.com/urfave/cli/v2.(*App).RunContext(0xc0002aa000, {0x151fca0, 0x1d508a0}, {0xc0000361e0, 0x6, 0x6})
 /home/dan/go/pkg/mod/github.com/urfave/cli/v2@v2.27.5/app.go:333 +0x5a5
github.com/urfave/cli/v2.(*App).Run(...)
 /home/dan/go/pkg/mod/github.com/urfave/cli/v2@v2.27.5/app.go:307
main.main()
 /home/dan/optimism/op-deployer/cmd/op-deployer/main.go:58 +0x458

Steps to Reproduce Run op-deployer with a L1 chain id over u32:

./op-deployer init --l1-chain-id 4294967296 --l2-chain-ids 1337

Expected behavior L1 chain IDs can be over u32 and I would expect this to not panic

Environment Information:


⚠️ Notice: Issues that do not include the following sections will be subject to closure:

Please ensure all required sections are filled out accurately to expedite the debugging process and improve issue resolution efficiency.

tynes commented 2 days ago

Ah this is a good catch, we should likely mod by u32 when deriving the keys