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

Coders for merkle trees #519

Closed
wants to merge 1 commit into from

Conversation

tbekas
Copy link
Contributor

@tbekas tbekas commented Aug 16, 2023

No description provided.

@tbekas tbekas requested a review from benbierens August 16, 2023 10:26
codex/merkletree/coders.nim Show resolved Hide resolved
@@ -184,6 +182,17 @@ proc `$`*(self: MerkleTree): string =
result &= "leavesCount: " & $self.leavesCount
result &= "\nnodes: " & $self.nodes

func `==`*(a, b: MerkleTree): bool =
(a.leavesCount == b.leavesCount) and (a.nodes == b.nodes)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this guaranteed enough to determine equality? Can I not have a tree with the same number of nodes and leaves, but different hashes everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does compare hashes as well. a.nodes == b.nodes compare sequences, so individual items in sequence are also compared.

tests/codex/merkletree/testcoders.nim Show resolved Hide resolved
@tbekas tbekas marked this pull request as ready for review August 28, 2023 05:37
@tbekas
Copy link
Contributor Author

tbekas commented Oct 12, 2023

Moved to a different PR

@tbekas tbekas closed this Oct 12, 2023
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.

2 participants