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

Cache hash outputs #260

Open
musalbas opened this issue Aug 7, 2023 · 6 comments
Open

Cache hash outputs #260

musalbas opened this issue Aug 7, 2023 · 6 comments

Comments

@musalbas
Copy link
Member

musalbas commented Aug 7, 2023

We can likely optimize the computation of row/col roots by up to 2x if we cache the outputs of leafs, because right now we are hashing all the data chunks twice, once to compute the row roots, and once to compute the col roots.

@Wondertan
Copy link
Member

Additionally, celestia-node or any other rsmt2d consumer using EDS would benefit from caching the proofs along with making them accessible through API.

@Wondertan
Copy link
Member

Otherwise, users have to come up with hacks to gain performance benefits from caching. See: https://github.com/celestiaorg/celestia-node/pull/2429/files

@musalbas
Copy link
Member Author

musalbas commented Aug 7, 2023

Maybe this should actually just be implemented in the (tree)hasher implementation rather than rsmt2d. Or make a cached hasher implementation

@Wondertan
Copy link
Member

Do you mean multihash hasher?

@musalbas
Copy link
Member Author

musalbas commented Aug 7, 2023 via email

@Wondertan
Copy link
Member

This hasher is global, while proofs are per EDS. The hasher could store a eds->proofs map, but I don't think it should be responsible for that. Instead, the EDS itself should keep a reference to a built tree.

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

No branches or pull requests

2 participants