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

refactor(pkg/trie): Encapsulate in-memory trie impl in its own package #3803

Merged
merged 45 commits into from
Mar 28, 2024

Conversation

dimartiro
Copy link
Contributor

@dimartiro dimartiro commented Mar 21, 2024

Changes

This PR is to create an independent inmemory package within pkg/trie to encapsulate the InmemoryTrie implementation there.
This is useful to prevent mixing the new code for the lazy loading trie implementation (aka: TrieDB) with the old inmemory trie implementation

Summary of changes

  • Move all files related with the in-memory trie implementation to /pkg/trie/inmemory folder
    • The structures or methods that are shared between different trie implementation remains in `/pkg/trie/
    • Update imports to import inmemory_trie as alias instead of using old trie package
    • Add new layout_test as part of /pkg/trie/inmemory to test the layout for the in-memory trie implementation
    • Move /pkg/trie/proof to /pkg/trie/inmemory/proof since it's coupled with the trie implementation
  • Add a Trie parameter to layout.Root function to make it generic based on Trie implementation

Tests

make test
I also did run a node locally from genesis until block 1M (stopping it and restarting it a few times)

Issues

closes #3804

Primary Reviewer

@jimjbrettj

@dimartiro dimartiro changed the title Diego/trie inmemory package refactor(pkg/trie): Encapsulate in-memory trie impl in its own package Mar 21, 2024
pkg/trie/db/db.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jimjbrettj jimjbrettj left a comment

Choose a reason for hiding this comment

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

lgtm

Base automatically changed from diego/trie-interface to development March 27, 2024 19:56
@dimartiro dimartiro merged commit 476115a into development Mar 28, 2024
24 checks passed
@dimartiro dimartiro deleted the diego/trie-inmemory-package branch March 28, 2024 13:01
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.

(pkg/trie): Encapsulate inmemory trie logic in its own package
3 participants