Skip to content

Commit

Permalink
⚡️ Minor optimizations (Vectorized#56)
Browse files Browse the repository at this point in the history
* Minor optimizations and variable renamings

* Rearrange fallback function ordering

* Optimize ERC20 events

* Optimize Mirror bytecode size

* Optimize
  • Loading branch information
Vectorized authored Feb 14, 2024
1 parent 34de35c commit e392346
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 306 deletions.
186 changes: 93 additions & 93 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
BaseInvariantTest:invariantDN404BalanceSum() (runs: 30, calls: 450, reverts: 0)
BaseInvariantTest:invariantMirror721BalanceSum() (runs: 30, calls: 450, reverts: 0)
BenchTest:testMintAndTransferDN404_01() (gas: 211467)
BenchTest:testMintAndTransferDN404_02() (gas: 244745)
BenchTest:testMintAndTransferDN404_03() (gas: 236183)
BenchTest:testMintAndTransferDN404_04() (gas: 269465)
BenchTest:testMintAndTransferDN404_05() (gas: 280824)
BenchTest:testMintAndTransferDN404_06() (gas: 314061)
BenchTest:testMintAndTransferDN404_07() (gas: 305512)
BenchTest:testMintAndTransferDN404_08() (gas: 338803)
BenchTest:testMintAndTransferDN404_09() (gas: 393918)
BenchTest:testMintAndTransferDN404_10() (gas: 427156)
BenchTest:testMintAndTransferDN404_11() (gas: 418637)
BenchTest:testMintAndTransferDN404_12() (gas: 451940)
BenchTest:testMintAndTransferDN404_13() (gas: 463255)
BenchTest:testMintAndTransferDN404_14() (gas: 496514)
BenchTest:testMintAndTransferDN404_15() (gas: 487953)
BenchTest:testMintAndTransferDN404_16() (gas: 521256)
BenchTest:testMintAndTransferDN404_01() (gas: 211356)
BenchTest:testMintAndTransferDN404_02() (gas: 244623)
BenchTest:testMintAndTransferDN404_03() (gas: 236050)
BenchTest:testMintAndTransferDN404_04() (gas: 269321)
BenchTest:testMintAndTransferDN404_05() (gas: 280669)
BenchTest:testMintAndTransferDN404_06() (gas: 313895)
BenchTest:testMintAndTransferDN404_07() (gas: 305335)
BenchTest:testMintAndTransferDN404_08() (gas: 338615)
BenchTest:testMintAndTransferDN404_09() (gas: 393719)
BenchTest:testMintAndTransferDN404_10() (gas: 426946)
BenchTest:testMintAndTransferDN404_11() (gas: 418416)
BenchTest:testMintAndTransferDN404_12() (gas: 451708)
BenchTest:testMintAndTransferDN404_13() (gas: 463012)
BenchTest:testMintAndTransferDN404_14() (gas: 496260)
BenchTest:testMintAndTransferDN404_15() (gas: 487688)
BenchTest:testMintAndTransferDN404_16() (gas: 520980)
BenchTest:testMintAndTransferPandora_01() (gas: 190491)
BenchTest:testMintAndTransferPandora_02() (gas: 306372)
BenchTest:testMintAndTransferPandora_03() (gas: 422256)
Expand All @@ -32,22 +32,22 @@ BenchTest:testMintAndTransferPandora_13() (gas: 1581274)
BenchTest:testMintAndTransferPandora_14() (gas: 1697190)
BenchTest:testMintAndTransferPandora_15() (gas: 1813056)
BenchTest:testMintAndTransferPandora_16() (gas: 1929009)
BenchTest:testMintDN404_01() (gas: 122943)
BenchTest:testMintDN404_02() (gas: 126123)
BenchTest:testMintDN404_03() (gas: 129263)
BenchTest:testMintDN404_04() (gas: 154390)
BenchTest:testMintDN404_05() (gas: 157571)
BenchTest:testMintDN404_06() (gas: 160689)
BenchTest:testMintDN404_07() (gas: 163940)
BenchTest:testMintDN404_08() (gas: 188978)
BenchTest:testMintDN404_09() (gas: 214083)
BenchTest:testMintDN404_10() (gas: 217246)
BenchTest:testMintDN404_11() (gas: 220427)
BenchTest:testMintDN404_12() (gas: 245511)
BenchTest:testMintDN404_13() (gas: 248694)
BenchTest:testMintDN404_14() (gas: 251855)
BenchTest:testMintDN404_15() (gas: 255079)
BenchTest:testMintDN404_16() (gas: 280142)
BenchTest:testMintDN404_01() (gas: 122878)
BenchTest:testMintDN404_02() (gas: 126043)
BenchTest:testMintDN404_03() (gas: 129168)
BenchTest:testMintDN404_04() (gas: 154280)
BenchTest:testMintDN404_05() (gas: 157446)
BenchTest:testMintDN404_06() (gas: 160549)
BenchTest:testMintDN404_07() (gas: 163785)
BenchTest:testMintDN404_08() (gas: 188808)
BenchTest:testMintDN404_09() (gas: 213898)
BenchTest:testMintDN404_10() (gas: 217046)
BenchTest:testMintDN404_11() (gas: 220212)
BenchTest:testMintDN404_12() (gas: 245281)
BenchTest:testMintDN404_13() (gas: 248449)
BenchTest:testMintDN404_14() (gas: 251595)
BenchTest:testMintDN404_15() (gas: 254804)
BenchTest:testMintDN404_16() (gas: 279852)
BenchTest:testMintPandora_01() (gas: 133912)
BenchTest:testMintPandora_02() (gas: 203416)
BenchTest:testMintPandora_03() (gas: 272897)
Expand All @@ -64,74 +64,74 @@ BenchTest:testMintPandora_13() (gas: 967960)
BenchTest:testMintPandora_14() (gas: 1037484)
BenchTest:testMintPandora_15() (gas: 1106967)
BenchTest:testMintPandora_16() (gas: 1176473)
BenchTest:test__codesize() (gas: 29748)
DN404MirrorTest:testBaseERC20() (gas: 114669)
BenchTest:test__codesize() (gas: 29292)
DN404MirrorTest:testBaseERC20() (gas: 114600)
DN404MirrorTest:testLinkMirrorContract() (gas: 45829)
DN404MirrorTest:testLogTransfer() (gas: 120761)
DN404MirrorTest:testNameAndSymbol(string,string) (runs: 256, μ: 207635, ~: 207978)
DN404MirrorTest:testNotLinked() (gas: 12743)
DN404MirrorTest:testPullOwner() (gas: 112507)
DN404MirrorTest:testPullOwnerWithOwnable() (gas: 2374526)
DN404MirrorTest:testSafeTransferFrom(uint32) (runs: 256, μ: 467745, ~: 467738)
DN404MirrorTest:testSetAndGetApprovalForAll() (gas: 325072)
DN404MirrorTest:testSetAndGetApproved() (gas: 318371)
DN404MirrorTest:testLogTransfer() (gas: 120692)
DN404MirrorTest:testNameAndSymbol(string,string) (runs: 256, μ: 207680, ~: 208023)
DN404MirrorTest:testNotLinked() (gas: 12767)
DN404MirrorTest:testPullOwner() (gas: 112438)
DN404MirrorTest:testPullOwnerWithOwnable() (gas: 2331554)
DN404MirrorTest:testSafeTransferFrom(uint32) (runs: 256, μ: 467428, ~: 467420)
DN404MirrorTest:testSetAndGetApprovalForAll() (gas: 324880)
DN404MirrorTest:testSetAndGetApproved() (gas: 318156)
DN404MirrorTest:testSupportsInterface() (gas: 7566)
DN404MirrorTest:testTokenURI(string,uint256) (runs: 256, μ: 158193, ~: 135892)
DN404MirrorTest:testTransferFrom(uint32) (runs: 256, μ: 342652, ~: 342643)
DN404MirrorTest:test__codesize() (gas: 42413)
DN404OnlyERC20Test:testApprove() (gas: 35966)
DN404OnlyERC20Test:testApprove(address,uint256) (runs: 256, μ: 30273, ~: 31517)
DN404OnlyERC20Test:testBurn() (gas: 49697)
DN404OnlyERC20Test:testBurn(address,uint256,uint256) (runs: 256, μ: 50767, ~: 50898)
DN404OnlyERC20Test:testBurnInsufficientBalanceReverts(address,uint256,uint256) (runs: 256, μ: 43858, ~: 43852)
DN404OnlyERC20Test:testInfiniteApproveTransferFrom() (gas: 101981)
DN404MirrorTest:testTokenURI(string,uint256) (runs: 256, μ: 158169, ~: 135868)
DN404MirrorTest:testTransferFrom(uint32) (runs: 256, μ: 342548, ~: 342541)
DN404MirrorTest:test__codesize() (gas: 41743)
DN404OnlyERC20Test:testApprove() (gas: 35902)
DN404OnlyERC20Test:testApprove(address,uint256) (runs: 256, μ: 30209, ~: 31453)
DN404OnlyERC20Test:testBurn() (gas: 49596)
DN404OnlyERC20Test:testBurn(address,uint256,uint256) (runs: 256, μ: 50749, ~: 50797)
DN404OnlyERC20Test:testBurnInsufficientBalanceReverts(address,uint256,uint256) (runs: 256, μ: 43695, ~: 43790)
DN404OnlyERC20Test:testInfiniteApproveTransferFrom() (gas: 101807)
DN404OnlyERC20Test:testMaxSupplyTrick(uint256) (runs: 256, μ: 541, ~: 541)
DN404OnlyERC20Test:testMetadata() (gas: 10111)
DN404OnlyERC20Test:testMint() (gas: 45272)
DN404OnlyERC20Test:testMintOverMaxLimitReverts() (gas: 40508)
DN404OnlyERC20Test:testMintz(address,uint256) (runs: 256, μ: 45582, ~: 45694)
DN404OnlyERC20Test:testTransfer() (gas: 74472)
DN404OnlyERC20Test:testTransfer(address,uint256) (runs: 256, μ: 74830, ~: 74929)
DN404OnlyERC20Test:testTransferFrom() (gas: 84606)
DN404OnlyERC20Test:testTransferFrom(address,address,address,uint256,uint256) (runs: 256, μ: 105526, ~: 107575)
DN404OnlyERC20Test:testTransferFromInsufficientAllowanceReverts() (gas: 68116)
DN404OnlyERC20Test:testTransferFromInsufficientAllowanceReverts(address,uint256,uint256) (runs: 256, μ: 68643, ~: 69226)
DN404OnlyERC20Test:testTransferFromInsufficientBalanceReverts() (gas: 75048)
DN404OnlyERC20Test:testTransferFromInsufficientBalanceReverts(address,uint256,uint256) (runs: 256, μ: 76109, ~: 76169)
DN404OnlyERC20Test:testTransferInsufficientBalanceReverts() (gas: 66225)
DN404OnlyERC20Test:testTransferInsufficientBalanceReverts(address,uint256,uint256) (runs: 256, μ: 67258, ~: 67312)
DN404OnlyERC20Test:test__codesize() (gas: 29706)
DN404Test:testBatchNFTLog() (gas: 306245)
DN404Test:testBurnOnTransfer(uint32,address) (runs: 256, μ: 264295, ~: 264295)
DN404Test:testInitialize(uint32,address) (runs: 256, μ: 112680, ~: 116459)
DN404Test:testMintAndBurn() (gas: 336800)
DN404Test:testMintAndBurn2() (gas: 262756)
DN404Test:testMintOnTransfer(uint32,address) (runs: 256, μ: 263084, ~: 263084)
DN404Test:testMixed(uint256) (runs: 256, μ: 605805, ~: 586915)
DN404Test:testNameAndSymbol(string,string) (runs: 256, μ: 207308, ~: 207649)
DN404Test:testRegisterAndResolveAlias(address,address) (runs: 256, μ: 126825, ~: 127078)
DN404Test:testSetAndGetAux(address,uint88) (runs: 256, μ: 21968, ~: 22275)
DN404Test:testSetAndGetOperatorApprovals(address,address,bool) (runs: 256, μ: 129811, ~: 120877)
DN404Test:testSetAndGetSkipNFT() (gas: 89239)
DN404Test:testTokenURI(string,uint256) (runs: 256, μ: 158081, ~: 135780)
DN404Test:testTransfersAndBurns() (gas: 448756)
DN404Test:testWrapAround(uint32,uint256) (runs: 256, μ: 353092, ~: 344913)
DN404Test:test__codesize() (gas: 40686)
MintTests:test_WhenAmountIsGreaterThan_MAX_SUPPLYOrMintMakesNFTTotalSupplyExceed_MAX_SUPPLY(uint256) (runs: 256, μ: 59085, ~: 59146)
MintTests:test_WhenRecipientAddressHasSkipNFTEnabled(uint256) (runs: 256, μ: 85753, ~: 85748)
MintTests:test_WhenRecipientIsAddress0(uint256) (runs: 256, μ: 31104, ~: 31169)
MintTests:test_WhenRecipientsBalanceDifferenceIsNotUpTo1e18(uint256) (runs: 256, μ: 82713, ~: 82809)
MintTests:test_WhenRecipientsBalanceDifferenceIsUpTo1e18OrAbove(uint256) (runs: 256, μ: 89227, ~: 89327)
MintTests:test__codesize() (gas: 22304)
NFTMintDN404Test:testAllowlistMint() (gas: 286434)
NFTMintDN404Test:testMint() (gas: 246613)
NFTMintDN404Test:testTotalSupplyReached() (gas: 735014381)
NFTMintDN404Test:test__codesize() (gas: 26060)
SimpleDN404Test:testMint() (gas: 45198)
DN404OnlyERC20Test:testMint() (gas: 45215)
DN404OnlyERC20Test:testMintOverMaxLimitReverts() (gas: 40430)
DN404OnlyERC20Test:testMintz(address,uint256) (runs: 256, μ: 45627, ~: 45637)
DN404OnlyERC20Test:testTransfer() (gas: 74365)
DN404OnlyERC20Test:testTransfer(address,uint256) (runs: 256, μ: 74894, ~: 74822)
DN404OnlyERC20Test:testTransferFrom() (gas: 84265)
DN404OnlyERC20Test:testTransferFrom(address,address,address,uint256,uint256) (runs: 256, μ: 105008, ~: 107234)
DN404OnlyERC20Test:testTransferFromInsufficientAllowanceReverts() (gas: 67992)
DN404OnlyERC20Test:testTransferFromInsufficientAllowanceReverts(address,uint256,uint256) (runs: 256, μ: 68606, ~: 69093)
DN404OnlyERC20Test:testTransferFromInsufficientBalanceReverts() (gas: 74747)
DN404OnlyERC20Test:testTransferFromInsufficientBalanceReverts(address,uint256,uint256) (runs: 256, μ: 75803, ~: 75868)
DN404OnlyERC20Test:testTransferInsufficientBalanceReverts() (gas: 66158)
DN404OnlyERC20Test:testTransferInsufficientBalanceReverts(address,uint256,uint256) (runs: 256, μ: 67373, ~: 67254)
DN404OnlyERC20Test:test__codesize() (gas: 29228)
DN404Test:testBatchNFTLog() (gas: 306116)
DN404Test:testBurnOnTransfer(uint32,address) (runs: 256, μ: 264706, ~: 264726)
DN404Test:testInitialize(uint32,address) (runs: 256, μ: 112982, ~: 116550)
DN404Test:testMintAndBurn() (gas: 337343)
DN404Test:testMintAndBurn2() (gas: 263121)
DN404Test:testMintOnTransfer(uint32,address) (runs: 256, μ: 263464, ~: 263464)
DN404Test:testMixed(uint256) (runs: 256, μ: 598973, ~: 566927)
DN404Test:testNameAndSymbol(string,string) (runs: 256, μ: 207353, ~: 207694)
DN404Test:testRegisterAndResolveAlias(address,address) (runs: 256, μ: 127033, ~: 127063)
DN404Test:testSetAndGetAux(address,uint88) (runs: 256, μ: 22003, ~: 22275)
DN404Test:testSetAndGetOperatorApprovals(address,address,bool) (runs: 256, μ: 129897, ~: 120958)
DN404Test:testSetAndGetSkipNFT() (gas: 89209)
DN404Test:testTokenURI(string,uint256) (runs: 256, μ: 158057, ~: 135756)
DN404Test:testTransfersAndBurns() (gas: 448435)
DN404Test:testWrapAround(uint32,uint256) (runs: 256, μ: 350987, ~: 344213)
DN404Test:test__codesize() (gas: 40230)
MintTests:test_WhenAmountIsGreaterThan_MAX_SUPPLYOrMintMakesNFTTotalSupplyExceed_MAX_SUPPLY(uint256) (runs: 256, μ: 59041, ~: 59143)
MintTests:test_WhenRecipientAddressHasSkipNFTEnabled(uint256) (runs: 256, μ: 85996, ~: 86006)
MintTests:test_WhenRecipientIsAddress0(uint256) (runs: 256, μ: 31109, ~: 31169)
MintTests:test_WhenRecipientsBalanceDifferenceIsNotUpTo1e18(uint256) (runs: 256, μ: 83007, ~: 83089)
MintTests:test_WhenRecipientsBalanceDifferenceIsUpTo1e18OrAbove(uint256) (runs: 256, μ: 89542, ~: 89607)
MintTests:test__codesize() (gas: 21846)
NFTMintDN404Test:testAllowlistMint() (gas: 286318)
NFTMintDN404Test:testMint() (gas: 246497)
NFTMintDN404Test:testTotalSupplyReached() (gas: 734734381)
NFTMintDN404Test:test__codesize() (gas: 25592)
SimpleDN404Test:testMint() (gas: 45157)
SimpleDN404Test:testName() (gas: 9674)
SimpleDN404Test:testSetBaseURI() (gas: 38574)
SimpleDN404Test:testSymbol() (gas: 9716)
SimpleDN404Test:testWithdraw() (gas: 27356)
SimpleDN404Test:test__codesize() (gas: 19294)
SimpleDN404Test:test__codesize() (gas: 18831)
SoladyTest:test__codesize() (gas: 1102)
TestPlus:test__codesize() (gas: 406)
Loading

0 comments on commit e392346

Please sign in to comment.