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

Fix trie reuse after Commit in atomic sync #411

Merged
merged 7 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugin/evm/atomic_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ func (a *atomicBackend) initialize(lastAcceptedHeight uint64) error {
return err
}
}
// Trie must be re-opened after committing (not safe for re-use after commit)
tr, err = a.atomicTrie.OpenTrie(root)
if err != nil {
return err
}

heightsIndexed++
if time.Since(lastUpdate) > progressLogFrequency {
Expand Down
6 changes: 6 additions & 0 deletions plugin/evm/atomic_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ func (s *atomicSyncer) onLeafs(keys [][]byte, values [][]byte) error {
return err
}
}
// Trie must be re-opened after committing (not safe for re-use after commit)
trie, err := s.atomicTrie.OpenTrie(root)
patrick-ogrady marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return err
}
s.trie = trie
s.lastHeight = height
}

Expand Down
Loading