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(protocol): reduce gas cost by skipping reading storage for delegates() #17487

Merged
merged 4 commits into from
Jun 6, 2024

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Jun 5, 2024

Screenshot 2024-06-05 at 16 42 46

As you can see from the image above, for everyone TAIKO transfer, this function is always called:

Screenshot 2024-06-05 at 16 43 48

Reading delegates(from) and delegates(to) cost 2100 each, which sucks. This PR make sure delegates always return 0 for two special address: TaikoL1 and ERC20Vault to reduce gas cost, as these addresses never delegate.

A better but my trouble "fix" is to wrap TAIKO into a BOND token which is a pure ERC20 token for bonds.

@dantaik dantaik closed this Jun 5, 2024
@dantaik dantaik reopened this Jun 5, 2024
Copy link

openzeppelin-code bot commented Jun 5, 2024

feat(protocol): reduce gas cost by skipping reading storage for delegates()

Generated at commit: c71ec0e620f8632377eb5ab76c2a3ed67f71d981

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
2
2
0
8
42
54
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@dantaik dantaik changed the title Special delegates address feat(protocol): reduce gas cost by skipping reading storage for delegates() Jun 5, 2024
@dantaik dantaik requested a review from Brechtpd June 5, 2024 09:08
@dantaik dantaik marked this pull request as ready for review June 5, 2024 09:08
Copy link
Contributor

@adaki2004 adaki2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beside my comment, LGTM.

@dantaik dantaik added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit f58d22f Jun 6, 2024
4 checks passed
@dantaik dantaik deleted the special_delegates_address branch June 6, 2024 06:30
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 this pull request may close these issues.

4 participants