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

Introduce Merkle Patricia Trie #939

Merged
merged 56 commits into from
Aug 24, 2020

Conversation

moreal
Copy link
Contributor

@moreal moreal commented Jul 29, 2020

Note: this pull request is based on #950 . It MUST be merged after #950 merged.

Tasks

  • Implement ITrie.TryGet, ITrie.Set
  • Fix serialization issue.
  • Implement secure trie option.
  • Implement IKeyValueStore for each IStore implementation
    • DefaultStore
    • RocksDBStore

There may be more updates or the end.

@moreal moreal added the storage Related to storage (Libplanet.Store) label Jul 29, 2020
@moreal moreal self-assigned this Jul 29, 2020
@codecov
Copy link

codecov bot commented Jul 29, 2020

Codecov Report

Merging #939 into main will decrease coverage by 0.25%.
The diff coverage is 82.85%.

@@            Coverage Diff             @@
##             main     #939      +/-   ##
==========================================
- Coverage   88.81%   88.55%   -0.26%     
==========================================
  Files         288      315      +27     
  Lines       26766    27652     +886     
==========================================
+ Hits        23771    24486     +715     
- Misses       1466     1620     +154     
- Partials     1529     1546      +17     
Impacted Files Coverage Δ
Libplanet/Store/Trie/Nodes/FullNode.cs 31.25% <31.25%> (ø)
Libplanet/Store/Trie/InvalidTrieNodeException.cs 33.33% <33.33%> (ø)
Libplanet/Store/Trie/Nodes/ShortNode.cs 50.00% <50.00%> (ø)
Libplanet/Store/Trie/DefaultKeyValueStore.cs 55.55% <55.55%> (ø)
Libplanet/Store/Trie/CacheableKeyValueStore.cs 63.33% <63.33%> (ø)
Libplanet.Tests/Store/Trie/MemoryKeyValueStore.cs 70.00% <70.00%> (ø)
Libplanet/Store/Trie/Nodes/HashNode.cs 72.72% <72.72%> (ø)
Libplanet/Store/TrieStateStore.cs 73.46% <73.46%> (ø)
Libplanet/Store/Trie/Nodes/NodeDecoder.cs 75.92% <75.92%> (ø)
...ibplanet.Tests/Store/Trie/BytesEqualityComparer.cs 76.92% <76.92%> (ø)
... and 48 more

@moreal moreal force-pushed the feature/implement-merkle-tree branch 2 times, most recently from 00fb143 to c296062 Compare August 7, 2020 05:27
@riemannulus riemannulus changed the base branch from master to main August 10, 2020 04:25
@dahlia dahlia mentioned this pull request Aug 10, 2020
@moreal moreal force-pushed the feature/implement-merkle-tree branch 5 times, most recently from 57ce5ab to 13176f1 Compare August 18, 2020 03:06
@moreal moreal force-pushed the feature/implement-merkle-tree branch 2 times, most recently from 8d10129 to ca3b197 Compare August 18, 2020 12:58
@moreal moreal marked this pull request as ready for review August 18, 2020 12:58
@moreal moreal force-pushed the feature/implement-merkle-tree branch from ca3b197 to 9aa6ab1 Compare August 18, 2020 13:03
@moreal
Copy link
Contributor Author

moreal commented Aug 18, 2020

It is ready to review except for changelog. You can review now except for it.
It's ready to review 💪 /cc @libplanet

Libplanet/Store/Trie/Nodes/BaseNode.cs Outdated Show resolved Hide resolved
Libplanet/Store/Trie/Nodes/FullNode.cs Outdated Show resolved Hide resolved
Libplanet/Store/Trie/Nodes/NodeDecoder.cs Show resolved Hide resolved
Libplanet/Store/Trie/Nodes/ValueNode.cs Outdated Show resolved Hide resolved
Libplanet/Store/TrieStateStore.cs Outdated Show resolved Hide resolved
Libplanet/Store/TrieStateStore.cs Outdated Show resolved Hide resolved
public void ForkStates<T>(Guid sourceChainId, Guid destinationChainId, Block<T> branchpoint)
where T : IAction, new()
{
// Do nothing.
Copy link
Member

Choose a reason for hiding this comment

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

Is it okay that we don't anything here even throwing / logging error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, ForkStates(…) is called in BlockChain<T>.Fork(…) so if it throws exceptions it will always fail. And it is intended.

Libplanet/Store/Trie/Trie.cs Outdated Show resolved Hide resolved
Libplanet/Store/Trie/Trie.cs Outdated Show resolved Hide resolved
@moreal moreal force-pushed the feature/implement-merkle-tree branch from aae7bcd to a1095bf Compare August 19, 2020 11:23
@moreal moreal requested a review from longfin August 19, 2020 12:13
Copy link
Member

@longfin longfin left a comment

Choose a reason for hiding this comment

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

Builds seem to fail 😢

@moreal moreal force-pushed the feature/implement-merkle-tree branch 2 times, most recently from e327345 to b79cbaa Compare August 19, 2020 12:37
@moreal moreal requested a review from longfin August 19, 2020 16:22
moreal and others added 14 commits August 24, 2020 19:19
Co-Authored-By: Seunghun Lee <waydi1@gmail.com>
Co-Authored-By: Seunghun Lee <waydi1@gmail.com>
It is for RocksDB.

Co-Authored-By: Seunghun Lee <waydi1@gmail.com>
Co-Authored-By: Seunghun Lee <waydi1@gmail.com>
See https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references

Co-Authored-By: Hong Minhee <hong.minhee@planetariumhq.com>
Reorder items

Co-Authored-By: Hong Minhee <hong.minhee@planetariumhq.com>
 - `BytesEqualityComparer.Equals(…)`

Co-Authored-By: Hong Minhee <hong.minhee@planetariumhq.com>
 - Update XML documents

Co-Authored-By: Ko Chanhyuck <lime_bell@naver.com>
 - Fix a missing nullable

Co-Authored-By: Seunghun Lee <waydi1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
storage Related to storage (Libplanet.Store)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants