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

catalyst: check if block exists in assemble-block call with unknown parent-hash #22770

Merged
merged 1 commit into from
Apr 29, 2021

Conversation

protolambda
Copy link
Contributor

@protolambda protolambda commented Apr 29, 2021

This adds a simple nil check on the retrieved parent block during the assembleBlock RPC call in catalyst (merge prototype).

Crash (thanks to potuz on discord for finding this):

INFO [04-29|08:56:36.015] Producing block                          parentHash=7d555b..bafbe4
ERROR[04-29|08:56:36.015] RPC method consensus_assembleBlock crashed: runtime error: invalid memory address or nil pointer dereference
goroutine 823 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1(0xc00012a5b8, 0x17, 0xc0005ebd58)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/service.go:200 +0xbd
panic(0x11c7600, 0x1c1b520)
	/usr/lib/go/src/runtime/panic.go:965 +0x1b9
github.com/ethereum/go-ethereum/core/types.(*Block).Time(...)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/core/types/block.go:278
github.com/ethereum/go-ethereum/eth/catalyst.(*consensusAPI).AssembleBlock(0xc0001ae018, 0xf83cd151545b557d, 0x16a47c8c41fde4f2, 0x3233f2f5ed318202, 0xe4fbbad77a719efa, 0x608a9ef4, 0x0, 0x0, 0x0)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/eth/catalyst/api.go:114 +0x13a
reflect.Value.call(0xc0001795c0, 0xc0001afde8, 0x13, 0x134c682, 0x4, 0xc000145090, 0x2, 0x3, 0xc0001450a8, 0xc000346ac8, ...)
	/usr/lib/go/src/reflect/value.go:476 +0x8e7
reflect.Value.Call(0xc0001795c0, 0xc0001afde8, 0x13, 0xc000145090, 0x2, 0x3, 0x0, 0x0, 0x11cd320)
	/usr/lib/go/src/reflect/value.go:337 +0xb9
github.com/ethereum/go-ethereum/rpc.(*callback).call(0xc00053b980, 0x157b338, 0xc000148e00, 0xc00012a5b8, 0x17, 0xc000346ac8, 0x1, 0x1, 0x0, 0x0, ...)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/service.go:206 +0x2c5
github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0xc00014b830, 0x157b338, 0xc000148e00, 0xc000317730, 0xc00053b980, 0xc000346ac8, 0x1, 0x1, 0x1)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/handler.go:389 +0x8a
github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0xc00014b830, 0xc000f45ec0, 0xc000317730, 0x203000)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/handler.go:337 +0x265
github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0xc00014b830, 0xc000f45ec0, 0xc000317730, 0x156d601)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/handler.go:298 +0x1be
github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1(0xc000f45ec0)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/handler.go:139 +0x46
github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1(0xc00014b830, 0xc000346ab0)
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/handler.go:226 +0xd2
created by github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc
	/home/heluani/Documents/code/rayonism/mergenet-tutorial/clients/catalyst/rpc/handler.go:222 +0x66

cc @gballet

Fix is being tested now.

Edit: force pushed to amend wording in error log and message.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@protolambda
Copy link
Contributor Author

Update: the user with the original crash confirmed this to help. It's a simple fix in non-production code, can we merge it?

Copy link
Member

@gballet gballet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gballet gballet merged commit c7d0729 into ethereum:master Apr 29, 2021
@gballet gballet added this to the 1.10.3 milestone Apr 29, 2021
@protolambda protolambda deleted the parent-hash-catalyst branch April 29, 2021 14:43
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants