-
Notifications
You must be signed in to change notification settings - Fork 213
[Storehouse] 001 - Add payloadless node and trie implementation #8569
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c51de07
add original mtrie implementation as base for comparison
zhangchiqing a3a4d2a
add payloadless node and trie implementation
zhangchiqing f935c34
remove ExtendHashToHeight and replace baseHash to leafHash in naming
zhangchiqing f42a6d8
add comments for NewMTrie
zhangchiqing 14e6396
Suggested amendments for PR #8569: encapsulate leaf re-leveling, refi…
AlexHentschel 0077b9e
Update ledger/complete/payloadless/trie.go
AlexHentschel 1e8e7a7
Update ledger/complete/payloadless/node.go
AlexHentschel d89f3a6
Merge pull request #8599 from onflow/alex/payloadless-suggestions
AlexHentschel d621150
add comments to trie
zhangchiqing 917b5db
Merge branch 'master' into leo/payloadless
zhangchiqing 9b0aa2a
fix lint
zhangchiqing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package hash | ||
|
|
||
| import ( | ||
| "crypto/rand" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // Test_hash256Plus_matches_hash256plus256 checks that for a 32-byte p2 the two | ||
| // absorption routines produce the same digest. hash256Plus is the variable-length | ||
| // path (p1 is 256 bits, p2 is an arbitrary-length slice) while hash256plus256 is the | ||
| // fixed 256+256-bit fast path. When p2 is exactly 32 bytes both absorb the identical | ||
| // 512-bit input under the same SHA3-256 padding, so their outputs must be equal. | ||
| func Test_hash256Plus_matches_hash256plus256(t *testing.T) { | ||
| var p1, p2 Hash | ||
| _, err := rand.Read(p1[:]) | ||
| require.NoError(t, err) | ||
| _, err = rand.Read(p2[:]) | ||
| require.NoError(t, err) | ||
|
|
||
| h1 := (&state{}).hash256Plus(p1, p2[:]) | ||
| h2 := (&state{}).hash256plus256(p1, p2) | ||
|
|
||
| assert.Equal(t, h1, h2) | ||
| } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AI applied this clarification also to this file, increasing change surface. If that results in conflicts we could drop the changes here and re-apply them in the end. @zhangchiqing