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: Separate database integration from trie into its own crate #8599

Conversation

RomanHodulak
Copy link
Contributor

@RomanHodulak RomanHodulak commented Jun 4, 2024

Closes #8514

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I'm unequipped to review these code changes and there are quite a few @rkrasiuk

my original idea was to extract the types instead (especially trieupdates) and then work towards making them not dependent on the db deps.

but this approach also works, but I'm not sure about these changes, because using wrapper types to implement a trait is not ideal.

I assume it would be more useful to have
trie-types and trie
wdyt @rkrasiuk

crates/trie/trie-db/src/updates.rs Outdated Show resolved Hide resolved
crates/trie/trie-db/Cargo.toml Show resolved Hide resolved
@mattsse
Copy link
Collaborator

mattsse commented Jun 5, 2024

perhaps we kick this off by extracting these:

https://github.com/paradigmxyz/reth/tree/01fd9b3c76705e582cea17774f269fe4a78d8af3/crates/primitives/src/trie

to trie-types instead and then try to move more stuff from reth-trie there?

@RomanHodulak
Copy link
Contributor Author

Hey @mattsse, thank you for reviewing my PR so swiftly.

So far I've been thinking that crates:

  • reth-trie - contains types and behavior of the Trie domain, but does not depend on a database, the concept of database does not really exist there. Should I rename it to reth-trie-types?
  • reth-trie-db - is a projection of the reth-trie into the database, but does not define any concepts of the Trie domain. It implements the traits defined by the Trie domain using reth_database. There might be other implementations than the reth_database. that's why the reth-trie-db shouldn't contain domain behavior or types, otherwise that would lead to duplication of knowledge.

I haven't looked into the primitives crate yet, so that's where I'll go next. It does make sense to pull the trie module out of that crate and put it into the reth-trie crate.

@emhane emhane added C-debt Refactor of code section that is hard to understand or maintain A-db Related to the database labels Jun 17, 2024
@RomanHodulak
Copy link
Contributor Author

Superseded by #9282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract reth-trie-types from reth-trie
3 participants