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

rpc: avoid crashing on clique getSigner during sync #23832

Merged
merged 1 commit into from
Nov 1, 2021

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Oct 29, 2021

With an empty database, before this PR:

> clique.getSigner("latest")
ERROR[10-29|13:43:56.110] RPC method clique_getSigner crashed: runtime error: invalid memory address or nil pointer dereference
goroutine 153 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1()
	github.com/ethereum/go-ethereum/rpc/service.go:200 +0x89
panic({0x103e200, 0x1b263a0})
	runtime/panic.go:1038 +0x215
github.com/ethereum/go-ethereum/consensus/clique.ecrecover(0x0, 0x2)
	github.com/ethereum/go-ethereum/consensus/clique/clique.go:153 +0x170
github.com/ethereum/go-ethereum/consensus/clique.(*Clique).Author(...)
	github.com/ethereum/go-ethereum/consensus/clique/clique.go:213
github.com/ethereum/go-ethereum/consensus/clique.(*API).GetSigner(0xc003f7e3f0, 0x18)
	github.com/ethereum/go-ethereum/consensus/clique/api.go:217 +0x11d
reflect.Value.call({0xc0045ff560, 0xc002d1dc78, 0x79af2f9ab3c8}, {0x118fbee, 0x4}, {0xc004000eb0, 0x2, 0xc00401c640})
	reflect/value.go:543 +0x814

With this PR:

> clique.getSigner("latest")
WARN [10-29|13:48:50.806] Served clique_getSigner                  reqid=9 t="278.136µs" err="missing block -1"
Error: missing block -1
	at web3.js:6357:37(47)
	at send (web3.js:5091:62(35))
	at <eval>:1:17(4)

Q.E.D

@holiman holiman added this to the 1.10.12 milestone Oct 31, 2021
@holiman holiman merged commit ff84491 into ethereum:master Nov 1, 2021
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Nov 1, 2021
@holiman holiman deleted the clique_crash branch November 10, 2021 18:32
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this pull request Dec 3, 2022
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.

None yet

2 participants