-
Notifications
You must be signed in to change notification settings - Fork 1
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 Optimization: Pack struct in FeeSplitter.sol #146
Comments
I'm not sure I understand this, the code written in the recommendation is identical to the current code. Although it mentions |
I think the warden was suggesting using this struct, which would fit in 32 bytes and save 1 SLOAD each time a Shareholder struct is read. How he types 236 instead of 96 is anyone's guess, though.
|
@alcueca Thank you for pointing it out.
After:
|
Handle
gzeon
Vulnerability details
Impact
Shareholder
struct can be repacked to reduce 1 slot, since _sendFees is called on basically every interaction with the protocol the saving would be significant. (~3 SLOAD every interaction)Proof of Concept
https://github.com/code-423n4/2021-11-nested/blob/f646002b692ca5fa3631acfff87dda897541cf41/contracts/FeeSplitter.sol#L34
rewrite to
with casting whenever Shareholder.weight is used.
The text was updated successfully, but these errors were encountered: