-
Notifications
You must be signed in to change notification settings - Fork 7
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
rc-v1.0.1-stable proposed bytecode optimization to merge into stable branch #91
Changes from all commits
e0068f3
18d1a93
860d147
aaa8a77
6aa0d26
1df59ba
3f4c818
cd41718
f90e509
3033b22
a7136aa
c141b46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CirclesTest:testCalculateIssuance() (gas: 3729002) | ||
CirclesTest:testConsecutiveClaimablePeriods() (gas: 375082) | ||
CirclesTest:testDemurragedTransfer() (gas: 229055) | ||
CompositeMintGroupsTest:testCompositeGroupMint() (gas: 212459) | ||
DemurrageTest:testDemurrageFactor() (gas: 79139) | ||
DemurrageTest:testFuzzStablePointIssuance(int192) (runs: 256, μ: 63114, ~: 63250) | ||
DemurrageTest:testInversionGammaBeta64x64_100years() (gas: 958541) | ||
DemurrageTest:testInversionGammaBeta64x64_100years_withExtension() (gas: 1083080) | ||
DemurrageTest:testInversionGammaBeta64x64_100years_withExtension_comparison() (gas: 1703713) | ||
DemurrageTest:testInversionGammaBeta64x64_20years() (gas: 221562) | ||
DemurrageTest:testRepeatedDemurrage() (gas: 15264702) | ||
ERC20LiftTest:testERC20Demurrage() (gas: 133270) | ||
ERC20LiftTest:testERC20Wrap() (gas: 954629) | ||
ERC20LiftTest:testWrapAndUnwrapInflationaryERC20() (gas: 89881) | ||
GroupMintTest:testRegisterGroup() (gas: 165153) | ||
HubPathTransferTest:testOperateFlowMatrixConsentedFlow() (gas: 265369) | ||
MigrationTest:testConversionMigrationV1ToTimeCircles() (gas: 18365) | ||
MintGroupCirclesTest:testDirectSelfGroupMintFails() (gas: 341135) | ||
MintGroupCirclesTest:testGroupMint() (gas: 340165) | ||
MintGroupCirclesTest:testGroupMintFail() (gas: 23302) | ||
MintGroupCirclesTest:testGroupMintMany() (gas: 858065) | ||
MintGroupCirclesTest:testGroupMintMultiCollateral() (gas: 755126) | ||
MintGroupCirclesTest:testSequentialGroupMint() (gas: 511760) | ||
NamesTest:testBase58Conversion() (gas: 78904) | ||
NamesTest:testCustomName() (gas: 40809) | ||
NamesTest:testInvalidCustomNames() (gas: 20017) | ||
NamesTest:testMetadataDigest() (gas: 35073) | ||
NamesTest:testShortName() (gas: 102230) | ||
NamesTest:testShortNameWithNonce() (gas: 73360) | ||
NamesTest:testShortNameWithPadding() (gas: 71662) | ||
V1MintStatusUpdateTest:testMigrationFromV1DuringBootstrap() (gas: 2542748) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ out/ | |
# docs | ||
|
||
|
||
# gas snapshot files | ||
.gas-snapshot | ||
|
||
# Ignores development broadcast logs | ||
!/broadcast | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,10 +114,7 @@ abstract contract ERC1155 is DiscountedBalances, Context, ERC165, IERC1155, IERC | |
* @dev See {IERC1155-safeTransferFrom}. | ||
*/ | ||
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes memory _data) public { | ||
address sender = _msgSender(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as mentioned before, I tried to not update this forked contract from open zepellin unless where functionally needed. that said, sure this seems like a fair readability improvement. It would be good to have measurements in place in CI so we can see whether this increases or reduces different metrics. I don't want to walk blind for optimisations |
||
if (_from != sender && !isApprovedForAll(_from, sender)) { | ||
revert ERC1155MissingApprovalForAll(sender, _from); | ||
} | ||
_allowanceCheck(_from); | ||
_safeTransferFrom(_from, _to, _id, _value, _data); | ||
} | ||
|
||
|
@@ -131,10 +128,7 @@ abstract contract ERC1155 is DiscountedBalances, Context, ERC165, IERC1155, IERC | |
uint256[] memory _values, | ||
bytes memory _data | ||
) public virtual { | ||
address sender = _msgSender(); | ||
if (_from != sender && !isApprovedForAll(_from, sender)) { | ||
revert ERC1155MissingApprovalForAll(sender, _from); | ||
} | ||
_allowanceCheck(_from); | ||
_safeBatchTransferFrom(_from, _to, _ids, _values, _data); | ||
} | ||
|
||
|
@@ -216,6 +210,16 @@ abstract contract ERC1155 is DiscountedBalances, Context, ERC165, IERC1155, IERC | |
_acceptanceCheck(from, to, ids, values, data); | ||
} | ||
|
||
/** | ||
* @dev do the ERC1155 token the sender allowance check | ||
*/ | ||
function _allowanceCheck(address _from) internal view { | ||
address sender = _msgSender(); | ||
if (_from != sender && !isApprovedForAll(_from, sender)) { | ||
revert ERC1155MissingApprovalForAll(sender, _from); | ||
} | ||
} | ||
|
||
/** | ||
* @dev do the ERC1155 token acceptance check to the receiver | ||
*/ | ||
|
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.
this is possibly an improvement, but as mentioned some of these changes were done on recommendation of reviewers. so my general comment holds, i would like to start measuring explicitly to see what is an optimisation in numbers