Skip to content

refactor(pkg/trie/triedb): node level caching#4239

Merged
timwu20 merged 21 commits intodevelopmentfrom
tim/refactor-triedb-caching
Nov 4, 2024
Merged

refactor(pkg/trie/triedb): node level caching#4239
timwu20 merged 21 commits intodevelopmentfrom
tim/refactor-triedb-caching

Conversation

@timwu20
Copy link
Copy Markdown
Contributor

@timwu20 timwu20 commented Oct 9, 2024

Changes

  • Introduces CachedNode and CachedValue which is used in the TrieCache interface. These are analogous types to codec.EncodedNode and codec.EncodedValue.
  • Adds CachedNodeAccess to the recorder and is recorded accordingly
  • Adds caching functionality to mutable TrieDB functions.
  • Introduces TrieDB.GetHash and triedb.GetWith functions that use TrieLookup with supplied cache.
  • Tests for proper caching functionality

Tests

go test -tags integration github.com/ChainSafe/gossamer

Issues

closes #4157

@timwu20 timwu20 force-pushed the tim/refactor-triedb-caching branch 4 times, most recently from 30419cd to 941f91d Compare October 11, 2024 17:41
@timwu20 timwu20 marked this pull request as ready for review October 11, 2024 18:02
@timwu20 timwu20 force-pushed the tim/refactor-triedb-caching branch from bea5ad3 to 1689aac Compare October 11, 2024 20:03
@timwu20 timwu20 requested a review from haikoschol October 11, 2024 20:05
@timwu20 timwu20 force-pushed the tim/refactor-triedb branch from dddbecc to 1ffda9a Compare October 15, 2024 13:45
Base automatically changed from tim/refactor-triedb to development October 15, 2024 14:41
@timwu20 timwu20 force-pushed the tim/refactor-triedb-caching branch from 1689aac to 2b1bc71 Compare October 15, 2024 19:43
@timwu20 timwu20 requested a review from P1sar as a code owner October 15, 2024 19:45
@timwu20 timwu20 force-pushed the tim/refactor-triedb-caching branch from be0dd1e to 3b7fb2f Compare October 16, 2024 17:17
Copy link
Copy Markdown
Member

@EclesioMeloJunior EclesioMeloJunior left a comment

Choose a reason for hiding this comment

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

LGTM, seems solid for me, good work 🚀 !

Copy link
Copy Markdown
Contributor

@dimartiro dimartiro left a comment

Choose a reason for hiding this comment

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

Looks good.
Just some comments, one specifically regarding the performance of the iterator but it's not a blocker for this PR, we can create an issue and optimize it later if possible

@timwu20 timwu20 force-pushed the tim/refactor-triedb-caching branch 2 times, most recently from 215328f to 233aefd Compare October 30, 2024 14:32
@timwu20 timwu20 force-pushed the tim/refactor-triedb-caching branch from 233aefd to ed69972 Compare October 31, 2024 13:23
@timwu20 timwu20 merged commit c845587 into development Nov 4, 2024
@timwu20 timwu20 deleted the tim/refactor-triedb-caching branch November 4, 2024 22:06
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.

Update TrieDB to adopt a node level caching mechanism

4 participants