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

eth/protocols/snap: save nodes on right boundary in hash mode #29791

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rjl493456442
Copy link
Member

This pull request fixes an issue in hash gentrie.

In hash-mode, no matter the gentrie is complete or not, all the nodes on the right boundary should be flushed into disk if commit is called. As the garbage nodes will be unlinked from the trie by state healer.

Currently, if the right boundary of gentrie is claimed as incomplete, nodes on it are silently discarded. Given that the nodes on incomplete boundary are usually useless, but still the behavior should be aligned in hash gentrie.

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

@rjl493456442
Copy link
Member Author

rjl493456442 commented May 24, 2024

It panics, need investigation

May 24 10:25:09 bench05.ethdevops.io geth panic: trying to insert into hash
May 24 10:25:09 bench05.ethdevops.io geth   panic: trying to insert into hash
May 24 10:25:09 bench05.ethdevops.io geth goroutine 158811 [running]:
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/trie.(*StackTrie).insert(0xc000a36d50, 0xc00015d200, {0xc000d9efa0, 0x40, 0x41}, {0xc000d9ef50, 0x4d, 0x4d}, {0x0, 0x0, ...})
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/trie/stacktrie.go:284 +0x51d
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/trie.(*StackTrie).Update(0xc000a36d50, {0xc008b84420, 0x20, 0x715abf?}, {0xc000d9ef50, 0x4d, 0x4d})
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/trie/stacktrie.go:77 +0x2fb
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/protocols/snap.(*hashTrie).update(0xc002c017f0?, {0xc008b84420?, 0xf3822751a1bee7a1?, 0xe9a4d9952dd671fe?}, {0xc000d9ef50?, 0xc007684fa0?, 0xc002c017f0?})
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/protocols/snap/gentrie.go:278 +0x25
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/protocols/snap.(*Syncer).forwardAccountTask(0xc0005d4008, 0xc000280b00)
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/protocols/snap/sync.go:2434 +0x3a3
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/protocols/snap.(*Syncer).Sync.func1()
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/protocols/snap/sync.go:630 +0x3e
May 24 10:25:09 bench05.ethdevops.io geth panic({0x176ac00?, 0x1ffbd30?})
May 24 10:25:09 bench05.ethdevops.io geth   runtime/panic.go:770 +0x132
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/trie.(*StackTrie).insert(0xc000a36c90, 0xc00015d140, {0xc0079d9d60, 0x40, 0x41}, {0xc0079d9d10, 0x46, 0x46}, {0x0, 0x0, ...})
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/trie/stacktrie.go:284 +0x51d
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/trie.(*StackTrie).Update(0xc000a36c90, {0xc0079d31a0, 0x20, 0x715abf?}, {0xc0079d9d10, 0x46, 0x46})
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/trie/stacktrie.go:77 +0x2fb
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/protocols/snap.(*hashTrie).update(0xc0014a3590?, {0xc0079d31a0?, 0x161ac922b365861f?, 0x15ab6be72db7f643?}, {0xc0079d9d10?, 0xc00053a180?, 0xc0014a3590?})
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/protocols/snap/gentrie.go:278 +0x25
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/protocols/snap.(*Syncer).forwardAccountTask(0xc0005d4008, 0xc000280a00)
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/protocols/snap/sync.go:2434 +0x3a3
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/protocols/snap.(*Syncer).processStorageResponse(0xc0005d4008, 0xc007416b80)
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/protocols/snap/sync.go:2269 +0x755
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/protocols/snap.(*Syncer).Sync(0xc0005d4008, {0xa7, 0x8f, 0xf0, 0xee, 0xa5, 0xa8, 0xfb, 0xd7, 0xe8, ...}, ...)
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/protocols/snap/sync.go:743 +0xddf
May 24 10:25:09 bench05.ethdevops.io geth github.com/ethereum/go-ethereum/eth/downloader.(*stateSync).run(...)
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/downloader/statesync.go:107
May 24 10:25:09 bench05.ethdevops.io geth created by github.com/ethereum/go-ethereum/eth/downloader.(*Downloader).runStateSync in goroutine 33642
May 24 10:25:09 bench05.ethdevops.io geth   github.com/ethereum/go-ethereum/eth/downloader/statesync.go:63 +0x112

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