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

fix empty_node_cache use for cache #6578

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

silentEAG
Copy link

Try to solve #6577
update empty_node_cache promptly.

@mergify mergify bot added the community Community contribution label Apr 14, 2024
@github-actions github-actions bot added the stale [bot only] Added to stale content; will be closed soon label May 6, 2024
@github-actions github-actions bot closed this May 13, 2024
@ngundotra ngundotra reopened this May 13, 2024
@ngundotra
Copy link
Contributor

ty for posting this, this will save a bunch of CU on mainnet!

How did you find?

@github-actions github-actions bot removed the stale [bot only] Added to stale content; will be closed soon label May 14, 2024
@silentEAG
Copy link
Author

silentEAG commented May 14, 2024

Hey @ngundotra, thanks for the confirmation. I am an auditor from Sec3. I noticed this when I was looking at the concurrency Merkle Tree for something else. Apologies if submitting a PR is not the best way to bring up such issues.

Basically, I found that the empty_node_cached is used directly without utilizing empty_node_cache in four places.

Two of them (in the initialize function) could use the cache and have already been addressed by a previous PR.

The remaining two instances are:

  • concurrent_merkle_tree.rs#L172: This does not involve loop calculations, so it doesn't need to use the cache and can be ignored.

  • concurrent_merkle_tree.rs#L277: This involves loop calculations and could potentially benefit from calculating the cache first before iterating. However, I think the overlaps are relatively small in most cases. The performance gain may not be that significant. Maybe this could also be ignored.

My last commit was trying to make cargo clippy happy. Thanks again for reviewing my changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants