-
Notifications
You must be signed in to change notification settings - Fork 38
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
Gas Optimizations: PR #1 (closed #209 to include changes in this one) #213
Open
Antony-SS
wants to merge
12
commits into
EYBlockchain:master
Choose a base branch
from
Antony-SS:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Antony-SS
commented
Jul 14, 2023
uint public treeWidth = 2 ** treeHeight; | ||
uint public constant zero = 0; | ||
uint public constant treeHeight = 32; | ||
uint public constant treeWidth = uint64(2 ** treeHeight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reject the change to cast to a uint64. Accidentally left this in from when I was testing treeWidth as a uint64. Make sure to keep it as a constant though.
MirandaWood
approved these changes
Jul 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes are limited to Verifier.sol, Pairing.sol, MiMC.sol, and MerkleTree.sol
I took advantage of the following methods for gas saving:
indexed
to event with value types. Small trick that is slightly more gas efficientunchecked
to increment variables in for loops where we know they won't overflow. This saves the EVM from having to do overflow checks everytime it increments.For specifics on the gas savings see this Notion Doc: https://antony-ss.notion.site/Antony-s-Starlight-Gas-Investigation-PR-1-4ee119fe89d24e56b41f3cc87d9b686d?pvs=4
There are some changes to the .gitignore b/c I added a test-contracts folder with all the contracts I was testing. You can choose whether or not to include this in the PR.
Addtionally, in order to get Starlight to run on my computer I had to update my "https://github.com/types" dependency, which is reflected in the changes. I would reccomend including this change.