diff --git a/status-network-contracts/.gas-report b/status-network-contracts/.gas-report index 0a2ecf139f..bbe95cb493 100644 --- a/status-network-contracts/.gas-report +++ b/status-network-contracts/.gas-report @@ -10,83 +10,55 @@ |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| GUARDIAN_ROLE | 5169 | 5169 | 5169 | 5169 | 46 | +| GUARDIAN_ROLE | 5169 | 5169 | 5169 | 5169 | 38 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| MAX_MULTIPLIER | 5212 | 5212 | 5212 | 5212 | 4 | +| MAX_LOCKUP_PERIOD | 5266 | 5266 | 5266 | 5266 | 2 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| MIN_LOCKUP_PERIOD | 5170 | 5170 | 5170 | 5170 | 1 | +| MAX_MULTIPLIER | 5212 | 5212 | 5212 | 5212 | 11 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| OPERATOR_ROLE | 5166 | 5166 | 5166 | 5166 | 2 | +| MIN_LOCKUP_PERIOD | 5170 | 5170 | 5170 | 5170 | 4 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| | emergencyModeEnabled | 7271 | 7271 | 7271 | 7271 | 256 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| enableEmergencyMode | 53706 | 53706 | 53706 | 53706 | 257 | +| enableEmergencyMode | 53706 | 53706 | 53706 | 53706 | 256 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| fallback | 5123 | 72193 | 51498 | 376118 | 4967 | +| fallback | 5123 | 71321 | 51498 | 376118 | 5070 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| getAccountVaults | 10122 | 10122 | 10122 | 10122 | 4 | +| getAccountTotalMaxMP | 26077 | 26077 | 26077 | 26077 | 1 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| getVault | 18585 | 18585 | 18585 | 18585 | 4091 | +| getAccountTotalStakedBalance | 26055 | 26055 | 26055 | 26055 | 1 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| grantRole | 56298 | 56321 | 56322 | 56322 | 48 | +| getVault | 18585 | 18585 | 18585 | 18585 | 4113 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| lastRewardTime | 7290 | 7290 | 7290 | 7290 | 3 | +| grantRole | 56322 | 56322 | 56322 | 56322 | 38 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| mint | 82652 | 82652 | 82652 | 82652 | 1 | +| mpBalanceOfAccount | 37221 | 37221 | 37221 | 37221 | 1 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| mintedSupply | 7267 | 7267 | 7267 | 7267 | 1 | +| redeemRewards | 81201 | 126535 | 136460 | 136792 | 256 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| mpAccruedOf | 7537 | 7537 | 7537 | 7537 | 12 | +| rewardsBalanceOf | 25160 | 29767 | 30773 | 30994 | 256 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| mpBalanceOf | 9869 | 13647 | 15268 | 15268 | 12 | +| rewardsBalanceOfAccount | 30004 | 30005 | 30004 | 30114 | 256 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| pause | 32844 | 44525 | 44525 | 56206 | 4 | +| setRewardsSupplier | 56663 | 56663 | 56663 | 56663 | 38 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| redeemRewards | 28971 | 125811 | 136460 | 147140 | 260 | +| setTrustedCodehash | 53031 | 53031 | 53031 | 53031 | 38 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| rewardAmount | 7288 | 7288 | 7288 | 7288 | 4 | +| totalMPAccrued | 7268 | 7268 | 7268 | 7268 | 4102 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| rewardEndTime | 7313 | 7313 | 7313 | 7313 | 4 | +| totalMPStaked | 7268 | 7268 | 7268 | 7268 | 4102 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| rewardStartTime | 7313 | 7313 | 7313 | 7313 | 4 | +| totalMaxMP | 7290 | 7290 | 7290 | 7290 | 4102 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| rewardsBalanceOf | 25160 | 29672 | 30773 | 30994 | 268 | +| totalRewardsSupply | 11620 | 13324 | 12750 | 16786 | 1024 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| rewardsBalanceOfAccount | 7469 | 29616 | 30004 | 30114 | 265 | +| totalStaked | 7291 | 7291 | 7291 | 7291 | 4102 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| setReward | 33125 | 33125 | 33125 | 33125 | 1 | +| updateGlobalState | 57348 | 57348 | 57348 | 57348 | 2 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| setRewardsSupplier | 52252 | 56479 | 56663 | 56663 | 48 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| setTrustedCodehash | 53031 | 53031 | 53031 | 53031 | 46 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalMP | 11689 | 13141 | 13141 | 14594 | 6 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalMPAccrued | 7268 | 7268 | 7268 | 7268 | 4088 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalMPStaked | 7268 | 7268 | 7268 | 7268 | 4094 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalMaxMP | 7290 | 7290 | 7290 | 7290 | 4088 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalRewardsAccrued | 7290 | 7290 | 7290 | 7290 | 5 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalRewardsSupply | 7242 | 13387 | 13881 | 16786 | 1075 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalShares | 9502 | 9502 | 9502 | 9502 | 6 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| totalStaked | 7291 | 7291 | 7291 | 7291 | 4094 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| unpause | 34283 | 34283 | 34283 | 34283 | 1 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| updateGlobalState | 106119 | 106119 | 106119 | 106119 | 1 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| updateVault | 60403 | 62325 | 60403 | 139034 | 1008 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| upgradeTo | 39110 | 39110 | 39110 | 39110 | 1 | +| updateVault | 60403 | 62134 | 60403 | 84962 | 1013 | |-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| | upgradeToAndCall | 29762 | 29762 | 29762 | 29762 | 1 | -|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------| -| vaultShares | 9757 | 9757 | 9757 | 9757 | 12 | ╰-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------╯ ╭-----------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -94,7 +66,7 @@ +===============================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-----------------------------------------------------+-----------------+---------+---------+---------+---------| -| 6899314 | 33011 | | | | | +| 6929786 | 33152 | | | | | |-----------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |-----------------------------------------------------+-----------------+---------+---------+---------+---------| @@ -102,7 +74,7 @@ |-----------------------------------------------------+-----------------+---------+---------+---------+---------| | getDeployer | 2306 | 2306 | 2306 | 2306 | 1 | |-----------------------------------------------------+-----------------+---------+---------+---------+---------| -| runForTest | 5992550 | 5992550 | 5992550 | 5992550 | 290 | +| runForTest | 6007981 | 6007981 | 6007981 | 6007981 | 290 | ╰-----------------------------------------------------+-----------------+---------+---------+---------+---------╯ ╭-------------------------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -110,13 +82,13 @@ +=============================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 3619345 | 17786 | | | | | +| 3649809 | 17927 | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| runForTest | 2716159 | 2716159 | 2716159 | 2716159 | 14 | +| runForTest | 2731607 | 2731607 | 2731607 | 2731607 | 14 | ╰-------------------------------------------------------------------+-----------------+---------+---------+---------+---------╯ ╭-----------------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -124,13 +96,13 @@ +=====================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-----------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 3234069 | 15962 | | | | | +| 3264532 | 16103 | | | | | |-----------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |-----------------------------------------------------------+-----------------+---------+---------+---------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-----------------------------------------------------------+-----------------+---------+---------+---------+---------| -| runForTest | 2475901 | 2475901 | 2475901 | 2475901 | 10 | +| runForTest | 2491349 | 2491349 | 2491349 | 2491349 | 10 | ╰-----------------------------------------------------------+-----------------+---------+---------+---------+---------╯ ╭---------------------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -138,13 +110,13 @@ +=========================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |---------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 3259820 | 16079 | | | | | +| 3290519 | 16221 | | | | | |---------------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |---------------------------------------------------------------+-----------------+---------+---------+---------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |---------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| runForTest | 2681644 | 2681644 | 2681644 | 2681644 | 9 | +| runForTest | 2697292 | 2697292 | 2697292 | 2697292 | 10 | ╰---------------------------------------------------------------+-----------------+---------+---------+---------+---------╯ ╭-----------------------------------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -152,13 +124,13 @@ +=======================================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-----------------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 4059435 | 19137 | | | | | +| 4089899 | 19278 | | | | | |-----------------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |-----------------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-----------------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| runForTest | 2921800 | 2921800 | 2921800 | 2921800 | 3 | +| runForTest | 2937247 | 2937247 | 2937247 | 2937247 | 3 | ╰-----------------------------------------------------------------------------+-----------------+---------+---------+---------+---------╯ ╭-----------------------------------------------------------+-----------------+----------+----------+----------+---------╮ @@ -166,13 +138,13 @@ +========================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-----------------------------------------------------------+-----------------+----------+----------+----------+---------| -| 34028529 | 164551 | | | | | +| 37595973 | 182136 | | | | | |-----------------------------------------------------------+-----------------+----------+----------+----------+---------| | | | | | | | |-----------------------------------------------------------+-----------------+----------+----------+----------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-----------------------------------------------------------+-----------------+----------+----------+----------+---------| -| runForTest | 16305019 | 16305019 | 16305019 | 16305019 | 8 | +| runForTest | 17202772 | 17202772 | 17202772 | 17202772 | 8 | ╰-----------------------------------------------------------+-----------------+----------+----------+----------+---------╯ ╭---------------------------------------------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -180,7 +152,7 @@ +=================================================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |---------------------------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 4654303 | 22576 | | | | | +| 4684778 | 22717 | | | | | |---------------------------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |---------------------------------------------------------------------------------------+-----------------+---------+---------+---------+---------| @@ -194,13 +166,13 @@ +=============================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 6907628 | 33045 | | | | | +| 6938100 | 33186 | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| runForTest | 5807847 | 5807847 | 5807847 | 5807847 | 104 | +| runForTest | 5823300 | 5823300 | 5823300 | 5823300 | 104 | ╰-------------------------------------------------------------------+-----------------+---------+---------+---------+---------╯ ╭-------------------------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -208,13 +180,13 @@ +=============================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 4818098 | 23383 | | | | | +| 4848565 | 23524 | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| runForTest | 3950979 | 3950979 | 3950979 | 3950979 | 104 | +| runForTest | 3966427 | 3966427 | 3966427 | 3966427 | 104 | ╰-------------------------------------------------------------------+-----------------+---------+---------+---------+---------╯ ╭---------------------------------------------------------+-----------------+------+--------+------+---------╮ @@ -222,13 +194,13 @@ +============================================================================================================+ | Deployment Cost | Deployment Size | | | | | |---------------------------------------------------------+-----------------+------+--------+------+---------| -| 0 | 9035 | | | | | +| 0 | 9176 | | | | | |---------------------------------------------------------+-----------------+------+--------+------+---------| | | | | | | | |---------------------------------------------------------+-----------------+------+--------+------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |---------------------------------------------------------+-----------------+------+--------+------+---------| -| activeNetworkConfig | 455 | 3473 | 4455 | 4455 | 424 | +| activeNetworkConfig | 477 | 3498 | 4477 | 4477 | 425 | ╰---------------------------------------------------------+-----------------+------+--------+------+---------╯ ╭---------------------------------------------------------------------+-----------------+---------+---------+---------+---------╮ @@ -236,7 +208,7 @@ +===============================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |---------------------------------------------------------------------+-----------------+---------+---------+---------+---------| -| 6491320 | 31116 | | | | | +| 6521800 | 31257 | | | | | |---------------------------------------------------------------------+-----------------+---------+---------+---------+---------| | | | | | | | |---------------------------------------------------------------------+-----------------+---------+---------+---------+---------| @@ -318,7 +290,7 @@ |------------------------------+-----------------+--------+--------+--------+---------| | setSlashRewardPercentage | 2737 | 16140 | 9069 | 29914 | 5 | |------------------------------+-----------------+--------+--------+--------+---------| -| slash | 4976 | 90223 | 90196 | 146150 | 265 | +| slash | 4976 | 90222 | 90196 | 146150 | 265 | |------------------------------+-----------------+--------+--------+--------+---------| | slashRewardPercentage | 2407 | 2407 | 2407 | 2407 | 2 | |------------------------------+-----------------+--------+--------+--------+---------| @@ -398,17 +370,17 @@ +===============================================================================================+ | Deployment Cost | Deployment Size | | | | | |----------------------------------------+-----------------+--------+--------+--------+---------| -| 0 | 4428 | | | | | +| 0 | 4429 | | | | | |----------------------------------------+-----------------+--------+--------+--------+---------| | | | | | | | |----------------------------------------+-----------------+--------+--------+--------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |----------------------------------------+-----------------+--------+--------+--------+---------| -| getTierCount | 2337 | 2337 | 2337 | 2337 | 2 | +| getTierCount | 2337 | 2337 | 2337 | 2337 | 3 | |----------------------------------------+-----------------+--------+--------+--------+---------| -| getTierIdByKarmaBalance | 7460 | 7942 | 7784 | 10020 | 8 | +| getTierIdByKarmaBalance | 7460 | 8475 | 7784 | 10344 | 12 | |----------------------------------------+-----------------+--------+--------+--------+---------| -| updateTiers | 23978 | 107929 | 28296 | 301092 | 9 | +| updateTiers | 23978 | 125250 | 73962 | 301101 | 10 | ╰----------------------------------------+-----------------+--------+--------+--------+---------╯ ╭----------------------------------------------------------------+-----------------+-------+--------+-------+---------╮ @@ -484,7 +456,7 @@ |--------------------------------------------+-----------------+--------+--------+--------+---------| | getAccountVaults | 5230 | 5230 | 5230 | 5230 | 4 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| getVault | 13675 | 13675 | 13675 | 13675 | 4186 | +| getVault | 13675 | 13675 | 13675 | 13675 | 4185 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | grantRole | 29492 | 29492 | 29492 | 29492 | 104 | |--------------------------------------------+-----------------+--------+--------+--------+---------| @@ -496,7 +468,7 @@ |--------------------------------------------+-----------------+--------+--------+--------+---------| | leave | 96367 | 125692 | 96367 | 213668 | 4 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| lock | 9325 | 42512 | 46117 | 65395 | 1034 | +| lock | 9325 | 42489 | 46117 | 65395 | 1034 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | migrateToVault | 11508 | 77786 | 13715 | 208136 | 3 | |--------------------------------------------+-----------------+--------+--------+--------+---------| @@ -510,7 +482,7 @@ |--------------------------------------------+-----------------+--------+--------+--------+---------| | proxiableUUID | 343 | 343 | 343 | 343 | 3 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| redeemRewards | 54883 | 101136 | 110142 | 249933 | 260 | +| redeemRewards | 54883 | 101349 | 110142 | 249933 | 260 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | registerVault | 2455 | 75443 | 76267 | 76267 | 427 | |--------------------------------------------+-----------------+--------+--------+--------+---------| @@ -520,7 +492,7 @@ |--------------------------------------------+-----------------+--------+--------+--------+---------| | rewardStartTime | 2430 | 2430 | 2430 | 2430 | 4 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| rewardsBalanceOf | 20274 | 24786 | 25887 | 26108 | 268 | +| rewardsBalanceOf | 20274 | 24806 | 25887 | 26108 | 268 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | rewardsBalanceOfAccount | 20752 | 25264 | 25118 | 62242 | 272 | |--------------------------------------------+-----------------+--------+--------+--------+---------| @@ -532,33 +504,33 @@ |--------------------------------------------+-----------------+--------+--------+--------+---------| | setTrustedCodehash | 24429 | 26286 | 26429 | 26429 | 112 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| stake | 4736 | 133389 | 204853 | 215768 | 2932 | +| stake | 4736 | 132850 | 143629 | 215768 | 2932 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | totalMP | 6806 | 8258 | 8258 | 9711 | 6 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| totalMPAccrued | 2385 | 2385 | 2385 | 2385 | 4168 | +| totalMPAccrued | 2385 | 2385 | 2385 | 2385 | 4167 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| totalMPStaked | 2385 | 2385 | 2385 | 2385 | 4171 | +| totalMPStaked | 2385 | 2385 | 2385 | 2385 | 4170 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| totalMaxMP | 2407 | 2407 | 2407 | 2407 | 4168 | +| totalMaxMP | 2407 | 2407 | 2407 | 2407 | 4167 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | totalRewardsAccrued | 2407 | 2407 | 2407 | 2407 | 5 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| totalRewardsSupply | 6737 | 8510 | 8998 | 11903 | 1076 | +| totalRewardsSupply | 6737 | 8513 | 8998 | 11903 | 1076 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | totalShares | 4619 | 4619 | 4619 | 4619 | 6 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| totalStaked | 2408 | 2408 | 2408 | 2408 | 4174 | +| totalStaked | 2408 | 2408 | 2408 | 2408 | 4173 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | unpause | 13139 | 13139 | 13139 | 13139 | 1 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| unstake | 39068 | 66318 | 70029 | 78859 | 20 | +| unstake | 39068 | 69306 | 70029 | 78859 | 17 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | updateAccount | 349803 | 349803 | 349803 | 349803 | 1 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | updateGlobalState | 17994 | 33841 | 31404 | 80175 | 9 | |--------------------------------------------+-----------------+--------+--------+--------+---------| -| updateVault | 34088 | 36341 | 34088 | 112719 | 1027 | +| updateVault | 34088 | 36117 | 34088 | 112719 | 1026 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | upgradeTo | 10308 | 10929 | 10308 | 12795 | 4 | |--------------------------------------------+-----------------+--------+--------+--------+---------| @@ -588,9 +560,9 @@ |----------------------------------------+-----------------+--------+--------+--------+---------| | leave | 2616 | 143762 | 133069 | 381648 | 8 | |----------------------------------------+-----------------+--------+--------+--------+---------| -| lock | 25855 | 59127 | 62647 | 85326 | 1034 | +| lock | 25855 | 59115 | 62647 | 85326 | 1034 | |----------------------------------------+-----------------+--------+--------+--------+---------| -| lockUntil | 2363 | 2363 | 2363 | 2363 | 3825 | +| lockUntil | 2363 | 2363 | 2363 | 2363 | 3824 | |----------------------------------------+-----------------+--------+--------+--------+---------| | migrateFromVault | 46642 | 46642 | 46642 | 46642 | 1 | |----------------------------------------+-----------------+--------+--------+--------+---------| @@ -600,11 +572,11 @@ |----------------------------------------+-----------------+--------+--------+--------+---------| | register | 3354 | 79929 | 84335 | 84335 | 447 | |----------------------------------------+-----------------+--------+--------+--------+---------| -| stake | 2593 | 202740 | 245508 | 315095 | 2938 | +| stake | 2593 | 201975 | 242956 | 315095 | 2938 | |----------------------------------------+-----------------+--------+--------+--------+---------| | transferOwnership | 4746 | 4746 | 4746 | 4746 | 1 | |----------------------------------------+-----------------+--------+--------+--------+---------| -| unstake(uint256) | 4655 | 13543 | 6781 | 114132 | 272 | +| unstake(uint256) | 4655 | 12819 | 6781 | 114132 | 272 | |----------------------------------------+-----------------+--------+--------+--------+---------| | unstake(uint256,address) | 2670 | 2670 | 2670 | 2670 | 1 | |----------------------------------------+-----------------+--------+--------+--------+---------| @@ -638,7 +610,7 @@ +===============================================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------| -| 0 | 6015 | | | | | +| 0 | 6207 | | | | | |------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------| | | | | | | | |------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------| @@ -756,7 +728,7 @@ +==========================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |---------------------------------------------------------------------+-----------------+-------+--------+-------+---------| -| 939356 | 4684 | | | | | +| 939308 | 4684 | | | | | |---------------------------------------------------------------------+-----------------+-------+--------+-------+---------| | | | | | | | |---------------------------------------------------------------------+-----------------+-------+--------+-------+---------| @@ -770,7 +742,7 @@ +==================================================================================================+ | Deployment Cost | Deployment Size | | | | | |---------------------------------------------+-----------------+-------+--------+-------+---------| -| 770657 | 3987 | | | | | +| 770717 | 3987 | | | | | |---------------------------------------------+-----------------+-------+--------+-------+---------| | | | | | | | |---------------------------------------------+-----------------+-------+--------+-------+---------| @@ -778,9 +750,9 @@ |---------------------------------------------+-----------------+-------+--------+-------+---------| | approve | 29075 | 31691 | 29195 | 46259 | 3003 | |---------------------------------------------+-----------------+-------+--------+-------+---------| -| balanceOf | 2561 | 2561 | 2561 | 2561 | 4988 | +| balanceOf | 2561 | 2561 | 2561 | 2561 | 4987 | |---------------------------------------------+-----------------+-------+--------+-------+---------| -| mint | 33964 | 37449 | 34084 | 68248 | 3015 | +| mint | 33964 | 37448 | 34084 | 68248 | 3015 | ╰---------------------------------------------+-----------------+-------+--------+-------+---------╯ ╭-------------------------------------------------------+-----------------+--------+--------+--------+---------╮ diff --git a/status-network-contracts/.gas-snapshot b/status-network-contracts/.gas-snapshot index 9e8d5b528a..9bbb3e3d33 100644 --- a/status-network-contracts/.gas-snapshot +++ b/status-network-contracts/.gas-snapshot @@ -38,16 +38,16 @@ EmergencyExitTest:test_EmergencyExitWithRewards() (gas: 525110) EmergencyExitTest:test_GuardianCanEnableEmergencyMode() (gas: 61718) EmergencyExitTest:test_OnlyOwnerOrGuardianCanEnableEmergencyMode() (gas: 43414) EmergencyExitTest:test_OwnerCanEnableEmergencyMode() (gas: 63919) -FuzzTests:testFuzz_AccrueMP(uint128,uint64,uint64) (runs: 1000, μ: 599760, ~: 573043) -FuzzTests:testFuzz_AccrueMP_Relock(uint128,uint64,uint64,uint64) (runs: 1000, μ: 831208, ~: 801319) -FuzzTests:testFuzz_EmergencyExit(uint256,uint256) (runs: 1000, μ: 617819, ~: 617758) -FuzzTests:testFuzz_Lock(uint256,uint64) (runs: 1000, μ: 1023181, ~: 1024221) -FuzzTests:testFuzz_RedeemRewards(uint256,uint256,uint256,uint16,uint16) (runs: 1000, μ: 918063, ~: 929889) -FuzzTests:testFuzz_Relock(uint256,uint64,uint64) (runs: 1000, μ: 621463, ~: 596527) -FuzzTests:testFuzz_Rewards(uint256,uint256,uint256,uint16,uint16) (runs: 1000, μ: 734646, ~: 736582) -FuzzTests:testFuzz_Stake(uint256,uint64) (runs: 1000, μ: 393665, ~: 368349) -FuzzTests:testFuzz_Unstake(uint128,uint64,uint16,uint128) (runs: 1000, μ: 770631, ~: 755765) -FuzzTests:testFuzz_UpdateVault(uint128,uint64,uint64) (runs: 1000, μ: 599783, ~: 573066) +FuzzTests:testFuzz_AccrueMP(uint128,uint64,uint64) (runs: 1000, μ: 597128, ~: 573043) +FuzzTests:testFuzz_AccrueMP_Relock(uint128,uint64,uint64,uint64) (runs: 1000, μ: 832596, ~: 801304) +FuzzTests:testFuzz_EmergencyExit(uint256,uint256) (runs: 1000, μ: 617818, ~: 617758) +FuzzTests:testFuzz_Lock(uint256,uint64) (runs: 1000, μ: 1023363, ~: 1024221) +FuzzTests:testFuzz_RedeemRewards(uint256,uint256,uint256,uint16,uint16) (runs: 1000, μ: 918061, ~: 929889) +FuzzTests:testFuzz_Relock(uint256,uint64,uint64) (runs: 1000, μ: 619427, ~: 596527) +FuzzTests:testFuzz_Rewards(uint256,uint256,uint256,uint16,uint16) (runs: 1000, μ: 734644, ~: 736582) +FuzzTests:testFuzz_Stake(uint256,uint64) (runs: 1000, μ: 397108, ~: 368349) +FuzzTests:testFuzz_Unstake(uint128,uint64,uint16,uint128) (runs: 1000, μ: 771757, ~: 755739) +FuzzTests:testFuzz_UpdateVault(uint128,uint64,uint64) (runs: 1000, μ: 597151, ~: 573066) IntegrationTest:testStakeFoo() (gas: 2471190) KarmaAirdropTest:test_Owner() (gas: 12635) KarmaOwnershipTest:testActualTokenBalanceOf() (gas: 618438) @@ -70,23 +70,24 @@ KarmaTest:testRemoveKarmaDistributorOnlyOwner() (gas: 219741) KarmaTest:testRemoveUnknownKarmaDistributor() (gas: 41611) KarmaTest:testTotalSupply() (gas: 515872) KarmaTest:testTransfersNotAllowed() (gas: 79474) -KarmaTiersTest:test_GetTierIdByKarmaBalance_EdgeCases() (gas: 297868) -KarmaTiersTest:test_Revert_When_TierNameEmpty() (gas: 39361) -KarmaTiersTest:test_Revert_When_TierNameTooLong() (gas: 40510) -KarmaTiersTest:test_Revert_When_TiersAreEmpty() (gas: 34673) -KarmaTiersTest:test_Revert_When_TiersNotContiguous() (gas: 132711) -KarmaTiersTest:test_Revert_When_TiersNotStartingAtZero() (gas: 37667) -KarmaTiersTest:test_Revert_When_UpdateTiersCalledByNonOwner() (gas: 36642) -KarmaTiersTest:test_Success_When_LastTierIsUnlimited() (gas: 242295) -KarmaTiersTest:test_Success_When_TiersAreContiguous() (gas: 336294) +KarmaTiersTest:test_GetTierIdByKarmaBalance_EdgeCases() (gas: 297970) +KarmaTiersTest:test_Revert_When_TierNameEmpty() (gas: 39430) +KarmaTiersTest:test_Revert_When_TierNameTooLong() (gas: 40534) +KarmaTiersTest:test_Revert_When_TiersAreEmpty() (gas: 34687) +KarmaTiersTest:test_Revert_When_TiersNotContiguous() (gas: 132719) +KarmaTiersTest:test_Revert_When_TiersNotStartingAtZero() (gas: 37669) +KarmaTiersTest:test_Revert_When_UpdateTiersCalledByNonOwner() (gas: 36666) +KarmaTiersTest:test_Success_When_LastTierIsUnlimited() (gas: 242339) +KarmaTiersTest:test_Success_When_MinKarmaEqualsMaxKarma() (gas: 360705) +KarmaTiersTest:test_Success_When_TiersAreContiguous() (gas: 336363) LeaveTest:testOwner() (gas: 15308) -LeaveTest:test_LeaveShouldKeepFundsLockedInStakeVault() (gas: 10921068) -LeaveTest:test_LeaveShouldProperlyUpdateAccounting() (gas: 11008965) +LeaveTest:test_LeaveShouldKeepFundsLockedInStakeVault() (gas: 10951587) +LeaveTest:test_LeaveShouldProperlyUpdateAccounting() (gas: 11039484) LeaveTest:test_LeaveShouldRedeemRewardsToActualKarma() (gas: 1058451) LeaveTest:test_LeaveTransfersAllFunds() (gas: 215777) LeaveTest:test_RevertWHen_NotOwner() (gas: 37371) LeaveTest:test_RevertWhen_InvalidDestination() (gas: 36921) -LockTest:test_LockFailsWithInvalidPeriod(uint256) (runs: 1000, μ: 428069, ~: 428093) +LockTest:test_LockFailsWithInvalidPeriod(uint256) (runs: 1000, μ: 428066, ~: 428093) LockTest:test_LockFailsWithNoStake() (gas: 90096) LockTest:test_LockFailsWithZero() (gas: 389696) LockTest:test_LockMultipleTimesExceedMaxLock() (gas: 774215) @@ -222,7 +223,7 @@ SlashTest:testActualTokenBalanceOf() (gas: 618444) SlashTest:testAddKarmaDistributorOnlyAdmin() (gas: 520378) SlashTest:testBalanceOf() (gas: 605876) SlashTest:testBalanceOfWithNoSystemTotalKarma() (gas: 74379) -SlashTest:testFuzz_Slash(uint256) (runs: 1000, μ: 313073, ~: 308529) +SlashTest:testFuzz_Slash(uint256) (runs: 1000, μ: 313130, ~: 308529) SlashTest:testMintOnlyAdmin() (gas: 588135) SlashTest:testRemoveKarmaDistributorOnlyOwner() (gas: 219743) SlashTest:testRemoveUnknownKarmaDistributor() (gas: 41640) @@ -318,9 +319,9 @@ UpgradeKarmaTest:testRemoveKarmaDistributorOnlyOwner() (gas: 219753) UpgradeKarmaTest:testRemoveUnknownKarmaDistributor() (gas: 41611) UpgradeKarmaTest:testTotalSupply() (gas: 515872) UpgradeKarmaTest:testTransfersNotAllowed() (gas: 79474) -UpgradeKarmaTest:test_RevertWhen_NonAdminTriesToUpgrade() (gas: 15878064) +UpgradeKarmaTest:test_RevertWhen_NonAdminTriesToUpgrade() (gas: 15908576) UpgradeTest:test_RevertWhenNotOwner() (gas: 4169199) -UpgradeTest:test_UpgradeStakeManager() (gas: 10820892) +UpgradeTest:test_UpgradeStakeManager() (gas: 10851412) VotesTest:test_delegateBeforeRedeemingCreatesCheckpointsWithoutVotes() (gas: 518658) VotesTest:test_redeemWithoutDelegatingBeforeDoesntCreateCheckpoints() (gas: 477217) VotingCapabilityTest:testActualTokenBalanceOf() (gas: 618473) diff --git a/status-network-contracts/script/DeployProtocol.s.sol b/status-network-contracts/script/DeployProtocol.s.sol index c1b0dbd128..5ff9cd8514 100644 --- a/status-network-contracts/script/DeployProtocol.s.sol +++ b/status-network-contracts/script/DeployProtocol.s.sol @@ -12,6 +12,7 @@ import { DeployKarmaNFTScript } from "./DeployKarmaNFT.s.sol"; import { DeployStakeManagerScript } from "./DeployStakeManager.s.sol"; import { DeployVaultFactoryScript } from "./DeployVaultFactory.s.sol"; import { DeploySimpleKarmaDistributorScript } from "./DeploySimpleKarmaDistributor.s.sol"; +import { DeployKarmaTiersScript } from "./DeployKarmaTiers.s.sol"; import { INFTMetadataGenerator } from "../src/interfaces/INFTMetadataGenerator.sol"; import { Karma } from "../src/Karma.sol"; @@ -19,6 +20,7 @@ import { KarmaNFT } from "../src/KarmaNFT.sol"; import { StakeManager } from "../src/StakeManager.sol"; import { VaultFactory } from "../src/VaultFactory.sol"; import { SimpleKarmaDistributor } from "../src/SimpleKarmaDistributor.sol"; +import { KarmaTiers } from "../src/KarmaTiers.sol"; /** * @dev This script deploys the entire protocol including Karma, KarmaNFT, StakeManager, and VaultFactory. @@ -38,6 +40,8 @@ contract DeployProtocolScript is BaseScript { DeploySimpleKarmaDistributorScript deploySimpleKarmaDistributor; + DeployKarmaTiersScript deployKarmaTiers; + constructor() BaseScript() { deployKarma = new DeployKarmaScript(); deployMetadataGenerator = new DeployMetadataGeneratorScript(); @@ -45,6 +49,7 @@ contract DeployProtocolScript is BaseScript { deployStakeManager = new DeployStakeManagerScript(); deployVaultFactory = new DeployVaultFactoryScript(); deploySimpleKarmaDistributor = new DeploySimpleKarmaDistributorScript(); + deployKarmaTiers = new DeployKarmaTiersScript(); } /** @@ -161,6 +166,9 @@ contract DeployProtocolScript is BaseScript { (SimpleKarmaDistributor simpleKarmaDistributor, address simpleKarmaDistributorImpl) = deploySimpleKarmaDistributor.deploy(broadcaster, address(karma)); + console.log("Deploying KarmaTiers..."); + KarmaTiers karmaTiers = deployKarmaTiers.deploy(broadcaster); + console.log("\nContract addresses:"); console.log(address(karma), ": Karma (proxy)"); console.log(karmaImpl, ": Karma (implementation)"); @@ -173,6 +181,7 @@ contract DeployProtocolScript is BaseScript { console.log(vaultProxyClone, ": StakeVault (proxy clone)"); console.log(address(simpleKarmaDistributor), ": SimpleKarmaDistributor (proxy)"); console.log(simpleKarmaDistributorImpl, ": SimpleKarmaDistributor (implementation)"); + console.log(address(karmaTiers), ": KarmaTiers"); /// INITIALIZATION vm.startBroadcast(broadcaster); diff --git a/status-network-contracts/src/KarmaTiers.sol b/status-network-contracts/src/KarmaTiers.sol index 1f0fa0b022..3a7e3c7e89 100644 --- a/status-network-contracts/src/KarmaTiers.sol +++ b/status-network-contracts/src/KarmaTiers.sol @@ -81,7 +81,7 @@ contract KarmaTiers is Ownable { Tier calldata input = newTiers[i]; _validateTierName(input.name); - if (input.maxKarma <= input.minKarma) { + if (input.maxKarma < input.minKarma) { revert InvalidTierRange(input.minKarma, input.maxKarma); } diff --git a/status-network-contracts/test/KarmaTiers.t.sol b/status-network-contracts/test/KarmaTiers.t.sol index 3c148a2319..d5bd520039 100644 --- a/status-network-contracts/test/KarmaTiers.t.sol +++ b/status-network-contracts/test/KarmaTiers.t.sol @@ -122,4 +122,23 @@ contract KarmaTiersTest is Test { assertEq(karmaTiers.getTierIdByKarmaBalance(200), 1); assertEq(karmaTiers.getTierIdByKarmaBalance(250), 1); } + + function test_Success_When_MinKarmaEqualsMaxKarma() public { + KarmaTiers.Tier[] memory newTiers = new KarmaTiers.Tier[](3); + newTiers[0] = KarmaTiers.Tier({ minKarma: 0, maxKarma: 0, name: "Zero", txPerEpoch: 1 }); + newTiers[1] = KarmaTiers.Tier({ minKarma: 1, maxKarma: 1, name: "One", txPerEpoch: 2 }); + newTiers[2] = KarmaTiers.Tier({ minKarma: 2, maxKarma: 100, name: "High", txPerEpoch: 10 }); + + vm.expectEmit(false, false, false, true); + emit KarmaTiers.TiersUpdated(); + + vm.prank(owner); + karmaTiers.updateTiers(newTiers); + + assertEq(karmaTiers.getTierCount(), 3); + assertEq(karmaTiers.getTierIdByKarmaBalance(0), 0); + assertEq(karmaTiers.getTierIdByKarmaBalance(1), 1); + assertEq(karmaTiers.getTierIdByKarmaBalance(2), 2); + assertEq(karmaTiers.getTierIdByKarmaBalance(50), 2); + } }