Skip to content

Commit

Permalink
⚡️ Optimize 0x00, 0x00 memory ops (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized authored Oct 6, 2023
1 parent 2ba1cc1 commit 9947394
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 87 deletions.
144 changes: 72 additions & 72 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Base64Test:testBase64EncodeToStringWithSinglePadding() (gas: 1636)
Base64Test:testBase64WordBoundary() (gas: 12511)
Base64Test:test__codesize() (gas: 7857)
CREATE3Test:testDeployERC20() (gas: 761674)
CREATE3Test:testDeployERC20(bytes32,string,string,uint8) (runs: 256, μ: 841479, ~: 853055)
CREATE3Test:testDeployERC20(bytes32,string,string,uint8) (runs: 256, μ: 842721, ~: 853055)
CREATE3Test:testDeployedUpperBitsSafeForPlainSolidity() (gas: 609)
CREATE3Test:testDoubleDeployDifferentBytecodeReverts() (gas: 96899273)
CREATE3Test:testDoubleDeployDifferentBytecodeReverts(bytes32,bytes,bytes) (runs: 256, μ: 96880132, ~: 96880005)
CREATE3Test:testDoubleDeployDifferentBytecodeReverts(bytes32,bytes,bytes) (runs: 256, μ: 96880127, ~: 96880005)
CREATE3Test:testDoubleDeploySameBytecodeReverts() (gas: 96889159)
CREATE3Test:testDoubleDeploySameBytecodeReverts(bytes32,bytes) (runs: 256, μ: 96881043, ~: 96881007)
CREATE3Test:testDoubleDeploySameBytecodeReverts(bytes32,bytes) (runs: 256, μ: 96881044, ~: 96881007)
CREATE3Test:test__codesize() (gas: 15308)
DateTimeLibTest:testAddSubDiffDays(uint256,uint256) (runs: 256, μ: 4034, ~: 4074)
DateTimeLibTest:testAddSubDiffHours(uint256,uint256) (runs: 256, μ: 3978, ~: 3932)
Expand Down Expand Up @@ -222,15 +222,15 @@ ERC2981Test:testSetAndGetRoyaltyInfo(uint256) (runs: 256, μ: 108118, ~: 104824)
ERC2981Test:test__codesize() (gas: 8419)
ERC4626Test:testDepositWithNoApprovalReverts() (gas: 16371)
ERC4626Test:testDepositWithNotEnoughApprovalReverts() (gas: 89884)
ERC4626Test:testDifferentialFullMulDiv(uint256,uint256,uint256) (runs: 256, μ: 3345, ~: 3311)
ERC4626Test:testDifferentialFullMulDiv(uint256,uint256,uint256) (runs: 256, μ: 3342, ~: 3201)
ERC4626Test:testMetadata() (gas: 15439)
ERC4626Test:testMintWithNoApprovalReverts() (gas: 16345)
ERC4626Test:testMintZero() (gas: 54317)
ERC4626Test:testMultipleMintDepositRedeemWithdraw() (gas: 425667)
ERC4626Test:testRedeemWithNoShareAmountReverts() (gas: 10918)
ERC4626Test:testRedeemWithNotEnoughShareAmountReverts() (gas: 142915)
ERC4626Test:testSingleDepositWithdraw(uint128) (runs: 256, μ: 202684, ~: 202694)
ERC4626Test:testSingleMintRedeem(uint128) (runs: 256, μ: 201605, ~: 201615)
ERC4626Test:testSingleDepositWithdraw(uint128) (runs: 256, μ: 202683, ~: 202694)
ERC4626Test:testSingleMintRedeem(uint128) (runs: 256, μ: 201604, ~: 201615)
ERC4626Test:testTryGetAssetDecimals() (gas: 30483816)
ERC4626Test:testUseVirtualShares() (gas: 2441768)
ERC4626Test:testVaultInteractionsForSomeoneElse() (gas: 296189)
Expand Down Expand Up @@ -271,54 +271,54 @@ ERC6909Test:testTransferFromInsufficientPermission() (gas: 88870)
ERC6909Test:testTransferInsufficientBalanceReverts() (gas: 56716)
ERC6909Test:testTransferInsufficientBalanceReverts(address,uint256,uint256,uint256) (runs: 256, μ: 55720, ~: 57203)
ERC6909Test:test__codesize() (gas: 24850)
ERC721HooksTest:testERC721Hooks() (gas: 2880090)
ERC721HooksTest:testERC721Hooks() (gas: 2879994)
ERC721HooksTest:test__codesize() (gas: 9716)
ERC721Test:testApprove(uint256) (runs: 256, μ: 108089, ~: 108078)
ERC721Test:testApproveAll(uint256) (runs: 256, μ: 47877, ~: 40312)
ERC721Test:testApproveBurn(uint256) (runs: 256, μ: 86740, ~: 86773)
ERC721Test:testApproveNonExistentReverts(uint256,address) (runs: 256, μ: 33673, ~: 33704)
ERC721Test:testApproveUnauthorizedReverts(uint256) (runs: 256, μ: 83276, ~: 82417)
ERC721Test:testApprove(uint256) (runs: 256, μ: 108098, ~: 108083)
ERC721Test:testApproveAll(uint256) (runs: 256, μ: 47634, ~: 40312)
ERC721Test:testApproveBurn(uint256) (runs: 256, μ: 86744, ~: 86771)
ERC721Test:testApproveNonExistentReverts(uint256,address) (runs: 256, μ: 33670, ~: 33704)
ERC721Test:testApproveUnauthorizedReverts(uint256) (runs: 256, μ: 83269, ~: 82407)
ERC721Test:testAuthorizedEquivalence(address,bool,bool) (runs: 256, μ: 751, ~: 756)
ERC721Test:testAux(uint256) (runs: 256, μ: 192106, ~: 193265)
ERC721Test:testBurn(uint256) (runs: 256, μ: 82993, ~: 94087)
ERC721Test:testAux(uint256) (runs: 256, μ: 192125, ~: 193261)
ERC721Test:testBurn(uint256) (runs: 256, μ: 83075, ~: 94084)
ERC721Test:testBurnNonExistentReverts(uint256) (runs: 256, μ: 10761, ~: 10761)
ERC721Test:testCannotExceedMaxBalance() (gas: 149880)
ERC721Test:testDoubleBurnReverts(uint256) (runs: 256, μ: 63483, ~: 63434)
ERC721Test:testDoubleMintReverts(uint256) (runs: 256, μ: 79140, ~: 79168)
ERC721Test:testEverything(uint256) (runs: 256, μ: 302230, ~: 302378)
ERC721Test:testExtraData(uint256) (runs: 256, μ: 99082, ~: 99129)
ERC721Test:testCannotExceedMaxBalance() (gas: 149876)
ERC721Test:testDoubleBurnReverts(uint256) (runs: 256, μ: 63489, ~: 63432)
ERC721Test:testDoubleMintReverts(uint256) (runs: 256, μ: 79136, ~: 79166)
ERC721Test:testEverything(uint256) (runs: 256, μ: 309065, ~: 302401)
ERC721Test:testExtraData(uint256) (runs: 256, μ: 99169, ~: 99247)
ERC721Test:testExtraData2(uint256,uint256) (runs: 256, μ: 54254, ~: 53903)
ERC721Test:testIsApprovedOrOwner(uint256) (runs: 256, μ: 135460, ~: 135448)
ERC721Test:testMint(uint256) (runs: 256, μ: 82886, ~: 82918)
ERC721Test:testIsApprovedOrOwner(uint256) (runs: 256, μ: 135454, ~: 135446)
ERC721Test:testMint(uint256) (runs: 256, μ: 82865, ~: 82799)
ERC721Test:testMintToZeroReverts(uint256) (runs: 256, μ: 8686, ~: 8686)
ERC721Test:testOwnerOfNonExistent(uint256) (runs: 256, μ: 33380, ~: 33338)
ERC721Test:testSafeMintToEOA(uint256) (runs: 256, μ: 83489, ~: 83514)
ERC721Test:testSafeMintToERC721Recipient(uint256) (runs: 256, μ: 408857, ~: 409972)
ERC721Test:testSafeMintToERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 473155, ~: 461733)
ERC721Test:testSafeMintToERC721RecipientWithWrongReturnData(uint256) (runs: 256, μ: 170009, ~: 170009)
ERC721Test:testSafeMintToERC721RecipientWithWrongReturnDataWithData(uint256,bytes) (runs: 256, μ: 171225, ~: 171172)
ERC721Test:testSafeMintToNonERC721RecipientReverts(uint256) (runs: 256, μ: 100471, ~: 100471)
ERC721Test:testSafeMintToNonERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 101719, ~: 101666)
ERC721Test:testSafeMintToRevertingERC721RecipientReverts(uint256) (runs: 256, μ: 202928, ~: 202928)
ERC721Test:testSafeMintToRevertingERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 204165, ~: 204112)
ERC721Test:testSafeTransferFromToEOA(uint256) (runs: 256, μ: 121967, ~: 122073)
ERC721Test:testSafeTransferFromToERC721Recipient(uint256) (runs: 256, μ: 470341, ~: 471476)
ERC721Test:testSafeTransferFromToERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 534664, ~: 523269)
ERC721Test:testSafeTransferFromToERC721RecipientWithWrongReturnDataReverts(uint256) (runs: 256, μ: 200859, ~: 200912)
ERC721Test:testSafeTransferFromToERC721RecipientWithWrongReturnDataWithDataReverts(uint256,bytes) (runs: 256, μ: 202125, ~: 202116)
ERC721Test:testSafeTransferFromToNonERC721RecipientReverts(uint256) (runs: 256, μ: 131261, ~: 131200)
ERC721Test:testSafeTransferFromToNonERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 132603, ~: 132601)
ERC721Test:testSafeTransferFromToRevertingERC721RecipientReverts(uint256) (runs: 256, μ: 233733, ~: 233787)
ERC721Test:testSafeTransferFromToRevertingERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 235065, ~: 235056)
ERC721Test:testOwnerOfNonExistent(uint256) (runs: 256, μ: 33389, ~: 33338)
ERC721Test:testSafeMintToEOA(uint256) (runs: 256, μ: 83474, ~: 83516)
ERC721Test:testSafeMintToERC721Recipient(uint256) (runs: 256, μ: 408858, ~: 409971)
ERC721Test:testSafeMintToERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 473158, ~: 461740)
ERC721Test:testSafeMintToERC721RecipientWithWrongReturnData(uint256) (runs: 256, μ: 170008, ~: 170008)
ERC721Test:testSafeMintToERC721RecipientWithWrongReturnDataWithData(uint256,bytes) (runs: 256, μ: 171224, ~: 171171)
ERC721Test:testSafeMintToNonERC721RecipientReverts(uint256) (runs: 256, μ: 100470, ~: 100470)
ERC721Test:testSafeMintToNonERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 101718, ~: 101665)
ERC721Test:testSafeMintToRevertingERC721RecipientReverts(uint256) (runs: 256, μ: 202927, ~: 202927)
ERC721Test:testSafeMintToRevertingERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 204164, ~: 204111)
ERC721Test:testSafeTransferFromToEOA(uint256) (runs: 256, μ: 121991, ~: 122085)
ERC721Test:testSafeTransferFromToERC721Recipient(uint256) (runs: 256, μ: 470363, ~: 471474)
ERC721Test:testSafeTransferFromToERC721RecipientWithData(uint256,bytes) (runs: 256, μ: 534689, ~: 523335)
ERC721Test:testSafeTransferFromToERC721RecipientWithWrongReturnDataReverts(uint256) (runs: 256, μ: 200852, ~: 200908)
ERC721Test:testSafeTransferFromToERC721RecipientWithWrongReturnDataWithDataReverts(uint256,bytes) (runs: 256, μ: 202120, ~: 202110)
ERC721Test:testSafeTransferFromToNonERC721RecipientReverts(uint256) (runs: 256, μ: 131253, ~: 131198)
ERC721Test:testSafeTransferFromToNonERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 132605, ~: 132599)
ERC721Test:testSafeTransferFromToRevertingERC721RecipientReverts(uint256) (runs: 256, μ: 233719, ~: 233652)
ERC721Test:testSafeTransferFromToRevertingERC721RecipientWithDataReverts(uint256,bytes) (runs: 256, μ: 235065, ~: 235060)
ERC721Test:testSafetyOfCustomStorage(uint256,uint256) (runs: 256, μ: 1063, ~: 713)
ERC721Test:testTransferFrom() (gas: 85746)
ERC721Test:testTransferFrom(uint256) (runs: 256, μ: 113763, ~: 112513)
ERC721Test:testTransferFromApproveAll(uint256) (runs: 256, μ: 119347, ~: 119322)
ERC721Test:testTransferFromNotExistentReverts(address,address,uint256) (runs: 256, μ: 34011, ~: 33992)
ERC721Test:testTransferFromNotOwner(uint256) (runs: 256, μ: 84732, ~: 84692)
ERC721Test:testTransferFromSelf(uint256) (runs: 256, μ: 92783, ~: 92768)
ERC721Test:testTransferFromToZeroReverts(uint256) (runs: 256, μ: 79048, ~: 79024)
ERC721Test:testTransferFromWrongFromReverts(address,uint256) (runs: 256, μ: 80454, ~: 80432)
ERC721Test:testTransferFrom() (gas: 85744)
ERC721Test:testTransferFrom(uint256) (runs: 256, μ: 114230, ~: 112511)
ERC721Test:testTransferFromApproveAll(uint256) (runs: 256, μ: 119350, ~: 119335)
ERC721Test:testTransferFromNotExistentReverts(address,address,uint256) (runs: 256, μ: 34012, ~: 33992)
ERC721Test:testTransferFromNotOwner(uint256) (runs: 256, μ: 84710, ~: 84691)
ERC721Test:testTransferFromSelf(uint256) (runs: 256, μ: 92763, ~: 92755)
ERC721Test:testTransferFromToZeroReverts(uint256) (runs: 256, μ: 79043, ~: 79023)
ERC721Test:testTransferFromWrongFromReverts(address,uint256) (runs: 256, μ: 80444, ~: 80423)
ERC721Test:test__codesize() (gas: 41971)
FixedPointMathLibTest:testAbs() (gas: 578)
FixedPointMathLibTest:testAbs(int256) (runs: 256, μ: 516, ~: 485)
Expand Down Expand Up @@ -502,7 +502,7 @@ LibCloneTest:testCloneDeterministicRevertsIfAddressAlreadyUsed() (gas: 96882825)
LibCloneTest:testCloneWithImmutableArgs() (gas: 120581)
LibCloneTest:testCloneWithImmutableArgs(uint256,address,uint256,uint256[],uint64,uint8) (runs: 256, μ: 981643, ~: 970078)
LibCloneTest:testCloneWithImmutableArgsRevertsIfDataTooBig() (gas: 97305784)
LibCloneTest:testStartsWithCaller(uint256) (runs: 256, μ: 28143, ~: 28382)
LibCloneTest:testStartsWithCaller(uint256) (runs: 256, μ: 28152, ~: 28382)
LibCloneTest:test__codesize() (gas: 15743)
LibMapTest:testFoundStatementDifferential(uint256,uint256,uint256) (runs: 256, μ: 499, ~: 499)
LibMapTest:testGeneralMapFunctionsGas() (gas: 3304775)
Expand Down Expand Up @@ -706,17 +706,17 @@ LibStringTest:testToStringZeroBrutalized() (gas: 613803)
LibStringTest:testToStringZeroRightPadded(uint256) (runs: 256, μ: 718269, ~: 613726)
LibStringTest:test__codesize() (gas: 40236)
LibZipTest:testCdCompress() (gas: 166411)
LibZipTest:testCdCompressDecompress(bytes) (runs: 256, μ: 722800, ~: 649175)
LibZipTest:testCdCompressDecompress(uint256) (runs: 256, μ: 807945, ~: 706715)
LibZipTest:testCdCompressDecompress(bytes) (runs: 256, μ: 728307, ~: 648421)
LibZipTest:testCdCompressDecompress(uint256) (runs: 256, μ: 812673, ~: 710419)
LibZipTest:testCdDecompressOnInvalidInput() (gas: 34920)
LibZipTest:testCdFallback() (gas: 5684261)
LibZipTest:testCdFallback(bytes,uint256) (runs: 256, μ: 1171418, ~: 1042933)
LibZipTest:testCdFallbackDecompressor(bytes) (runs: 256, μ: 121281, ~: 117409)
LibZipTest:testCdFallbackDecompressor(uint256) (runs: 256, μ: 167097, ~: 158005)
LibZipTest:testCdFallback() (gas: 5684253)
LibZipTest:testCdFallback(bytes,uint256) (runs: 256, μ: 1226089, ~: 1043747)
LibZipTest:testCdFallbackDecompressor(bytes) (runs: 256, μ: 121253, ~: 117213)
LibZipTest:testCdFallbackDecompressor(uint256) (runs: 256, μ: 168196, ~: 154885)
LibZipTest:testCdFallbackMaskTrick(uint256,uint256) (runs: 256, μ: 688, ~: 663)
LibZipTest:testDecompressWontRevert(bytes) (runs: 256, μ: 721196, ~: 629282)
LibZipTest:testDecompressWontRevert(bytes) (runs: 256, μ: 714186, ~: 629478)
LibZipTest:testFlzCompressDecompress() (gas: 2161289)
LibZipTest:testFlzCompressDecompress(bytes) (runs: 256, μ: 880547, ~: 684545)
LibZipTest:testFlzCompressDecompress(bytes) (runs: 256, μ: 839698, ~: 683883)
LibZipTest:testFlzCompressDecompress2() (gas: 1013575)
LibZipTest:test__codesize() (gas: 21730)
MerkleProofLibTest:testEmptyCalldataHelpers() (gas: 1086)
Expand Down Expand Up @@ -749,16 +749,16 @@ MinHeapLibTest:testHeapPushPop(uint256) (runs: 256, μ: 243412, ~: 253482)
MinHeapLibTest:testHeapReplace(uint256) (runs: 256, μ: 303543, ~: 309851)
MinHeapLibTest:testHeapRoot(uint256) (runs: 256, μ: 5232, ~: 5232)
MinHeapLibTest:test__codesize() (gas: 5404)
MulticallableTest:testMulticallableBenchmark() (gas: 29598)
MulticallableTest:testMulticallableBenchmark() (gas: 29588)
MulticallableTest:testMulticallableOriginalBenchmark() (gas: 38849)
MulticallableTest:testMulticallablePreservesMsgSender() (gas: 11194)
MulticallableTest:testMulticallableReturnDataIsProperlyEncoded() (gas: 11669)
MulticallableTest:testMulticallableReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 9906, ~: 7483)
MulticallableTest:testMulticallableReturnDataIsProperlyEncoded(uint256,uint256,uint256,uint256) (runs: 256, μ: 11815, ~: 11815)
MulticallableTest:testMulticallableRevertWithCustomError() (gas: 11842)
MulticallableTest:testMulticallableRevertWithMessage() (gas: 13514)
MulticallableTest:testMulticallableRevertWithMessage(string) (runs: 256, μ: 14239, ~: 14269)
MulticallableTest:testMulticallableRevertWithNothing() (gas: 11731)
MulticallableTest:testMulticallablePreservesMsgSender() (gas: 11193)
MulticallableTest:testMulticallableReturnDataIsProperlyEncoded() (gas: 11667)
MulticallableTest:testMulticallableReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 9976, ~: 12012)
MulticallableTest:testMulticallableReturnDataIsProperlyEncoded(uint256,uint256,uint256,uint256) (runs: 256, μ: 11813, ~: 11813)
MulticallableTest:testMulticallableRevertWithCustomError() (gas: 11841)
MulticallableTest:testMulticallableRevertWithMessage() (gas: 13513)
MulticallableTest:testMulticallableRevertWithMessage(string) (runs: 256, μ: 14236, ~: 14268)
MulticallableTest:testMulticallableRevertWithNothing() (gas: 11730)
MulticallableTest:testMulticallableWithNoData() (gas: 6322)
MulticallableTest:test__codesize() (gas: 9792)
OwnableRolesTest:testBytecodeSize() (gas: 350635)
Expand Down Expand Up @@ -863,8 +863,8 @@ SafeTransferLibTest:testApproveWithMissingReturn(address,uint256) (runs: 256, μ
SafeTransferLibTest:testApproveWithNonContract() (gas: 2989)
SafeTransferLibTest:testApproveWithNonContract(address,address,uint256) (runs: 256, μ: 3523, ~: 3536)
SafeTransferLibTest:testApproveWithNonGarbage(address,uint256) (runs: 256, μ: 77983, ~: 59187)
SafeTransferLibTest:testApproveWithRetry() (gas: 768380)
SafeTransferLibTest:testApproveWithRetry(address,uint256,uint256) (runs: 256, μ: 766714, ~: 768524)
SafeTransferLibTest:testApproveWithRetry() (gas: 768379)
SafeTransferLibTest:testApproveWithRetry(address,uint256,uint256) (runs: 256, μ: 766713, ~: 768523)
SafeTransferLibTest:testApproveWithRetryWithNonContract() (gas: 2990)
SafeTransferLibTest:testApproveWithRetryWithNonContract(address,address,uint256) (runs: 256, μ: 3520, ~: 3533)
SafeTransferLibTest:testApproveWithReturnsFalseReverts() (gas: 9515)
Expand Down Expand Up @@ -948,15 +948,15 @@ SignatureCheckerLibTest:testSignatureCheckerOnWalletWithZeroAddressSigner() (gas
SignatureCheckerLibTest:test__codesize() (gas: 9769)
SoladyTest:test__codesize() (gas: 1102)
TestPlus:test__codesize() (gas: 406)
WETHInvariants:invariantTotalSupplyEqualsBalance() (runs: 256, calls: 3840, reverts: 1831)
WETHInvariants:invariantTotalSupplyEqualsBalance() (runs: 256, calls: 3840, reverts: 1806)
WETHInvariants:test__codesize() (gas: 6007)
WETHTest:testDeposit() (gas: 68090)
WETHTest:testDeposit(uint256) (runs: 256, μ: 65903, ~: 68384)
WETHTest:testDeposit(uint256) (runs: 256, μ: 65720, ~: 68384)
WETHTest:testFallbackDeposit() (gas: 67796)
WETHTest:testFallbackDeposit(uint256) (runs: 256, μ: 65564, ~: 68045)
WETHTest:testFallbackDeposit(uint256) (runs: 256, μ: 65381, ~: 68045)
WETHTest:testMetadata() (gas: 10098)
WETHTest:testPartialWithdraw() (gas: 79566)
WETHTest:testWithdraw() (gas: 59332)
WETHTest:testWithdraw(uint256,uint256) (runs: 256, μ: 76905, ~: 80326)
WETHTest:testWithdraw(uint256,uint256) (runs: 256, μ: 76726, ~: 80326)
WETHTest:testWithdrawToContractWithoutReceiveReverts() (gas: 93923)
WETHTest:test__codesize() (gas: 11079)
15 changes: 7 additions & 8 deletions src/tokens/ERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,8 @@ abstract contract ERC721 {
sstore(keccak256(0x0c, 0x30), isApproved)
// Emit the {ApprovalForAll} event.
mstore(0x00, isApproved)
log3(
0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))
)
// forgefmt: disable-next-item
log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))
}
}

Expand Down Expand Up @@ -311,7 +310,7 @@ abstract contract ERC721 {
sstore(toBalanceSlot, toBalanceSlotPacked)
}
// Emit the {Transfer} event.
log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
}
_afterTokenTransfer(from, to, id);
}
Expand Down Expand Up @@ -486,7 +485,7 @@ abstract contract ERC721 {
sstore(balanceSlot, balanceSlotPacked)
}
// Emit the {Transfer} event.
log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id)
log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id)
}
_afterTokenTransfer(address(0), to, id);
}
Expand Down Expand Up @@ -571,7 +570,7 @@ abstract contract ERC721 {
sstore(balanceSlot, sub(sload(balanceSlot), 1))
}
// Emit the {Transfer} event.
log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id)
log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id)
}
_afterTokenTransfer(owner, address(0), id);
}
Expand Down Expand Up @@ -668,7 +667,7 @@ abstract contract ERC721 {
// Sets `account` as the approved account to manage `id`.
sstore(add(1, ownershipSlot), account)
// Emit the {Approval} event.
log4(0x00, 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id)
log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id)
}
}

Expand Down Expand Up @@ -777,7 +776,7 @@ abstract contract ERC721 {
sstore(toBalanceSlot, toBalanceSlotPacked)
}
// Emit the {Transfer} event.
log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
}
_afterTokenTransfer(from, to, id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/LibZip.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ library LibZip {
mstore8(o, c)
o := add(o, 1)
}
let success := delegatecall(gas(), address(), 0x00, o, 0x00, 0x00)
let success := delegatecall(gas(), address(), 0x00, o, codesize(), 0x00)
returndatacopy(0x00, 0x00, returndatasize())
if iszero(success) { revert(0x00, returndatasize()) }
return(0x00, returndatasize())
Expand Down
Loading

0 comments on commit 9947394

Please sign in to comment.