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

feat: compute leaf hashes immediately after data items are pushed #108

Closed
staheri14 opened this issue Feb 17, 2023 · 0 comments · Fixed by #172
Closed

feat: compute leaf hashes immediately after data items are pushed #108

staheri14 opened this issue Feb 17, 2023 · 0 comments · Fixed by #172
Assignees
Labels
enhancement New feature or request

Comments

@staheri14
Copy link
Collaborator

staheri14 commented Feb 17, 2023

Problem

Identified as part of this EPIC: celestiaorg/celestia-app#1296.
When adding data items to the tree, their hash is not directly calculated. Instead, every time we need to access the leaf hashes, we have to compare the number of data items added so far (which can be found in the leaves field of NamespaceMerkleTree) with the leaf hashes (which are stored in the leafHashes field of the same struct). For example, see the computeRoot() method and computeLeafHashesIfNecessary() function.
This can make debugging and code maintenance more challenging.

Acceptance criteria

To simplify the process, it would be better to hash the data items immediately after they are pushed. We can address this issue by implementing this feature in the Push method and refactoring the other parts of the code as necessary.

@staheri14 staheri14 self-assigned this Feb 17, 2023
@rootulp rootulp added the enhancement New feature or request label Apr 3, 2023
staheri14 added a commit that referenced this issue Apr 6, 2023
## Overview
Closes #108  and #143

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants