ethereum-optimism / go-ethereum

[Optimism] Go implementation of the Optimistic Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
45 stars 28 forks source link

segmentation violation on start #296

Open garyng2000 opened 3 years ago

garyng2000 commented 3 years ago

I tried to run my own node from scratch(i.e. deploy the bridging contracts) and adjust the geth start script but get the following on start(yet another one I did the same a few days ago is fine). what would be the reason for this

TARGET_GAS_LIMIT=9000000 USING_OVM=true /mnt/data/optimism/go-ethereum/scripts/../build/bin/geth --eth1.syncservice --datadir /mnt/data/optimism/go-ethereum/scripts/../private880 --eth1.chainid 88 --eth1.l1crossdomainmessengeraddress 0xBf70E3A0C4fEA1bB6A455A06698f28dfcAf54461 --rollup.addressmanagerowneraddress 0x8389705023b84489DEAD2BAeFfbA5D37D8DAa3b7 --rollup.statedumppath https://raw.githubusercontent.com/ethereum-optimism/regenesis/master/mainnet/2.json --eth1.ctcdeploymentheight 1720050 --eth1.l1ethgatewayaddress 0x84b2b5cDE86208163Ac9d4b84Ca58b33ba2b7233 --rollup.clienthttp http://localhost:7878 --rollup.pollinterval 15s --rollup.timestamprefresh 15m --cache 1024 --rpc --port 42303 --chainid 880 --rpcaddr 0.0.0.0 --rpcport 9345 --rpcvhosts '*' --rpccorsdomain '*' --rpcvhosts '*' --ws --wsaddr 0.0.0.0 --wsport 9346 --wsorigins '*' --rpcapi 'eth,net,rollup,web3,debug' --gasprice 0 --nousb --gcmode=archive --ipcdisable --verbosity=3
INFO [04-01|17:06:13.238] Maximum peer count                       ETH=50 LES=0 total=50
INFO [04-01|17:06:13.238] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [04-01|17:06:13.238] Starting peer-to-peer node               instance=Geth/v1.9.10-stable-77dd7329/linux-amd64/go1.16.1
INFO [04-01|17:06:13.238] Allocated trie memory caches             clean=512.00MiB dirty=0.00B
INFO [04-01|17:06:13.238] Allocated cache and file handles         database=/mnt/data/optimism/go-ethereum/private880/geth/chaindata cache=512.00MiB handles=524288
INFO [04-01|17:06:13.251] Opened ancient database                  database=/mnt/data/optimism/go-ethereum/private880/geth/chaindata/ancient
INFO [04-01|17:06:13.251] Writing default main-net genesis block
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9cd3ba]

goroutine 1 [running]:
github.com/ethereum/go-ethereum/core.ApplyOvmStateToState(0xc000686280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /mnt/data/optimism/go-ethereum/core/genesis.go:270 +0x3a
github.com/ethereum/go-ethereum/core.(*Genesis).ToBlock(0xc0001b2300, 0x149c7e8, 0xc00025a600, 0xf8)
        /mnt/data/optimism/go-ethereum/core/genesis.go:341 +0x6cf
github.com/ethereum/go-ethereum/core.(*Genesis).Commit(0xc0001b2300, 0x149c7e8, 0xc00025a600, 0x3, 0x0, 0x0)
        /mnt/data/optimism/go-ethereum/core/genesis.go:381 +0x5a
github.com/ethereum/go-ethereum/core.SetupGenesisBlockWithOverride(0x149c7e8, 0xc00025a600, 0xc0001b2300, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /mnt/data/optimism/go-ethereum/core/genesis.go:183 +0x1a7
github.com/ethereum/go-ethereum/eth.New(0xc0002a1260, 0xc0005d0000, 0x0, 0xc00033f8a8, 0x430b98)
        /mnt/data/optimism/go-ethereum/eth/backend.go:143 +0x2cc
github.com/ethereum/go-ethereum/cmd/utils.RegisterEthService.func2(0xc0002a1260, 0xc0002afa10, 0xc00033fa10, 0xc0002a1220, 0x2)
        /mnt/data/optimism/go-ethereum/cmd/utils/flags.go:1738 +0x3d
github.com/ethereum/go-ethereum/node.(*Node).Start(0xc000688000, 0x0, 0x0)
        /mnt/data/optimism/go-ethereum/node/node.go:206 +0x423
github.com/ethereum/go-ethereum/cmd/utils.StartNode(0xc000688000)
        /mnt/data/optimism/go-ethereum/cmd/utils/cmd.go:67 +0x2f
main.startNode(0xc0003f2580, 0xc000688000)
        /mnt/data/optimism/go-ethereum/cmd/geth/main.go:337 +0x70
main.geth(0xc0003f2580, 0x0, 0x0)
        /mnt/data/optimism/go-ethereum/cmd/geth/main.go:325 +0x127
gopkg.in/urfave/cli%2ev1.HandleAction(0x10b5180, 0x1333e30, 0xc0003f2580, 0xc00009e8a0, 0x0)
        /home/docker/go/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:490 +0x82
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc000388000, 0xc000120a80, 0x36, 0x38, 0x0, 0x0)
        /home/docker/go/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:264 +0x5f5
main.main()
        /mnt/data/optimism/go-ethereum/cmd/geth/main.go:265 +0x55
tynes commented 3 years ago

Can you try running with --verbosity=6? This appears as if it is failing to pull the statedump from https://raw.githubusercontent.com/ethereum-optimism/regenesis/master/mainnet/2.json

garyng2000 commented 3 years ago

I found a work around. when starting geth without --dev, the create genesis(i.e. init the datadir, only need once) would fail with this segfault. I then renable it for the first init and later remove it and it still runs fine now.

not sure why though.

garyng2000 commented 3 years ago

and talking about the state dump, it seems that that is a constant file regardless of which chain it is intended for(a static compile time info for the contracts project). and I briefly read the the contracts project's build sequence which don't even really care about the chain id either. only at the time of deploy(or running the relayer/geth the chain id would come into play)

garyng2000 commented 3 years ago

this is verbosity=6, can't find much info there. my guess is it is expecting something like defaultAccount which --dev provides but is null for all other setup. I tried to give it the keystore(prepopulated) but still the same error. so for now, i settle with --dev on genesis creation then remove it afterwards

TARGET_GAS_LIMIT=9000000 USING_OVM=true /mnt/data/optimism/go-ethereum/scripts/../build/bin/geth --keystore --eth1.syncservice --datadir /mnt/data/optimism/go-ethereum/scripts/../private99990 --eth1.chainid 9999 --eth1.l1crossdomainmessengeraddress 0x4543F15def2667b871b71E44cee2E63c5CB23aE2 --rollup.addressmanagerowneraddress 0x8389705023b84489DEAD2BAeFfbA5D37D8DAa3b7 --rollup.statedumppath https://raw.githubusercontent.com/ethereum-optimism/regenesis/master/mainnet/2.json --eth1.ctcdeploymentheight 974645 --eth1.l1ethgatewayaddress 0xEa10c59B2Fc54e3C0b80ca19A11D9F47C3f1b24A --rollup.clienthttp http://localhost:7879 --rollup.pollinterval 15s --rollup.timestamprefresh 15m --cache 1024 --rpc --port 43303 --chainid 99990 --rpcaddr 0.0.0.0 --rpcport 9945 --rpcvhosts '' --rpccorsdomain '' --rpcvhosts '' --ws --wsaddr 0.0.0.0 --wsport 9946 --wsorigins '' --rpcapi 'eth,net,rollup,web3,debug' --gasprice 0 --nousb --gcmode=archive --ipcdisable --verbosity=6 DEBUG[04-03|00:50:32.061] Sanitizing Go's GC trigger percent=100 INFO [04-03|00:50:32.061] Maximum peer count ETH=50 LES=0 total=50 INFO [04-03|00:50:32.061] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" DEBUG[04-03|00:50:32.061] FS scan times list=10.775µs set=304ns diff=521ns TRACE[04-03|00:50:32.061] Started watching keystore folder path=/mnt/data/optimism/go-ethereum/--eth1.syncservice INFO [04-03|00:50:32.061] Starting peer-to-peer node instance=Geth/v1.9.10-stable-f7b384f8/linux-amd64/go1.16.1 INFO [04-03|00:50:32.061] Allocated trie memory caches clean=512.00MiB dirty=0.00B INFO [04-03|00:50:32.062] Allocated cache and file handles database=/mnt/data/optimism/go-ethereum/private99990/geth/chaindata cache=512.00MiB handles=524288 DEBUG[04-03|00:50:32.068] Chain freezer table opened database=/mnt/data/optimism/go-ethereum/private99990/geth/chaindata/ancient table=receipts items=0 size=0.00B DEBUG[04-03|00:50:32.070] Chain freezer table opened database=/mnt/data/optimism/go-ethereum/private99990/geth/chaindata/ancient table=diffs items=0 size=0.00B DEBUG[04-03|00:50:32.071] Chain freezer table opened database=/mnt/data/optimism/go-ethereum/private99990/geth/chaindata/ancient table=headers items=0 size=0.00B DEBUG[04-03|00:50:32.072] Chain freezer table opened database=/mnt/data/optimism/go-ethereum/private99990/geth/chaindata/ancient table=hashes items=0 size=0.00B DEBUG[04-03|00:50:32.073] Chain freezer table opened database=/mnt/data/optimism/go-ethereum/private99990/geth/chaindata/ancient table=bodies items=0 size=0.00B INFO [04-03|00:50:32.073] Opened ancient database database=/mnt/data/optimism/go-ethereum/private99990/geth/chaindata/ancient INFO [04-03|00:50:32.073] Writing default main-net genesis block DEBUG[04-03|00:50:32.073] Current full block hash unavailable panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9cd3ba]

goroutine 1 [running]: github.com/ethereum/go-ethereum/core.ApplyOvmStateToState(0xc0003b2280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /mnt/data/optimism/go-ethereum/core/genesis.go:270 +0x3a github.com/ethereum/go-ethereum/core.(Genesis).ToBlock(0xc0001b2300, 0x149ca08, 0xc00031e480, 0xf8) /mnt/data/optimism/go-ethereum/core/genesis.go:341 +0x6cf github.com/ethereum/go-ethereum/core.(Genesis).Commit(0xc0001b2300, 0x149ca08, 0xc00031e480, 0x3, 0x0, 0x0) /mnt/data/optimism/go-ethereum/core/genesis.go:381 +0x5a github.com/ethereum/go-ethereum/core.SetupGenesisBlockWithOverride(0x149ca08, 0xc00031e480, 0xc0001b2300, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /mnt/data/optimism/go-ethereum/core/genesis.go:183 +0x1a7 github.com/ethereum/go-ethereum/eth.New(0xc000788180, 0xc000188000, 0x0, 0xc00049f8a8, 0x430b98) /mnt/data/optimism/go-ethereum/eth/backend.go:143 +0x2cc github.com/ethereum/go-ethereum/cmd/utils.RegisterEthService.func2(0xc000788180, 0xc0002477d0, 0xc00049fa10, 0xc000788140, 0x2) /mnt/data/optimism/go-ethereum/cmd/utils/flags.go:1738 +0x3d github.com/ethereum/go-ethereum/node.(Node).Start(0xc000438280, 0x0, 0x0) /mnt/data/optimism/go-ethereum/node/node.go:206 +0x423 github.com/ethereum/go-ethereum/cmd/utils.StartNode(0xc000438280) /mnt/data/optimism/go-ethereum/cmd/utils/cmd.go:67 +0x2f main.startNode(0xc000198000, 0xc000438280) /mnt/data/optimism/go-ethereum/cmd/geth/main.go:337 +0x70 main.geth(0xc000198000, 0x0, 0x0) /mnt/data/optimism/go-ethereum/cmd/geth/main.go:325 +0x127 gopkg.in/urfave/cli%2ev1.HandleAction(0x10b51a0, 0x1333ff0, 0xc000198000, 0xc00038e4e0, 0x0) /home/docker/go/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:490 +0x82 gopkg.in/urfave/cli%2ev1.(App).Run(0xc0003ba000, 0xc000120a80, 0x37, 0x38, 0x0, 0x0) /home/docker/go/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:264 +0x5f5 main.main() /mnt/data/optimism/go-ethereum/cmd/geth/main.go:265 +0x55