From 1a8ff3c835f22b0be5f477b7459611e6b583d6b7 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Thu, 20 Jun 2024 00:09:20 -0300 Subject: [PATCH] chore: adorno --- .gas-report | 152 +++++++++++++++++----------------- .gas-snapshot | 58 ++++++------- script/DeploymentConfig.s.sol | 10 +-- 3 files changed, 107 insertions(+), 113 deletions(-) diff --git a/.gas-report b/.gas-report index 156a252..869a317 100644 --- a/.gas-report +++ b/.gas-report @@ -1,58 +1,35 @@ -| contracts/ens/ENSRegistry.sol:ENSRegistry contract | | | | | | -|----------------------------------------------------|-----------------|-------|--------|-------|---------| -| Deployment Cost | Deployment Size | | | | | -| 534902 | 2649 | | | | | -| Function Name | min | avg | median | max | # calls | -| owner | 533 | 1244 | 533 | 2533 | 194 | -| resolver | 476 | 809 | 476 | 2476 | 12 | -| setOwner | 2395 | 2861 | 2395 | 5195 | 24 | -| setResolver | 4478 | 12438 | 4478 | 24378 | 15 | -| setSubnodeOwner | 3061 | 22583 | 24961 | 26961 | 109 | - - -| contracts/ens/PublicResolver.sol:PublicResolver contract | | | | | | -|----------------------------------------------------------|-----------------|-------|--------|-------|---------| -| Deployment Cost | Deployment Size | | | | | -| 1256030 | 6335 | | | | | -| Function Name | min | avg | median | max | # calls | -| addr | 566 | 1232 | 566 | 2566 | 6 | -| pubkey | 675 | 2008 | 675 | 4675 | 6 | -| setAddr | 27178 | 27178 | 27178 | 27178 | 4 | -| setPubkey | 47504 | 48504 | 48504 | 49504 | 4 | - - -| contracts/mocks/Dummy2UsernameRegistrar.sol:Dummy2UsernameRegistrar contract | | | | | | -|------------------------------------------------------------------------------|-----------------|--------|--------|--------|---------| -| Deployment Cost | Deployment Size | | | | | -| 3402568 | 17188 | | | | | -| Function Name | min | avg | median | max | # calls | -| activate | 46312 | 46554 | 46312 | 54312 | 33 | -| controller | 2414 | 2414 | 2414 | 2414 | 3 | -| dropUsername | 14543 | 14543 | 14543 | 14543 | 2 | -| ensNode | 406 | 1406 | 1406 | 2406 | 60 | -| ensRegistry | 2460 | 2460 | 2460 | 2460 | 3 | -| getAccountBalance | 504 | 504 | 504 | 504 | 15 | -| getAccountOwner | 517 | 517 | 517 | 517 | 15 | -| getCreationTime | 534 | 534 | 534 | 534 | 8 | -| migrateRegistry | 46313 | 46313 | 46313 | 46313 | 4 | -| moveRegistry | 61618 | 64743 | 61618 | 74118 | 4 | -| parentRegistry | 2415 | 2415 | 2415 | 2415 | 3 | -| price | 407 | 1709 | 2407 | 2407 | 43 | -| receiveApproval | 153937 | 199442 | 188472 | 266503 | 6 | -| register | 2347 | 141690 | 157593 | 265659 | 27 | -| release | 1397 | 20806 | 7181 | 44022 | 9 | -| releaseDelay | 2407 | 2407 | 2407 | 2407 | 11 | -| reserveSlash | 44793 | 44793 | 44793 | 44793 | 8 | -| reservedUsernamesMerkleRoot | 2386 | 2386 | 2386 | 2386 | 3 | -| resolver | 2373 | 2373 | 2373 | 2373 | 3 | -| slashAddressLikeUsername | 900 | 9911 | 1100 | 45158 | 5 | -| slashInvalidUsername | 841 | 12266 | 2749 | 43810 | 7 | -| slashSmallUsername | 45598 | 45598 | 45598 | 45598 | 1 | -| state | 396 | 396 | 396 | 396 | 2 | -| token | 2458 | 2458 | 2458 | 2458 | 3 | -| updateAccountOwner | 1879 | 4055 | 4133 | 6074 | 4 | -| updateRegistryPrice | 10674 | 10674 | 10674 | 10674 | 1 | -| usernameMinLength | 2341 | 2341 | 2341 | 2341 | 3 | +| contracts/registry/UsernameRegistrar.sol:UsernameRegistrar contract | | | | | | +|---------------------------------------------------------------------|-----------------|--------|--------|--------|---------| +| Deployment Cost | Deployment Size | | | | | +| 3402568 | 17188 | | | | | +| Function Name | min | avg | median | max | # calls | +| activate | 46312 | 46554 | 46312 | 54312 | 33 | +| controller | 2414 | 2414 | 2414 | 2414 | 3 | +| dropUsername | 14543 | 14543 | 14543 | 14543 | 2 | +| ensNode | 406 | 1406 | 1406 | 2406 | 60 | +| ensRegistry | 2460 | 2460 | 2460 | 2460 | 3 | +| getAccountBalance | 504 | 504 | 504 | 504 | 15 | +| getAccountOwner | 517 | 517 | 517 | 517 | 15 | +| getCreationTime | 534 | 534 | 534 | 534 | 8 | +| migrateRegistry | 46313 | 46313 | 46313 | 46313 | 4 | +| moveRegistry | 61618 | 64743 | 61618 | 74118 | 4 | +| parentRegistry | 2415 | 2415 | 2415 | 2415 | 3 | +| price | 407 | 1709 | 2407 | 2407 | 43 | +| receiveApproval | 179225 | 226287 | 216007 | 296460 | 6 | +| register | 2347 | 161736 | 182881 | 295616 | 27 | +| release | 1397 | 18701 | 7181 | 67939 | 9 | +| releaseDelay | 2407 | 2407 | 2407 | 2407 | 11 | +| reserveSlash | 44793 | 44793 | 44793 | 44793 | 8 | +| reservedUsernamesMerkleRoot | 2386 | 2386 | 2386 | 2386 | 3 | +| resolver | 2373 | 2373 | 2373 | 2373 | 3 | +| slashAddressLikeUsername | 900 | 19479 | 1100 | 92995 | 5 | +| slashInvalidUsername | 841 | 19100 | 2749 | 91647 | 7 | +| slashSmallUsername | 93435 | 93435 | 93435 | 93435 | 1 | +| state | 396 | 396 | 396 | 396 | 2 | +| token | 2458 | 2458 | 2458 | 2458 | 3 | +| updateAccountOwner | 1879 | 4055 | 4133 | 6074 | 4 | +| updateRegistryPrice | 10674 | 10674 | 10674 | 10674 | 1 | +| usernameMinLength | 2341 | 2341 | 2341 | 2341 | 3 | | contracts/test/MerkleProofWrapper.sol:MerkleProofWrapper contract | | | | | | @@ -63,32 +40,55 @@ | verifyProof | 1084 | 1340 | 1463 | 1473 | 3 | -| contracts/token/TestToken.sol:TestToken contract | | | | | | -|--------------------------------------------------|-----------------|--------|--------|--------|---------| -| Deployment Cost | Deployment Size | | | | | -| 379818 | 1928 | | | | | -| Function Name | min | avg | median | max | # calls | -| allowance | 814 | 880 | 814 | 2814 | 30 | -| approve | 2568 | 23733 | 24741 | 24741 | 24 | -| approveAndCall | 179573 | 225078 | 214108 | 292139 | 6 | -| mint | 46760 | 46760 | 46760 | 46760 | 27 | -| transfer | 23319 | 24461 | 25319 | 25319 | 7 | -| transferFrom | 2795 | 25589 | 26434 | 26434 | 28 | - - -| script/Deploy.s.sol:Deploy contract | | | | | | -|-------------------------------------|-----------------|---------|---------|---------|---------| -| Deployment Cost | Deployment Size | | | | | -| 9386559 | 47997 | | | | | -| Function Name | min | avg | median | max | # calls | -| migration | 3489520 | 3489520 | 3489520 | 3489520 | 4 | -| run | 8715095 | 8715095 | 8715095 | 8715095 | 38 | +| lib/ens-contracts/contracts/registry/ENSRegistry.sol:ENSRegistry contract | | | | | | +|---------------------------------------------------------------------------|-----------------|-------|--------|-------|---------| +| Deployment Cost | Deployment Size | | | | | +| 508871 | 2519 | | | | | +| Function Name | min | avg | median | max | # calls | +| owner | 533 | 1229 | 533 | 2533 | 198 | +| resolver | 476 | 809 | 476 | 2476 | 12 | +| setOwner | 2395 | 2861 | 2395 | 5195 | 24 | +| setResolver | 4478 | 12438 | 4478 | 24378 | 15 | +| setSubnodeOwner | 3061 | 22583 | 24961 | 26961 | 109 | + + +| lib/ens-contracts/contracts/resolvers/PublicResolver.sol:PublicResolver contract | | | | | | +|----------------------------------------------------------------------------------|-----------------|-------|--------|-------|---------| +| Deployment Cost | Deployment Size | | | | | +| 1936168 | 9732 | | | | | +| Function Name | min | avg | median | max | # calls | +| addr | 1431 | 2011 | 1431 | 3173 | 6 | +| pubkey | 647 | 1980 | 647 | 4647 | 6 | +| setAddr | 31672 | 31672 | 31672 | 31672 | 4 | +| setPubkey | 47679 | 48679 | 48679 | 49679 | 4 | + + +| lib/minime/contracts/MiniMeToken.sol:MiniMeToken contract | | | | | | +|-----------------------------------------------------------|-----------------|--------|--------|--------|---------| +| Deployment Cost | Deployment Size | | | | | +| 1778095 | 10235 | | | | | +| Function Name | min | avg | median | max | # calls | +| allowance | 763 | 829 | 763 | 2763 | 30 | +| approve | 3072 | 26261 | 27248 | 31748 | 24 | +| approveAndCall | 207970 | 255032 | 244752 | 325205 | 6 | +| generateTokens | 94463 | 94463 | 94463 | 94463 | 27 | +| transfer | 8527 | 42256 | 50744 | 73156 | 7 | +| transferFrom | 4089 | 50070 | 51773 | 51773 | 28 | + + +| script/Deploy.s.sol:Deploy contract | | | | | | +|-------------------------------------|-----------------|----------|----------|----------|---------| +| Deployment Cost | Deployment Size | | | | | +| 13947631 | 70759 | | | | | +| Function Name | min | avg | median | max | # calls | +| migration | 3489520 | 3489520 | 3489520 | 3489520 | 4 | +| run | 13054107 | 13054107 | 13054107 | 13054107 | 38 | | script/DeploymentConfig.s.sol:DeploymentConfig contract | | | | | | |---------------------------------------------------------|-----------------|------|--------|-------|---------| | Deployment Cost | Deployment Size | | | | | -| 5229240 | 26843 | | | | | +| 9560657 | 49600 | | | | | | Function Name | min | avg | median | max | # calls | | ETH_LABELHASH | 240 | 240 | 240 | 240 | 38 | | ETH_NAMEHASH | 239 | 239 | 239 | 239 | 80 | diff --git a/.gas-snapshot b/.gas-snapshot index 9ec6f1a..949b1ff 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -6,35 +6,35 @@ UsernameRegistrarActivateTest:testDeployment() (gas: 44066) UsernameRegistrarActivateTest:testRegisterUnactivated() (gas: 10899) UsernameRegistrarActivateTest:testUser() (gas: 2381) UsernameRegistrarRegisterTest:testDeployment() (gas: 44066) -UsernameRegistrarRegisterTest:testMoveRegistry() (gas: 3585635) -UsernameRegistrarRegisterTest:testRegisterAlreadyInUse() (gas: 248131) -UsernameRegistrarRegisterTest:testRegisterUsername() (gas: 228803) -UsernameRegistrarRegisterTest:testRegisterUsernameApproveAndCall() (gas: 230907) -UsernameRegistrarRegisterTest:testRegisterUsernameWithAccountAndPubKey() (gas: 354237) -UsernameRegistrarRegisterTest:testRegisterUsernameWithAccountAndPubKeyApproveAndCall() (gas: 356470) -UsernameRegistrarRegisterTest:testRegisterUsernameWithNoAllowanceOrBalance() (gas: 311452) -UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyAddress() (gas: 305897) -UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyAddressApproveAndCall() (gas: 308039) -UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyPubkey() (gas: 326951) -UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyPubkeyApproveAndCall() (gas: 329094) -UsernameRegistrarRegisterTest:testRegisterUsernameWithoutAnything() (gas: 231850) -UsernameRegistrarRegisterTest:testRegisterUsernameWithoutAnythingApproveAndCall() (gas: 234037) -UsernameRegistrarRegisterTest:testReleaseUsername() (gas: 245787) -UsernameRegistrarRegisterTest:testReleaseUsernameByNewOwner() (gas: 254346) -UsernameRegistrarRegisterTest:testReleaseWhenMigrated() (gas: 3715676) -UsernameRegistrarRegisterTest:testReleaseWhenMigratedByOldOwner() (gas: 3723331) -UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameBeforeDelay() (gas: 231682) -UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameFromOther() (gas: 233628) -UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameNotRegistered() (gas: 236252) -UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatDoesNotStartWith0AndIsBiggerThan12() (gas: 275916) -UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatDoesNotStartWith0xAndIsBiggerThan12() (gas: 276082) -UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatStartsWith0xButDoesNotUseHexChars() (gas: 276395) -UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatStartsWith0xButIsSmallerThan12() (gas: 275837) -UsernameRegistrarRegisterTest:testShouldNotSlashValidUsername() (gas: 279453) -UsernameRegistrarRegisterTest:testSlashAddressLikeUsername() (gas: 287123) -UsernameRegistrarRegisterTest:testSlashInvalidUsername() (gas: 326393) -UsernameRegistrarRegisterTest:testSlashSmallUsername() (gas: 287458) -UsernameRegistrarRegisterTest:testUpdateAccountOwner() (gas: 3840423) +UsernameRegistrarRegisterTest:testMoveRegistry() (gas: 3608109) +UsernameRegistrarRegisterTest:testRegisterAlreadyInUse() (gas: 346672) +UsernameRegistrarRegisterTest:testRegisterUsername() (gas: 326741) +UsernameRegistrarRegisterTest:testRegisterUsernameApproveAndCall() (gas: 329447) +UsernameRegistrarRegisterTest:testRegisterUsernameWithAccountAndPubKey() (gas: 457681) +UsernameRegistrarRegisterTest:testRegisterUsernameWithAccountAndPubKeyApproveAndCall() (gas: 460516) +UsernameRegistrarRegisterTest:testRegisterUsernameWithNoAllowanceOrBalance() (gas: 322802) +UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyAddress() (gas: 409167) +UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyAddressApproveAndCall() (gas: 411910) +UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyPubkey() (gas: 425643) +UsernameRegistrarRegisterTest:testRegisterUsernameWithOnlyPubkeyApproveAndCall() (gas: 428388) +UsernameRegistrarRegisterTest:testRegisterUsernameWithoutAnything() (gas: 329789) +UsernameRegistrarRegisterTest:testRegisterUsernameWithoutAnythingApproveAndCall() (gas: 332577) +UsernameRegistrarRegisterTest:testReleaseUsername() (gas: 296384) +UsernameRegistrarRegisterTest:testReleaseUsernameByNewOwner() (gas: 337116) +UsernameRegistrarRegisterTest:testReleaseWhenMigrated() (gas: 3838975) +UsernameRegistrarRegisterTest:testReleaseWhenMigratedByOldOwner() (gas: 3846579) +UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameBeforeDelay() (gas: 329620) +UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameFromOther() (gas: 329566) +UsernameRegistrarRegisterTest:testShouldNotReleaseUsernameNotRegistered() (gas: 334190) +UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatDoesNotStartWith0AndIsBiggerThan12() (gas: 373854) +UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatDoesNotStartWith0xAndIsBiggerThan12() (gas: 374020) +UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatStartsWith0xButDoesNotUseHexChars() (gas: 374333) +UsernameRegistrarRegisterTest:testShouldNotSlashUsernameThatStartsWith0xButIsSmallerThan12() (gas: 373775) +UsernameRegistrarRegisterTest:testShouldNotSlashValidUsername() (gas: 377392) +UsernameRegistrarRegisterTest:testSlashAddressLikeUsername() (gas: 387824) +UsernameRegistrarRegisterTest:testSlashInvalidUsername() (gas: 427093) +UsernameRegistrarRegisterTest:testSlashSmallUsername() (gas: 388158) +UsernameRegistrarRegisterTest:testUpdateAccountOwner() (gas: 3958584) UsernameRegistrarRegisterTest:testUpdateRegistryPrice() (gas: 21924) UsernameRegistrarRegisterTest:testUser() (gas: 2404) UsernameRegistrarTest:testDeployment() (gas: 44066) diff --git a/script/DeploymentConfig.s.sol b/script/DeploymentConfig.s.sol index b097165..38f2103 100644 --- a/script/DeploymentConfig.s.sol +++ b/script/DeploymentConfig.s.sol @@ -95,14 +95,8 @@ contract DeploymentConfig is Script { function getOrCreateAnvilEthConfig() public returns (NetworkConfig memory) { vm.startBroadcast(deployer); - MiniMeToken token = new MiniMeToken( - MiniMeToken(payable(address(0))), - 0, - "Status Network Token", - 18, - "SNT", - true - ); + MiniMeToken token = + new MiniMeToken(MiniMeToken(payable(address(0))), 0, "Status Network Token", 18, "SNT", true); ENSRegistry ensRegistry = new ENSRegistry(); PublicResolver publicResolver = new PublicResolver(ensRegistry); vm.stopBroadcast();