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

fix(Stamp): Gas golfing #174

Merged
merged 24 commits into from
Sep 24, 2023
Merged

fix(Stamp): Gas golfing #174

merged 24 commits into from
Sep 24, 2023

Conversation

0xCardinalError
Copy link
Contributor

@0xCardinalError 0xCardinalError commented Aug 8, 2023

improv.txt
gas-report.txt
Optimization of PostageStamp contract for less gas usage.

Added improv diff that shows improvements on most counts with Stamp and final gas report.

@0xCardinalError 0xCardinalError changed the title fix(Stamp): Gas golf stamp fix(Stamp): Gas golfing Aug 21, 2023
Copy link

@mfw78 mfw78 left a comment

Choose a reason for hiding this comment

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

Great gas golfing, but approach with caution: NethermindEth/nethermind#6024

@0xCardinalError
Copy link
Contributor Author

Great gas golfing, but approach with caution: NethermindEth/nethermind#6024

thnx on this info, good to know. hopefully they resolve this fully.

Copy link
Member

@nugaon nugaon left a comment

Choose a reason for hiding this comment

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

Overall, great refactor : )

src/PostageStamp.sol Outdated Show resolved Hide resolved
src/PostageStamp.sol Outdated Show resolved Hide resolved
Copy link
Member

@nugaon nugaon left a comment

Choose a reason for hiding this comment

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

LGTM


// Price from the last update.
uint256 public lastPrice = 0;
uint64 public lastPrice;
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't narrow this variable that much, who knows!

lastPrice = _price;
lastUpdatedBlock = block.number;
lastPrice = uint64(_price);
lastUpdatedBlock = uint64(block.number);

emit PriceUpdate(_price);
}

function setMinimumValidityBlocks(uint256 _value) external {
Copy link
Member

Choose a reason for hiding this comment

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

why not change the parameter as well?

@zelig zelig merged commit 7940be1 into master Sep 24, 2023
2 checks passed
@zelig zelig deleted the gas_golf_stamp branch September 24, 2023 15:48
@0xCardinalError 0xCardinalError restored the gas_golf_stamp branch October 3, 2023 14:53
@0xCardinalError
Copy link
Contributor Author

was overriden in some merge, changes are not in master, will need to reapply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants