You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Save 1.7k gas on a key purchase when there's no discount, and 3.2k gas when discounts are added. A minor improvement, but this also seems easier to follow in trace logs or with a tool like Tenderly.
Proof of Concept
In the PublicLock purchase remove the calls to _purchasePriceFor and recordKeyPurchase and replace it with uint inMemoryKeyPrice = _purchase(_recipient, _referrer, _data); which was implemented as:
Handle
HardlyDifficult
Vulnerability details
Impact
Save 1.7k gas on a key purchase when there's no discount, and 3.2k gas when discounts are added. A minor improvement, but this also seems easier to follow in trace logs or with a tool like Tenderly.
Proof of Concept
In the PublicLock
purchase
remove the calls to_purchasePriceFor
andrecordKeyPurchase
and replace it withuint inMemoryKeyPrice = _purchase(_recipient, _referrer, _data);
which was implemented as:Then in Unlock, add a new function:
This approach clones the current behavior, but moves logic into Unlock instead of going back and forth between PublicLock and Unlock.
Tools Used
yarn test
and diff the gas reporter table.Recommended Mitigation Steps
The text was updated successfully, but these errors were encountered: