From 74522424e6e2c9ae45cc1fb8150ae33fa123f24a Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Thu, 10 Oct 2024 18:23:11 +0200 Subject: [PATCH] chore: update gas reports --- .gas-report | 58 +++++++++++++++++++++++++++++++++++++------------ .gas-snapshot | 60 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 81 insertions(+), 37 deletions(-) diff --git a/.gas-report b/.gas-report index aecda42..673a871 100644 --- a/.gas-report +++ b/.gas-report @@ -15,21 +15,40 @@ | src/RewardsStreamerMP.sol:RewardsStreamerMP contract | | | | | | |------------------------------------------------------|-----------------|--------|--------|--------|---------| | Deployment Cost | Deployment Size | | | | | -| 1105804 | 4983 | | | | | +| 1114894 | 5025 | | | | | | Function Name | min | avg | median | max | # calls | | MAX_LOCKING_PERIOD | 228 | 228 | 228 | 228 | 18 | -| MAX_MULTIPLIER | 229 | 229 | 229 | 229 | 24 | +| MAX_MULTIPLIER | 274 | 274 | 274 | 274 | 34 | | MIN_LOCKING_PERIOD | 229 | 229 | 229 | 229 | 8 | -| SCALE_FACTOR | 251 | 251 | 251 | 251 | 28 | -| accountedRewards | 373 | 963 | 373 | 2373 | 44 | -| getUserInfo | 1553 | 1553 | 1553 | 1553 | 41 | -| potentialMP | 330 | 330 | 330 | 330 | 44 | -| rewardIndex | 373 | 418 | 373 | 2373 | 44 | -| stake | 167821 | 215459 | 228608 | 249401 | 35 | -| totalMP | 352 | 352 | 352 | 352 | 44 | -| totalStaked | 330 | 330 | 330 | 330 | 44 | +| MP_RATE_PER_YEAR | 231 | 231 | 231 | 231 | 2 | +| SCALE_FACTOR | 251 | 251 | 251 | 251 | 30 | +| accountedRewards | 373 | 921 | 373 | 2373 | 62 | +| getUserInfo | 1531 | 1531 | 1531 | 1531 | 61 | +| potentialMP | 330 | 330 | 330 | 330 | 62 | +| rewardIndex | 373 | 405 | 373 | 2373 | 62 | +| stake | 167787 | 215055 | 228586 | 249379 | 43 | +| totalMP | 352 | 352 | 352 | 352 | 62 | +| totalStaked | 373 | 373 | 373 | 373 | 62 | | unstake | 75511 | 107650 | 110519 | 134250 | 10 | -| updateGlobalState | 30008 | 69159 | 80335 | 80335 | 10 | +| updateGlobalState | 30008 | 57540 | 50309 | 80335 | 22 | +| updateUserMP | 29022 | 38080 | 40060 | 40060 | 16 | + + +| src/XPToken.sol:XPToken contract | | | | | | +|----------------------------------|-----------------|-------|--------|-------|---------| +| Deployment Cost | Deployment Size | | | | | +| 725645 | 3153 | | | | | +| Function Name | min | avg | median | max | # calls | +| addXPProvider | 23968 | 57184 | 51091 | 68191 | 18 | +| allowance | 488 | 488 | 488 | 488 | 1 | +| approve | 390 | 390 | 390 | 390 | 1 | +| balanceOf | 8808 | 14560 | 11066 | 23808 | 3 | +| getXPProviders | 1033 | 3286 | 3286 | 5539 | 2 | +| removeXPProvider | 23665 | 28074 | 25780 | 34777 | 3 | +| setTotalSupply | 23792 | 26266 | 26266 | 28740 | 2 | +| totalSupply | 363 | 1863 | 2363 | 2363 | 4 | +| transfer | 411 | 411 | 411 | 411 | 1 | +| transferFrom | 521 | 521 | 521 | 521 | 1 | | test/mocks/MockToken.sol:MockToken contract | | | | | | @@ -37,11 +56,22 @@ | Deployment Cost | Deployment Size | | | | | | 639406 | 3369 | | | | | | Function Name | min | avg | median | max | # calls | -| approve | 46346 | 46346 | 46346 | 46346 | 120 | -| balanceOf | 561 | 1327 | 561 | 2561 | 201 | -| mint | 51284 | 58124 | 51284 | 68384 | 120 | +| approve | 46346 | 46346 | 46346 | 46346 | 150 | +| balanceOf | 561 | 1321 | 561 | 2561 | 271 | +| mint | 51284 | 58124 | 51284 | 68384 | 150 | | transfer | 34390 | 48070 | 51490 | 51490 | 10 | +| test/mocks/XPProviderMock.sol:XPProviderMock contract | | | | | | +|-------------------------------------------------------|-----------------|-------|--------|-------|---------| +| Deployment Cost | Deployment Size | | | | | +| 152145 | 489 | | | | | +| Function Name | min | avg | median | max | # calls | +| getTotalXPShares | 302 | 968 | 302 | 2302 | 6 | +| getUserXPShare | 504 | 1837 | 2504 | 2504 | 6 | +| setTotalXPShares | 43632 | 43632 | 43632 | 43632 | 2 | +| setUserXPShare | 43900 | 43900 | 43900 | 43900 | 2 | + + diff --git a/.gas-snapshot b/.gas-snapshot index 11a2fd5..ca08778 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,24 +1,38 @@ -IntegrationTest:testStake() (gas: 1378213) +IntegrationTest:testStake() (gas: 1378182) RewardsStreamerTest:testStake() (gas: 869874) -StakeTest:test_StakeMultipleAccounts() (gas: 438756) -StakeTest:test_StakeMultipleAccountsAndRewards() (gas: 586002) -StakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 449214) -StakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 470881) -StakeTest:test_StakeOneAccount() (gas: 267795) -StakeTest:test_StakeOneAccountAndRewards() (gas: 415039) -StakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 284120) -StakeTest:test_StakeOneAccountWithMinLockUp() (gas: 284152) -StakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 284196) -UnstakeTest:test_StakeMultipleAccounts() (gas: 438778) -UnstakeTest:test_StakeMultipleAccountsAndRewards() (gas: 586002) -UnstakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 449214) -UnstakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 470903) -UnstakeTest:test_StakeOneAccount() (gas: 267795) -UnstakeTest:test_StakeOneAccountAndRewards() (gas: 415061) -UnstakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 284120) -UnstakeTest:test_StakeOneAccountWithMinLockUp() (gas: 284152) -UnstakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 284196) -UnstakeTest:test_UnstakeMultipleAccounts() (gas: 616327) -UnstakeTest:test_UnstakeMultipleAccountsAndRewards() (gas: 937593) -UnstakeTest:test_UnstakeOneAccount() (gas: 446306) -UnstakeTest:test_UnstakeOneAccountAndRewards() (gas: 557157) \ No newline at end of file +StakeTest:test_StakeMultipleAccounts() (gas: 438733) +StakeTest:test_StakeMultipleAccountsAndRewards() (gas: 586000) +StakeTest:test_StakeMultipleAccountsMPIncreasesPotentialMPDecreases() (gas: 761311) +StakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 449348) +StakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 471037) +StakeTest:test_StakeOneAccount() (gas: 267794) +StakeTest:test_StakeOneAccountAndRewards() (gas: 415103) +StakeTest:test_StakeOneAccountMPIncreasesPotentialMPDecreases() (gas: 484709) +StakeTest:test_StakeOneAccountReachingMPLimit() (gas: 446674) +StakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 284253) +StakeTest:test_StakeOneAccountWithMinLockUp() (gas: 284263) +StakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 284307) +UnstakeTest:test_StakeMultipleAccounts() (gas: 438755) +UnstakeTest:test_StakeMultipleAccountsAndRewards() (gas: 586045) +UnstakeTest:test_StakeMultipleAccountsMPIncreasesPotentialMPDecreases() (gas: 761245) +UnstakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 449348) +UnstakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 471059) +UnstakeTest:test_StakeOneAccount() (gas: 267794) +UnstakeTest:test_StakeOneAccountAndRewards() (gas: 415125) +UnstakeTest:test_StakeOneAccountMPIncreasesPotentialMPDecreases() (gas: 484709) +UnstakeTest:test_StakeOneAccountReachingMPLimit() (gas: 446696) +UnstakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 284276) +UnstakeTest:test_StakeOneAccountWithMinLockUp() (gas: 284263) +UnstakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 284352) +UnstakeTest:test_UnstakeMultipleAccounts() (gas: 616281) +UnstakeTest:test_UnstakeMultipleAccountsAndRewards() (gas: 937677) +UnstakeTest:test_UnstakeOneAccount() (gas: 446369) +UnstakeTest:test_UnstakeOneAccountAndRewards() (gas: 557220) +XPTokenTest:testAddXPProviderOnlyOwner() (gas: 285732) +XPTokenTest:testBalanceOf() (gas: 210530) +XPTokenTest:testBalanceOfWithNoSystemTotalXP() (gas: 45808) +XPTokenTest:testRemoveXPProviderIndexOutOfBounds() (gas: 36277) +XPTokenTest:testRemoveXPProviderOnlyOwner() (gas: 72074) +XPTokenTest:testSetTotalSupplyOnlyOwner() (gas: 70544) +XPTokenTest:testTotalSupply() (gas: 10507) +XPTokenTest:testTransfersNotAllowed() (gas: 20634)