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

Merkle Proof gas cost may be reduced in some cases. #3198

Closed
Cr0wn-Gh0ul opened this issue Feb 18, 2022 · 3 comments · Fixed by #3200
Closed

Merkle Proof gas cost may be reduced in some cases. #3198

Cr0wn-Gh0ul opened this issue Feb 18, 2022 · 3 comments · Fixed by #3200

Comments

@Cr0wn-Gh0ul
Copy link
Contributor

In the normal mode of operation a Merkle proof is passed into a contract by a external party. As such there is little benefit to copying the Merkle proof to memory before invoking _efficientHash. Therefore gas may be saved if in this case calldata is used instead of memory for the proof variable. Recommend either modifying the contract or offering a variant that utilizes calldata.

@frangio
Copy link
Contributor

frangio commented Feb 18, 2022

This is true. Feel free to send a PR.

Does Solidity allow functions of the same name where one has storage pointer argument and the other calldata pointer argument?

@BCLeFevre
Copy link

Looks like the original contract was written before 0.6.9 which allowed for using calldata within internal function calls. Most likely why memory is still being used in it's current iteration.

@Cr0wn-Gh0ul
Copy link
Contributor Author

@frangio Created a PR with this change. #3200

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 a pull request may close this issue.

3 participants