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

trie: fix range prover #22210

Merged
merged 2 commits into from
Jan 22, 2021
Merged

trie: fix range prover #22210

merged 2 commits into from
Jan 22, 2021

Conversation

rjl493456442
Copy link
Member

Fixes the issue described #22179 (comment)

It's a special case that the trie only has a single trie node and the range proof only contains a single element.

TRACE[01-20|15:53:31.702] Fetching range of accounts               id=nice-a reqid=4037200794235010051 root="c2661f…b0463a" origin="000000…000000" limit="0fffff…ffffff" bytes=512.00KiB
TRACE[01-20|15:53:31.702] Delivering range of accounts             id=nice-a reqid=4037200794235010051 hashes=1 accounts=1 proofs=1 bytes=210.00B
panic: interface conversion: trie.node is nil, not *trie.fullNode

goroutine 20 [running]:
github.com/ethereum/go-ethereum/trie.unsetInternal(0xa5c2a0, 0xc00007ed70, 0xc00002b9a0, 0x41, 0x41, 0xc00002b9f0, 0x41, 0x41, 0x20, 0xa5c1a0)
	/home/user/go/src/github.com/ethereum/go-ethereum/trie/proof.go:302 +0xd65
github.com/ethereum/go-ethereum/trie.VerifyRangeProof(0x6657bd231f66c2, 0x723c83101df021d9, 0xea1a61864a975b5e, 0x3a46b00c81ac76fa, 0xc00014a630, 0x20, 0x20, 0xc000352400, 0x20, 0x20, ...)
	/home/user/go/src/github.com/ethereum/go-ethereum/trie/proof.go:563 +0x7e5
github.com/ethereum/go-ethereum/eth/protocols/snap.(*Syncer).OnAccounts(0xc000147b00, 0xa62960, 0xc00016a3f0, 0x380704bb7b4d7c03, 0xc0003522a0, 0x1, 0x1, 0xc00034c140, 0x1, 0x1, ...)
	/home/user/go/src/github.com/ethereum/go-ethereum/eth/protocols/snap/sync.go:2033 +0x876
github.com/ethereum/go-ethereum/eth/protocols/snap.defaultAccountRequestHandler(0xc00016a3f0, 0x380704bb7b4d7c03, 0x6657bd231f66c2, 0x723c83101df021d9, 0xea1a61864a975b5e, 0x3a46b00c81ac76fa, 0x0, 0x0, 0x0, 0x0, ...)
	/home/user/go/src/github.com/ethereum/go-ethereum/eth/protocols/snap/sync_test.go:220 +0x11b
created by github.com/ethereum/go-ethereum/eth/protocols/snap.(*testPeer).RequestAccountRange
	/home/user/go/src/github.com/ethereum/go-ethereum/eth/protocols/snap/sync_test.go:162 +0x365

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, minor comments

trie/proof.go Outdated Show resolved Hide resolved
trie/proof.go Outdated Show resolved Hide resolved
trie/proof.go Outdated Show resolved Hide resolved
@holiman holiman merged commit 9e1bd0f into ethereum:master Jan 22, 2021
@holiman holiman added this to the 1.10.0 milestone Jan 22, 2021
@karalabe
Copy link
Member

Erm, doesn't this PR always return false?

@karalabe
Copy link
Member

Oh, there was a true, just in a new return line so it didn't get extra-highlighted. Sry for the noise.

@rjl493456442
Copy link
Member Author

bulgakovk pushed a commit to bulgakovk/go-ethereum that referenced this pull request Jan 26, 2021
Fixes a special case when the trie only has a single trie node and the range proof only contains a single element.
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