opt : skip RP update in withdraw if no debt#1213
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes Spoke.withdraw() by avoiding a full user account refresh + risk premium update when the withdrawing user has no active borrows, reducing gas usage in the common “withdraw while not borrowing” path.
Changes:
- Skip
_refreshAndValidateUserAccountData()+_notifyRiskPremiumUpdate()inwithdraw()unless the user is both using the reserve as collateral and has at least one borrow. - Update gas snapshot JSONs to reflect the new operation costs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/spoke/Spoke.sol |
Adds a borrow-existence check before triggering risk premium refresh on withdrawals. |
snapshots/Spoke.Operations.json |
Updates measured gas values for withdraw operations. |
snapshots/Spoke.Operations.ZeroRiskPremium.json |
Updates measured gas values for withdraw operations under zero-risk-premium scenario. |
snapshots/SignatureGateway.Operations.json |
Updates measured gas value for withdrawWithSig. |
snapshots/NativeTokenGateway.Operations.json |
Updates measured gas values for native withdraw operations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
♻️ Forge Gas Snapshots
🔕 Unchanged
|
🌈 Test ResultsNo files changed, compilation skipped
Ran 4 tests for tests/unit/Spoke/Spoke.PermitReserve.t.sol:SpokePermitReserveTest
[PASS] test_permitReserve() (gas: 88227)
[PASS] test_permitReserve_forwards_correct_call() (gas: 35554)
[PASS] test_permitReserve_ignores_permit_reverts() (gas: 24390)
[PASS] test_permitReserve_revertsWith_ReserveNotListedIn() (gas: 22949)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 36.53ms (1.52ms CPU time)
Ran 13 tests for tests/unit/Spoke/Liquidations/Spoke.LiquidationCall.Scenarios.t.sol:SpokeLiquidationCallScenariosTest
[PASS] test_liquidationCall_revertsWith_ReentrancyGuardReentrantCall_hubRefreshPremium() (gas: 26106530)
[PASS] test_liquidationCall_revertsWith_ReentrancyGuardReentrantCall_hubRemove() (gas: 25978185)
[PASS] test_liquidationCall_revertsWith_ReentrancyGuardReentrantCall_hubReportDeficit() (gas: 26089304)
[PASS] test_liquidationCall_revertsWith_ReentrancyGuardReentrantCall_hubRestore() (gas: 26053591)
[PASS] test_liquidationCall_scenario1() (gas: 3855259)
[PASS] test_liquidationCall_scenario2() (gas: 3863585)
[PASS] test_liquidationCall_scenario3() (gas: 3332566)
[PASS] test_liquidationCall_scenario4() (gas: 27645661)
[PASS] test_liquidationCall_scenario5() (gas: 3470220)
[PASS] test_liquidationCall_scenario6() (gas: 2305391)
[PASS] test_liquidationCall_scenario7() (gas: 3049621)
[PASS] test_scenario_halted_asset() (gas: 26730923)
[PASS] test_scenario_halted_asset_with_deficit() (gas: 26574052)
Suite result: ok. 13 passed; 0 failed; 0 skipped; finished in 162.80ms (131.76ms CPU time)
Ran 10 tests for tests/unit/Spoke/Spoke.PositionManager.t.sol:SpokePositionManagerTest
[PASS] test_onlyPositionManager_on_borrow() (gas: 538423)
[PASS] test_onlyPositionManager_on_repay() (gas: 563668)
[PASS] test_onlyPositionManager_on_supply() (gas: 291767)
[PASS] test_onlyPositionManager_on_updateUserDynamicConfig() (gas: 1284339)
[PASS] test_onlyPositionManager_on_updateUserRiskPremium() (gas: 1520970)
[PASS] test_onlyPositionManager_on_usingAsCollateral() (gas: 144395)
[PASS] test_onlyPositionManager_on_withdraw() (gas: 320773)
[PASS] test_renouncePositionManagerRole() (gas: 20268)
[PASS] test_renouncePositionManagerRole_noop_from_disabled() (gas: 21904)
[PASS] test_setApprovalForPositionManager(bytes32) (runs: 5000, μ: 18111, ~: 18111)
Suite result: ok. 10 passed; 0 failed; 0 skipped; finished in 427.35ms (396.48ms CPU time)
Ran 20 tests for tests/unit/AaveOracle.t.sol:AaveOracleTest
[PASS] test_DECIMALS() (gas: 8326)
[PASS] test_constructor() (gas: 18428)
[PASS] test_description() (gas: 12039)
[PASS] test_fuzz_constructor(uint8) (runs: 5000, μ: 19888, ~: 20214)
Logs:
Bound result 1
[PASS] test_getReservePrice() (gas: 48776)
[PASS] test_getReservePrice_revertsWith_InvalidPrice() (gas: 48047)
[PASS] test_getReservePrice_revertsWith_InvalidSource() (gas: 10898)
[PASS] test_getReservePrices() (gas: 80715)
[PASS] test_getReservePrices_revertsWith_InvalidSource() (gas: 50930)
[PASS] test_getReserveSource() (gas: 48946)
[PASS] test_setReserveSource() (gas: 45988)
[PASS] test_setReserveSource_revertsWith_InvalidPrice() (gas: 102779)
[PASS] test_setReserveSource_revertsWith_InvalidSource() (gas: 17228)
[PASS] test_setReserveSource_revertsWith_InvalidSourceDecimals() (gas: 17065)
[PASS] test_setReserveSource_revertsWith_OnlySpoke() (gas: 13021)
[PASS] test_setReserveSource_revertsWith_OracleMismatch() (gas: 5065953)
[PASS] test_setSpoke() (gas: 5093853)
[PASS] test_setSpoke_revertsWith_InvalidAddress() (gas: 10870)
[PASS] test_setSpoke_revertsWith_OnlyDeployer(address) (runs: 5000, μ: 13397, ~: 13397)
[PASS] test_setSpoke_revertsWith_SpokeAlreadySet() (gas: 15080)
Suite result: ok. 20 passed; 0 failed; 0 skipped; finished in 1.20s (1.18s CPU time)
Ran 6 tests for tests/unit/Spoke/Spoke.Withdraw.Validation.t.sol:SpokeWithdrawValidationTest
[PASS] test_withdraw_fuzz_revertsWith_InsufficientLiquidity_with_debt(uint256,uint256,uint256,uint256,uint256) (runs: 5000, μ: 430333, ~: 430437)
Logs:
Bound result 0
Bound result 2000000000000000000000000000
Bound result 10000000000000000
Bound result 1024
Bound result 13259
[PASS] test_withdraw_fuzz_revertsWith_InsufficientSupply_zero_supplied(uint256) (runs: 5000, μ: 55105, ~: 54812)
Logs:
Bound result 3124043968137
[PASS] test_withdraw_revertsWith_InsufficientLiquidity_with_debt() (gas: 426855)
[PASS] test_withdraw_revertsWith_InvalidAmount_zero_supplied() (gas: 51432)
[PASS] test_withdraw_revertsWith_ReserveNotListed() (gas: 22408)
[PASS] test_withdraw_revertsWith_ReservePaused() (gas: 62929)
Suite result: ok. 6 passed; 0 failed; 0 skipped; finished in 5.82s (5.78s CPU time)
Ran 7 tests for tests/unit/Spoke/Spoke.Repay.EdgeCases.t.sol:SpokeRepayEdgeCaseTest
[PASS] test_fuzz_repay_effect_on_ex_rates(uint256,uint256) (runs: 5000, μ: 701033, ~: 700944)
Logs:
Bound result 35501130209312477671297542722
Bound result 730957301
Bound result 40922684243458790614927555118
[PASS] test_repay_less_than_share() (gas: 599973)
[PASS] test_repay_only_base_debt_interest() (gas: 766149)
[PASS] test_repay_only_base_debt_no_premium() (gas: 644239)
[PASS] test_repay_supply_ex_rate_decr() (gas: 1460027)
[PASS] test_repay_supply_ex_rate_decr_skip_time() (gas: 1456643)
[PASS] test_repay_zero_shares_nonzero_premium_debt() (gas: 764072)
Suite result: ok. 7 passed; 0 failed; 0 skipped; finished in 15.70s (15.67s CPU time)
Ran 20 tests for tests/unit/AccessManagerEnumerable.t.sol:AccessManagerEnumerableTest
[PASS] test_getRoleMembers_fuzz(uint256,uint256) (runs: 5000, μ: 1981627, ~: 1980422)
Logs:
Bound result 9
Bound result 10
[PASS] test_getRoleTargetSelectors_fuzz(uint256,uint256) (runs: 5000, μ: 1528912, ~: 1527977)
Logs:
Bound result 9
Bound result 10
[PASS] test_grantRole() (gas: 315853)
[PASS] test_grantRole_fuzz(uint64,uint256) (runs: 5000, μ: 915080, ~: 919819)
Logs:
Bound result 5
[PASS] test_renounceRole() (gas: 320971)
[PASS] test_renounceRole_shouldNotTrack() (gas: 24510)
[PASS] test_revokeRole() (gas: 323142)
[PASS] test_revokeRole_shouldNotTrack() (gas: 33091)
[PASS] test_setRoleAdmin_fuzz_trackAdminRoles_multipleRoles_multipleAdmins(uint256) (runs: 5000, μ: 2153968, ~: 2256960)
Logs:
Bound result 12
[PASS] test_setRoleAdmin_fuzz_trackRolesAndTrackAdminRoles_multipleRoles(uint256) (runs: 5000, μ: 1968386, ~: 2114243)
Logs:
Bound result 12
[PASS] test_setRoleAdmin_trackAdminOfRoles() (gas: 605988)
[PASS] test_setRoleAdmin_trackAdminOfRoles_changeAdminRole() (gas: 576953)
[PASS] test_setRoleAdmin_trackAdminRoles() (gas: 602234)
[PASS] test_setRoleAdmin_trackRolesAndTrackAdminRoles() (gas: 378157)
[PASS] test_setRoleGuardian_trackRoles() (gas: 263878)
[PASS] test_setTargetFunctionRole() (gas: 414440)
[PASS] test_setTargetFunctionRole_multipleTargets() (gas: 1103888)
[PASS] test_setTargetFunctionRole_removeTarget() (gas: 894968)
[PASS] test_setTargetFunctionRole_skipAddToAdminRole() (gas: 30951)
[PASS] test_setTargetFunctionRole_withReplace() (gas: 548994)
Suite result: ok. 20 passed; 0 failed; 0 skipped; finished in 22.61s (22.61s CPU time)
Ran 23 tests for tests/unit/AssetInterestRateStrategy.t.sol:AssetInterestRateStrategyTest
[PASS] test_calculateInterestRate_AtKinkPoint() (gas: 24326)
Logs:
Bound result 2000
Bound result 778565440757296803935461404101
[PASS] test_calculateInterestRate_AtMaxUtilization() (gas: 24621)
Logs:
Bound result 10000
Bound result 778565440757296803935461404101
[PASS] test_calculateInterestRate_LeftToKinkPoint(uint256) (runs: 5000, μ: 24187, ~: 24330)
Logs:
Bound result 137
Bound result 252173843969976304268974536488
[PASS] test_calculateInterestRate_RightToKinkPoint(uint256) (runs: 5000, μ: 25302, ~: 25351)
Logs:
Bound result 8137
Bound result 252173843969976304268974536488
[PASS] test_calculateInterestRate_ZeroDebtZeroLiquidity() (gas: 18771)
Logs:
Bound result 0
[PASS] test_calculateInterestRate_fuzz_ZeroDebt(uint256) (runs: 5000, μ: 19072, ~: 18822)
Logs:
Bound result 3124043968137
[PASS] test_calculateInterestRate_revertsWith_InterestRateDataNotSet() (gas: 11225)
[PASS] test_deploy_revertsWith_InvalidAddress() (gas: 3746)
[PASS] test_getBaseVariableBorrowRate() (gas: 14812)
[PASS] test_getInterestRateData() (gas: 19290)
[PASS] test_getMaxVariableBorrowRate() (gas: 15258)
[PASS] test_getOptimalUsageRatio() (gas: 14705)
[PASS] test_getVariableRateSlope1() (gas: 14791)
[PASS] test_getVariableRateSlope2() (gas: 14746)
[PASS] test_maxBorrowRate() (gas: 8312)
[PASS] test_maxOptimalRatio() (gas: 8312)
[PASS] test_minOptimalRatio() (gas: 8321)
[PASS] test_setInterestRateData() (gas: 68999)
[PASS] test_setInterestRateData_revertsWith_InvalidMaxRate() (gas: 41819)
[PASS] test_setInterestRateData_revertsWith_InvalidOptimalUsageRatio() (gas: 42380)
[PASS] test_setInterestRateData_revertsWith_InvalidRateData() (gas: 35269)
[PASS] test_setInterestRateData_revertsWith_OnlyHub() (gas: 23502)
[PASS] test_setInterestRateData_revertsWith_Slope2MustBeGteSlope1() (gas: 37658)
Suite result: ok. 23 passed; 0 failed; 0 skipped; finished in 1.13s (1.12s CPU time)
Ran 14 tests for tests/unit/misc/EIP712Hash.t.sol:EIP712HashTest
[PASS] test_constants() (gas: 18335)
[PASS] test_hash_borrow_fuzz((address,uint256,uint256,address,uint256,uint256)) (runs: 5000, μ: 6689, ~: 6689)
[PASS] test_hash_positionManagerUpdate_fuzz((address,bool)) (runs: 5000, μ: 5361, ~: 5361)
[PASS] test_hash_repay_fuzz((address,uint256,uint256,address,uint256,uint256)) (runs: 5000, μ: 6734, ~: 6734)
[PASS] test_hash_setUserPositionManagers_fuzz((address,(address,bool)[],uint256,uint256)) (runs: 5000, μ: 278419, ~: 277841)
[PASS] test_hash_setUsingAsCollateral_fuzz((address,uint256,bool,address,uint256,uint256)) (runs: 5000, μ: 7148, ~: 7148)
[PASS] test_hash_supply_fuzz((address,uint256,uint256,address,uint256,uint256)) (runs: 5000, μ: 6755, ~: 6755)
[PASS] test_hash_tokenizedDeposit_fuzz((address,uint256,address,uint256,uint256)) (runs: 5000, μ: 6561, ~: 6561)
[PASS] test_hash_tokenizedMint_fuzz((address,uint256,address,uint256,uint256)) (runs: 5000, μ: 6538, ~: 6538)
[PASS] test_hash_tokenizedRedeem_fuzz((address,uint256,address,uint256,uint256)) (runs: 5000, μ: 6561, ~: 6561)
[PASS] test_hash_tokenizedWithdraw_fuzz((address,uint256,address,uint256,uint256)) (runs: 5000, μ: 6582, ~: 6582)
[PASS] test_hash_updateUserDynamicConfig_fuzz((address,address,uint256,uint256)) (runs: 5000, μ: 6349, ~: 6349)
[PASS] test_hash_updateUserRiskPremium_fuzz((address,address,uint256,uint256)) (runs: 5000, μ: 6348, ~: 6348)
[PASS] test_hash_withdraw_fuzz((address,uint256,uint256,address,uint256,uint256)) (runs: 5000, μ: 6711, ~: 6711)
Suite result: ok. 14 passed; 0 failed; 0 skipped; finished in 19.83s (19.83s CPU time)
Ran 14 tests for tests/unit/Spoke/Spoke.Withdraw.t.sol:SpokeWithdrawTest
[PASS] test_fuzz_withdraw_effect_on_ex_rates(uint256,uint256) (runs: 5000, μ: 730661, ~: 732615)
Logs:
Bound result 100
Bound result 68691281934999
[PASS] test_withdraw_all_liquidity() (gas: 238643)
[PASS] test_withdraw_all_liquidity_with_interest_no_premium() (gas: 798210)
[PASS] test_withdraw_all_liquidity_with_interest_with_premium() (gas: 805741)
[PASS] test_withdraw_fuzz_all_elapsed_with_interest(uint256,uint256,uint40) (runs: 5000, μ: 652513, ~: 652428)
Logs:
Bound result 415250750193385653249839645126
Bound result 193534747585829059132444755694
Bound result 3
[PASS] test_withdraw_fuzz_all_greater_than_supplied(uint256) (runs: 5000, μ: 241669, ~: 241461)
Logs:
Bound result 3124043968137
[PASS] test_withdraw_fuzz_all_liquidity_with_interest_no_premium((uint256,uint256,uint256,uint256,uint256)) (runs: 5000, μ: 871213, ~: 871728)
Logs:
Bound result 0
Bound result 2
Bound result 1
Bound result 2
Bound result 286517826
[PASS] test_withdraw_fuzz_all_liquidity_with_interest_with_premium((uint256,uint256,uint256,uint256,uint256)) (runs: 5000, μ: 875702, ~: 875763)
Logs:
Bound result 0
Bound result 2
Bound result 1
Bound result 2
Bound result 286517826
[PASS] test_withdraw_fuzz_all_with_interest(uint256,uint256) (runs: 5000, μ: 665672, ~: 665611)
Logs:
Bound result 68691281934999
Bound result 100
[PASS] test_withdraw_fuzz_suppliedAmount(uint256) (runs: 5000, μ: 243262, ~: 243054)
Logs:
Bound result 3124043968137
[PASS] test_withdraw_max_greater_than_supplied() (gas: 222088)
[PASS] test_withdraw_revertsWith_ReentrancyGuardReentrantCall_hubRefreshPremium() (gas: 654946)
[PASS] test_withdraw_revertsWith_ReentrancyGuardReentrantCall_hubRemove() (gas: 402082)
[PASS] test_withdraw_same_block() (gas: 243772)
Suite result: ok. 14 passed; 0 failed; 0 skipped; finished in 73.89s (73.87s CPU time)
Ran 16 tests for tests/unit/SpokeConfigurator.GranularAccessControl.t.sol:SpokeConfiguratorGranularAccessControlTest
[PASS] test_fuzz_unauthorized_cannotCall_liquidationConfigManagerMethods(address) (runs: 5000, μ: 117059, ~: 117059)
[PASS] test_fuzz_unauthorized_cannotCall_positionManagerAdminMethods(address) (runs: 5000, μ: 39761, ~: 39761)
[PASS] test_fuzz_unauthorized_cannotCall_reserveManagerMethods(address) (runs: 5000, μ: 483447, ~: 483447)
[PASS] test_liquidationConfigManager_canCall_updateLiquidationConfig() (gas: 62503)
[PASS] test_liquidationConfigManager_canCall_updateLiquidationTargetHealthFactor() (gas: 62044)
[PASS] test_liquidationConfigManager_cannotCall_anyPositionManagerAdminMethod() (gas: 38976)
[PASS] test_liquidationConfigManager_cannotCall_anyReserveMethod() (gas: 486121)
[PASS] test_positionManagerAdmin_canCall_updatePositionManager() (gas: 75206)
[PASS] test_positionManagerAdmin_cannotCall_anyLiquidationConfigMethod() (gas: 117021)
[PASS] test_positionManagerAdmin_cannotCall_anyReserveMethod() (gas: 485869)
[PASS] test_reserveManager_canCall_freezeAllReserves() (gas: 156806)
[PASS] test_reserveManager_canCall_pauseAllReserves() (gas: 156791)
[PASS] test_reserveManager_canCall_updateFrozen() (gas: 65173)
[PASS] test_reserveManager_canCall_updatePaused() (gas: 65119)
[PASS] test_reserveManager_cannotCall_anyLiquidationConfigMethod() (gas: 116976)
[PASS] test_reserveManager_cannotCall_anyPositionManagerAdminMethod() (gas: 38975)
Suite result: ok. 16 passed; 0 failed; 0 skipped; finished in 6.28s (6.25s CPU time)
Ran 51 tests for tests/unit/SpokeConfigurator.t.sol:SpokeConfiguratorTest
[PASS] test_addCollateralFactor() (gas: 125612)
[PASS] test_addCollateralFactor_revertsWith_AccessManagedUnauthorized() (gas: 29173)
[PASS] test_addDynamicReserveConfig() (gas: 105426)
[PASS] test_addDynamicReserveConfig_revertsWith_AccessManagedUnauthorized() (gas: 29344)
[PASS] test_addLiquidationBonus_revertsWith_AccessManagedUnauthorized() (gas: 29072)
[PASS] test_addLiquidationFee() (gas: 125599)
[PASS] test_addLiquidationFee_revertsWith_AccessManagedUnauthorized() (gas: 29073)
[PASS] test_addMaxLiquidationBonus() (gas: 125649)
[PASS] test_addReserve() (gas: 456691)
[PASS] test_addReserve_revertsWith_AccessManagedUnauthorized() (gas: 30019)
[PASS] test_addReserve_revertsWith_MaximumReservesReached() (gas: 289228)
[PASS] test_freezeAllReserves() (gas: 202537)
[PASS] test_freezeAllReserves_revertsWith_AccessManagedUnauthorized() (gas: 26853)
[PASS] test_freezeReserve() (gas: 72270)
[PASS] test_freezeReserve_revertsWith_AccessManagedUnauthorized() (gas: 28955)
[PASS] test_pauseAllReserves() (gas: 202439)
[PASS] test_pauseAllReserves_revertsWith_AccessManagedUnauthorized() (gas: 26808)
[PASS] test_pauseReserve() (gas: 72242)
[PASS] test_pauseReserve_revertsWith_AccessManagedUnauthorized() (gas: 28976)
[PASS] test_updateBorrowable() (gas: 102761)
[PASS] test_updateBorrowable_revertsWith_AccessManagedUnauthorized() (gas: 29057)
[PASS] test_updateCollateralFactor() (gas: 82716)
[PASS] test_updateCollateralFactor_revertsWith_AccessManagedUnauthorized() (gas: 29198)
[PASS] test_updateCollateralRisk() (gas: 76914)
[PASS] test_updateCollateralRisk_revertsWith_AccessManagedUnauthorized() (gas: 29028)
[PASS] test_updateDynamicReserveConfig() (gas: 201314)
[PASS] test_updateDynamicReserveConfig_revertsWith_AccessManagedUnauthorized() (gas: 29433)
[PASS] test_updateFrozen() (gas: 105528)
[PASS] test_updateFrozen_revertsWith_AccessManagedUnauthorized() (gas: 29056)
[PASS] test_updateHealthFactorForMaxBonus() (gas: 68162)
[PASS] test_updateHealthFactorForMaxBonus_revertsWith_AccessManagedUnauthorized() (gas: 26799)
[PASS] test_updateLiquidationBonusFactor() (gas: 71077)
[PASS] test_updateLiquidationBonusFactor_revertsWith_AccessManagedUnauthorized() (gas: 26844)
[PASS] test_updateLiquidationConfig() (gas: 65754)
[PASS] test_updateLiquidationConfig_revertsWith_AccessManagedUnauthorized() (gas: 27193)
[PASS] test_updateLiquidationFee() (gas: 82776)
[PASS] test_updateLiquidationFee_revertsWith_AccessManagedUnauthorized() (gas: 29173)
[PASS] test_updateLiquidationTargetHealthFactor() (gas: 71040)
[PASS] test_updateLiquidationTargetHealthFactor_revertsWith_AccessManagedUnauthorized() (gas: 26909)
[PASS] test_updateMaxLiquidationBonus() (gas: 82712)
[PASS] test_updateMaxLiquidationBonus_revertsWith_AccessManagedUnauthorized() (gas: 29109)
[PASS] test_updateMaxReserves() (gas: 53669)
[PASS] test_updateMaxReserves_revertsWith_AccessManagedUnauthorized() (gas: 26909)
[PASS] test_updatePaused() (gas: 105530)
[PASS] test_updatePaused_revertsWith_AccessManagedUnauthorized() (gas: 29077)
[PASS] test_updatePositionManager() (gas: 74325)
[PASS] test_updatePositionManager_revertsWith_AccessManagedUnauthorized() (gas: 26996)
[PASS] test_updateReceiveSharesEnabled() (gas: 102858)
[PASS] test_updateReceiveSharesEnabled_revertsWith_AccessManagedUnauthorized() (gas: 29121)
[PASS] test_updateReservePriceSource() (gas: 280160)
[PASS] test_updateReservePriceSource_revertsWith_AccessManagedUnauthorized() (gas: 29052)
Suite result: ok. 51 passed; 0 failed; 0 skipped; finished in 40.14ms (14.50ms CPU time)
Ran 6 tests for tests/unit/libraries/SpokeUtils.t.sol:SpokeUtilsTest
[PASS] test_fuzz_toValue(uint256,uint256,uint256) (runs: 5000, μ: 15785, ~: 15844)
Logs:
Bound result 615514462186775432459
Bound result 9
Bound result 9140094126966428
[PASS] test_get() (gas: 180696)
[PASS] test_get_revertsWith_ReserveNotListed() (gas: 167195)
[PASS] test_toValue() (gas: 8806)
[PASS] test_toValue_revertsWith_ArithmeticOverflow() (gas: 8959)
[PASS] test_toValue_revertsWith_ArithmeticUnderflow() (gas: 8734)
Suite result: ok. 6 passed; 0 failed; 0 skipped; finished in 446.07ms (421.96ms CPU time)
Ran 4 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.Config.t.sol:TokenizationSpokeConfigTest
[PASS] test_configuration() (gas: 22899)
[PASS] test_constructor_asset_correctly_set() (gas: 42793)
[PASS] test_constructor_reverts_when_invalid_setup() (gas: 12222)
[PASS] test_setUp() (gas: 69892)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 26.01ms (1.07ms CPU time)
Ran 7 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.Constants.t.sol:TokenizationSpokeConstantsTest
[PASS] test_DOMAIN_SEPARATOR() (gas: 14481)
[PASS] test_deposit_typeHash() (gas: 15183)
[PASS] test_eip712Domain() (gas: 19690)
[PASS] test_mint_typeHash() (gas: 15232)
[PASS] test_permit_typeHash() (gas: 15126)
[PASS] test_redeem_typeHash() (gas: 15126)
[PASS] test_withdraw_typeHash() (gas: 15129)
Suite result: ok. 7 passed; 0 failed; 0 skipped; finished in 26.55ms (1.96ms CPU time)
Ran 4 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.DepositWithPermit.t.sol:TokenizationSpokeDepositWithPermitTest
[PASS] test_depositWithPermit() (gas: 238120)
[PASS] test_depositWithPermit_forwards_correct_call() (gas: 194314)
[PASS] test_depositWithPermit_ignores_permit_reverts() (gas: 183502)
[PASS] test_depositWithPermit_works_with_existing_allowance() (gas: 203611)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 27.22ms (2.78ms CPU time)
Ran 3 tests for tests/unit/misc/ExtSload.t.sol:ExtSloadTest
[PASS] test_extSload(bytes32) (runs: 5000, μ: 9767, ~: 9767)
[PASS] test_extSloads(uint256) (runs: 5000, μ: 948716, ~: 917460)
Logs:
Bound result 812
[PASS] test_extSloads(uint256,bytes) (runs: 5000, μ: 1008978, ~: 975202)
Logs:
Bound result 362
Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 59.71s (59.71s CPU time)
Ran 8 tests for tests/unit/misc/GatewayBase.t.sol:GatewayBaseTest
[PASS] test_constructor() (gas: 17151)
[PASS] test_registerSpoke_fuzz(address) (runs: 5000, μ: 41629, ~: 41629)
[PASS] test_registerSpoke_revertsWith_InvalidAddress() (gas: 13119)
[PASS] test_registerSpoke_revertsWith_OwnableUnauthorizedAccount() (gas: 13791)
[PASS] test_registerSpoke_unregister() (gas: 36076)
[PASS] test_renouncePositionManagerRole() (gas: 65293)
[PASS] test_renouncePositionManagerRole_revertsWith_InvalidAddress() (gas: 74220)
[PASS] test_renouncePositionManagerRole_revertsWith_OwnableUnauthorizedAccount() (gas: 74439)
Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 386.76ms (362.84ms CPU time)
Ran 5 tests for tests/gas/Gateways.Operations.gas.t.sol:NativeTokenGateway_Gas_Tests
[PASS] test_borrowNative() (gas: 917897)
[PASS] test_repayNative() (gas: 989322)
[PASS] test_supplyAndCollateralNative() (gas: 305177)
[PASS] test_supplyNative() (gas: 286660)
[PASS] test_withdrawNative() (gas: 508809)
Suite result: ok. 5 passed; 0 failed; 0 skipped; finished in 48.04ms (4.09ms CPU time)
Ran 8 tests for tests/gas/Gateways.Operations.gas.t.sol:SignatureGateway_Gas_Tests
[PASS] test_borrowWithSig() (gas: 745226)
[PASS] test_repayWithSig() (gas: 953430)
[PASS] test_setSelfAsUserPositionManagerWithSig() (gas: 209285)
[PASS] test_setUsingAsCollateralWithSig() (gas: 289338)
[PASS] test_supplyWithSig() (gas: 434257)
[PASS] test_updateUserDynamicConfigWithSig() (gas: 145235)
[PASS] test_updateUserRiskPremiumWithSig() (gas: 143188)
[PASS] test_withdrawWithSig() (gas: 409949)
Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 51.08ms (7.72ms CPU time)
Ran 6 tests for tests/unit/Hub/Hub.Access.t.sol:HubAccessTest
[PASS] test_change_authority() (gas: 206679)
[PASS] test_change_role_responsibility() (gas: 121247)
[PASS] test_hub_access_manager_exposure() (gas: 13439)
[PASS] test_hub_admin_access() (gas: 1350377)
[PASS] test_migrate_role_responsibility() (gas: 708944)
[PASS] test_setInterestRateData_access() (gas: 102656)
Suite result: ok. 6 passed; 0 failed; 0 skipped; finished in 27.58ms (3.70ms CPU time)
Ran 19 tests for tests/unit/Hub/Hub.Add.t.sol:HubAddTest
[PASS] test_add_AddCapReachedButNotExceeded_rounding() (gas: 660714)
[PASS] test_add_fuzz_AddCapReachedButNotExceeded(uint40) (runs: 5000, μ: 157880, ~: 157837)
Logs:
Bound result 9
[PASS] test_add_fuzz_multi_asset_multi_spoke(uint256,uint256,uint256) (runs: 5000, μ: 332467, ~: 332622)
Logs:
Bound result 3
Bound result 218470873395738003579119570309
Bound result 446067553769140138733721804
[PASS] test_add_fuzz_revertsWith_AddCapExceeded(uint40) (runs: 5000, μ: 112436, ~: 112393)
Logs:
Bound result 9
[PASS] test_add_fuzz_revertsWith_AddCapExceeded_due_to_interest(uint40,uint256,uint256) (runs: 5000, μ: 263825, ~: 263690)
Logs:
Bound result 1291
Bound result 1071208440522043736492
Bound result 173721804
[PASS] test_add_fuzz_revertsWith_InvalidShares_due_to_index(uint256,uint256,uint256) (runs: 5000, μ: 220658, ~: 220858)
Logs:
Bound result 999999999900000000000000011670
Bound result 1453498402
Bound result 1
[PASS] test_add_fuzz_single_asset(uint256,address,uint256) (runs: 5000, μ: 342376, ~: 342395)
Logs:
Bound result 0
Bound result 993249421303875097280936080925
[PASS] test_add_fuzz_single_spoke_multi_add(uint256,uint256) (runs: 5000, μ: 785686, ~: 785711)
Logs:
Bound result 68691281934999
Bound result 100
[PASS] test_add_multi_add_minimal_shares() (gas: 316011)
[PASS] test_add_revertsWith_AmountDowncastOverflow() (gas: 357696)
[PASS] test_add_revertsWith_InsufficientTransferred() (gas: 64504)
[PASS] test_add_revertsWith_InvalidAmount() (gas: 13631)
[PASS] test_add_revertsWith_InvalidShares() (gas: 220197)
[PASS] test_add_revertsWith_SharesDowncastOverflow() (gas: 224358)
[PASS] test_add_revertsWith_SpokeHalted() (gas: 99705)
[PASS] test_add_revertsWith_SpokeNotActive() (gas: 99741)
[PASS] test_add_single_asset() (gas: 330246)
Logs:
Bound result 2
Bound result 100000000000000000000
[PASS] test_add_with_increased_index() (gas: 298042)
[PASS] test_add_with_increased_index_with_premium() (gas: 674207)
Suite result: ok. 19 passed; 0 failed; 0 skipped; finished in 43.61s (43.58s CPU time)
Ran 38 tests for tests/unit/Hub/Hub.Config.t.sol:HubConfigTest
[PASS] test_addAsset_fuzz(address,uint8,address) (runs: 5000, μ: 390345, ~: 390384)
Logs:
Bound result 18
[PASS] test_addAsset_fuzz_revertsWith_InvalidAddress_feeReceiver(address,uint8,address) (runs: 5000, μ: 45291, ~: 44992)
Logs:
Bound result 0
[PASS] test_addAsset_fuzz_revertsWith_InvalidAddress_irStrategy(address,uint8,address) (runs: 5000, μ: 45334, ~: 45035)
Logs:
Bound result 0
[PASS] test_addAsset_fuzz_revertsWith_InvalidAddress_underlying(uint8,address,address) (runs: 5000, μ: 36719, ~: 36719)
[PASS] test_addAsset_fuzz_revertsWith_InvalidAssetDecimals(address,uint8,address,address) (runs: 5000, μ: 45943, ~: 45986)
Logs:
Bound result 21
[PASS] test_addAsset_fuzz_revertsWith_InvalidAssetDecimals_tooLow(address,uint8,address,address) (runs: 5000, μ: 46020, ~: 46308)
Logs:
Bound result 2
[PASS] test_addAsset_fuzz_reverts_InvalidIrData(address,uint8,address,address) (runs: 5000, μ: 79054230656, ~: 34963)
Logs:
Bound result 2
[PASS] test_addAsset_revertsWith_BlockTimestampDowncastOverflow() (gas: 956634)
[PASS] test_addAsset_revertsWith_DrawnRateDowncastOverflow() (gas: 953770)
[PASS] test_addAsset_reverts_UnderlyingAlreadyListed() (gas: 48980)
[PASS] test_addSpoke_fuzz(uint256,(uint40,uint40,uint24,bool,bool)) (runs: 5000, μ: 126676, ~: 126726)
Logs:
Bound result 2
[PASS] test_addSpoke_fuzz_revertsWith_AssetNotListed(uint256,(uint40,uint40,uint24,bool,bool)) (runs: 5000, μ: 35246, ~: 35235)
Logs:
Bound result 23798
[PASS] test_addSpoke_fuzz_revertsWith_InvalidAddress_spoke(uint256,(uint40,uint40,uint24,bool,bool)) (runs: 5000, μ: 33929, ~: 33979)
Logs:
Bound result 2
[PASS] test_addSpoke_revertsWith_SpokeAlreadyListed() (gas: 39773)
[PASS] test_getAssetId() (gas: 73160)
[PASS] test_getAssetId_fuzz_revertsWith_AssetNotListed(address) (runs: 5000, μ: 18561, ~: 18561)
[PASS] test_hub_deploy_reverts_on_InvalidConstructorInput() (gas: 828431)
[PASS] test_hub_max_riskPremium() (gas: 8610)
[PASS] test_isUnderlyingListed() (gas: 1178402)
[PASS] test_updateAssetConfig_NewFeeReceiver_noFees() (gas: 716089)
[PASS] test_updateAssetConfig_NewFeeReceiver_revertsWith_SpokeNotActive_noFees() (gas: 613421)
[PASS] test_updateAssetConfig_UseExistingSpokeAndListedAsFeeReceiver_revertsWith_SpokeAlreadyListed() (gas: 70708)
[PASS] test_updateAssetConfig_fuzz(uint256,(address,uint16,address,address)) (runs: 5000, μ: 269265, ~: 269598)
Logs:
Bound result 1
Bound result 3866
[PASS] test_updateAssetConfig_fuzz_FromZeroLiquidityFee(uint256,uint16) (runs: 5000, μ: 819000, ~: 818822)
Logs:
Bound result 3
Bound result 1
Bound result 3
Bound result 0
Bound result 3
Bound result 1
[PASS] test_updateAssetConfig_fuzz_LiquidityFee(uint256,uint16) (runs: 5000, μ: 721404, ~: 721226)
Logs:
Bound result 3
Bound result 1
Bound result 3
Bound result 1
[PASS] test_updateAssetConfig_fuzz_NewFeeReceiver(uint256) (runs: 5000, μ: 820397, ~: 820396)
Logs:
Bound result 3
Bound result 3
Bound result 1000
[PASS] test_updateAssetConfig_fuzz_NewInterestRateStrategy(uint256) (runs: 5000, μ: 698375, ~: 698374)
Logs:
Bound result 3
[PASS] test_updateAssetConfig_fuzz_ReuseFeeReceiver_revertsWith_SpokeAlreadyListed(uint256) (runs: 5000, μ: 871988, ~: 871987)
Logs:
Bound result 3
Bound result 3
Bound result 3
Bound result 1000
[PASS] test_updateAssetConfig_fuzz_Scenario(uint256) (runs: 5000, μ: 700486, ~: 700539)
Logs:
Bound result 3
Bound result 3
Bound result 1000
Bound result 3
Bound result 1000
Bound result 3
Bound result 0
Bound result 3
Bound result 0
Bound result 3
Bound result 0
Bound result 3
Bound result 0
[PASS] test_updateAssetConfig_fuzz_revertsWith_InvalidInterestRateStrategy(uint256) (runs: 5000, μ: 61083, ~: 61136)
Logs:
Bound result 3
[PASS] test_updateAssetConfig_fuzz_revertsWith_InvalidLiquidityFee(uint256,(address,uint16,address,address)) (runs: 5000, μ: 40146, ~: 40042)
Logs:
Bound result 1
Bound result 3866
[PASS] test_updateAssetConfig_fuzz_revertsWith_InvalidReinvestmentController() (gas: 469753)
[PASS] test_updateAssetConfig_fuzz_revertsWith_calculateInterestRateReverts(uint256,(address,uint16,address,address)) (runs: 5000, μ: 198880, ~: 199295)
Logs:
Bound result 0
Bound result 1270
[PASS] test_updateAssetConfig_fuzz_revertsWith_setInterestRateDataReverts(uint256,(address,uint16,address,address)) (runs: 5000, μ: 95903, ~: 96293)
Logs:
Bound result 2
Bound result 17
[PASS] test_updateAssetConfig_oldFeeReceiver_flags() (gas: 880112)
Logs:
Bound result 1
Bound result 500
Bound result 3
Bound result 1000
Bound result 5
Bound result 500
Bound result 3
Bound result 1000
[PASS] test_updateSpokeConfig_fuzz(uint256,(uint40,uint40,uint24,bool,bool)) (runs: 5000, μ: 59225, ~: 59284)
Logs:
Bound result 2
[PASS] test_updateSpokeConfig_fuzz_revertsWith_SpokeNotListed(uint256,address,(uint40,uint40,uint24,bool,bool)) (runs: 5000, μ: 40524, ~: 40592)
Logs:
Bound result 1
[PASS] test_updateSpokeConfig_revertsWith_AssetNotListed() (gas: 29639)
Suite result: ok. 38 passed; 0 failed; 0 skipped; finished in 93.69s (93.66s CPU time)
Ran 16 tests for tests/unit/Hub/Hub.Draw.t.sol:HubDrawTest
[PASS] test_draw_DifferentSpokes() (gas: 352240)
[PASS] test_draw_fuzz_IncreasedBorrowRate(uint256,uint256) (runs: 5000, μ: 693439, ~: 693678)
Logs:
Bound result 3
Bound result 100
[PASS] test_draw_fuzz_amounts_same_block(uint256,uint256) (runs: 5000, μ: 285895, ~: 286025)
Logs:
Bound result 3
Bound result 100
[PASS] test_draw_fuzz_revertsWith_DrawCapExceeded(uint40) (runs: 5000, μ: 82329, ~: 82284)
Logs:
Bound result 9
[PASS] test_draw_fuzz_revertsWith_DrawCapExceeded_due_to_interest(uint40,uint256,uint256) (runs: 5000, μ: 283790, ~: 284032)
Logs:
Bound result 1291
Bound result 70309
Bound result 173721804
[PASS] test_draw_fuzz_revertsWith_InsufficientLiquidity(uint256,uint256) (runs: 5000, μ: 34735, ~: 34512)
Logs:
Bound result 3
Bound result 100
[PASS] test_draw_fuzz_revertsWith_InsufficientLiquidity_due_to_draw(uint256) (runs: 5000, μ: 169519, ~: 169225)
Logs:
Bound result 3124043968137
[PASS] test_draw_fuzz_revertsWith_InsufficientLiquidity_due_to_remove(uint256) (runs: 5000, μ: 131889, ~: 131682)
Logs:
Bound result 3124043968137
[PASS] test_draw_fuzz_revertsWith_InvalidAddress(uint256) (runs: 5000, μ: 16138, ~: 16138)
[PASS] test_draw_revertsWith_DrawCapExceeded_due_to_deficit() (gas: 267210)
[PASS] test_draw_revertsWith_InsufficientLiquidity() (gas: 28289)
[PASS] test_draw_revertsWith_InsufficientLiquidity_due_to_draw() (gas: 165836)
[PASS] test_draw_revertsWith_InsufficientLiquidity_due_to_remove() (gas: 129018)
[PASS] test_draw_revertsWith_InvalidAmount() (gas: 16269)
[PASS] test_draw_revertsWith_SpokeHalted() (gas: 61452)
[PASS] test_draw_revertsWith_SpokeNotActive() (gas: 61391)
Suite result: ok. 16 passed; 0 failed; 0 skipped; finished in 22.52s (22.49s CPU time)
Ran 8 tests for tests/unit/Hub/Hub.EliminateDeficit.t.sol:HubEliminateDeficitTest
[PASS] test_eliminateDeficit(uint256) (runs: 5000, μ: 653760, ~: 653760)
[PASS] test_eliminateDeficit_fuzz_revertsWith_AccessManagedUnauthorized(address) (runs: 5000, μ: 32580, ~: 32580)
[PASS] test_eliminateDeficit_fuzz_revertsWith_ArithmeticUnderflow_CallerSpokeNoFunds(uint256) (runs: 5000, μ: 348716, ~: 348716)
[PASS] test_eliminateDeficit_revertsWith_InvalidAmount_ZeroAmountNoDeficit() (gas: 36025)
[PASS] test_eliminateDeficit_revertsWith_InvalidAmount_ZeroAmountWithDeficit() (gas: 344891)
[PASS] test_eliminateDeficit_revertsWith_InvalidAmount_on_UnregisteredCoveredSpoke() (gas: 36412)
[PASS] test_eliminateDeficit_revertsWith_SpokeNotActive_on_UnregisteredAsset() (gas: 380713)
[PASS] test_eliminateDeficit_revertsWith_callerSpokeNotActive() (gas: 159412)
Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 16.15s (16.12s CPU time)
Ran 6 tests for tests/unit/Hub/Hub.MintFeeShares.t.sol:HubMintFeeSharesTest
[PASS] test_mintFeeShares() (gas: 308656)
[PASS] test_mintFeeShares_noFees() (gas: 364545)
[PASS] test_mintFeeShares_noShares() (gas: 289788)
[PASS] test_mintFeeShares_revertsWith_AccessManagedUnauthorized() (gas: 24139)
[PASS] test_mintFeeShares_revertsWith_AssetNotListed() (gas: 27553)
[PASS] test_mintFeeShares_revertsWith_SpokeNotActive() (gas: 239515)
Suite result: ok. 6 passed; 0 failed; 0 skipped; finished in 28.22ms (3.90ms CPU time)
Ran 9 tests for tests/gas/Hub.Operations.gas.t.sol:HubOperations_Gas_Tests
[PASS] test_add() (gas: 270108)
[PASS] test_deficit() (gas: 1304823)
[PASS] test_draw() (gas: 418553)
[PASS] test_mintFeeShares() (gas: 499923)
[PASS] test_payFee_transferShares() (gas: 931377)
[PASS] test_refreshPremium() (gas: 634389)
[PASS] test_remove() (gas: 310664)
[PASS] test_restore() (gas: 877812)
[PASS] test_restore_with_transfer() (gas: 878477)
Suite result: ok. 9 passed; 0 failed; 0 skipped; finished in 54.72ms (6.99ms CPU time)
Ran 26 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.ERC4626Compliance.t.sol:TokenizationSpokeERC4626ComplianceTest
[PASS] test_RT_deposit_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 654439, ~: 592588)
Logs:
Bound result 12006915235463044525527
Bound result 259965961
[PASS] test_RT_deposit_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 654820, ~: 593039)
Logs:
Bound result 12006915235463044525527
Bound result 259965961
[PASS] test_RT_mint_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 659882, ~: 596971)
Logs:
Bound result 1460
[PASS] test_RT_mint_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 660215, ~: 597387)
Logs:
Bound result 1460
[PASS] test_RT_redeem_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 654383, ~: 592968)
Logs:
Bound result 390651224253
[PASS] test_RT_redeem_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 654950, ~: 592777)
Logs:
Bound result 57806439813302410528722924648
[PASS] test_RT_withdraw_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 659708, ~: 597777)
Logs:
Bound result 390651224253
[PASS] test_RT_withdraw_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 660257, ~: 597568)
Logs:
Bound result 9692374835
[PASS] test_asset((address[4],uint256[4],uint256[4],int256)) (runs: 5000, μ: 574248, ~: 518738)
[PASS] test_convertToAssets((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 583609, ~: 527072)
Logs:
Bound result 911196153959281852
[PASS] test_convertToShares((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 583718, ~: 527169)
Logs:
Bound result 911196153959281852
[PASS] test_deposit((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 5000, μ: 637623, ~: 577469)
Logs:
Bound result 47339268870708371277
[PASS] test_maxDeposit((address[4],uint256[4],uint256[4],int256)) (runs: 5000, μ: 577302, ~: 521463)
[PASS] test_maxMint((address[4],uint256[4],uint256[4],int256)) (runs: 5000, μ: 577376, ~: 521529)
[PASS] test_maxRedeem((address[4],uint256[4],uint256[4],int256)) (runs: 5000, μ: 582339, ~: 525958)
[PASS] test_maxWithdraw((address[4],uint256[4],uint256[4],int256)) (runs: 5000, μ: 582225, ~: 525856)
[PASS] test_mint((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 5000, μ: 643037, ~: 581643)
Logs:
Bound result 820282019728792003956564819965
Bound result 275347850
[PASS] test_previewDeposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 633634, ~: 573780)
Logs:
Bound result 12006915235463044525527
Bound result 259965961
[PASS] test_previewMint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 638650, ~: 577680)
Logs:
Bound result 1460
[PASS] test_previewRedeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 637520, ~: 576465)
Logs:
Bound result 1059885746195044232721095
Bound result 1337818125105358
[PASS] test_previewWithdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 643298, ~: 581643)
Logs:
Bound result 2
[PASS] test_redeem((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 5000, μ: 643982, ~: 581639)
Logs:
Bound result 51
[PASS] test_redeem_zero_allowance((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 594177, ~: 537558)
Logs:
Bound result 1059885746195044232721095
Bound result 1337818125105358
[PASS] test_totalAssets((address[4],uint256[4],uint256[4],int256)) (runs: 5000, μ: 577726, ~: 521842)
[PASS] test_withdraw((address[4],uint256[4],uint256[4],int256),uint256,uint256) (runs: 5000, μ: 649317, ~: 586400)
Logs:
Bound result 134375467614657
Bound result 126916271400935207548106409573
[PASS] test_withdraw_zero_allowance((address[4],uint256[4],uint256[4],int256),uint256) (runs: 5000, μ: 599561, ~: 542348)
Logs:
Bound result 2
Suite result: ok. 26 passed; 0 failed; 0 skipped; finished in 196.05s (196.02s CPU time)
Ran 16 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.Edge.t.sol:TokenizationSpokeEdgeTest
[PASS] test_depositZero_revertsWith_InvalidAmount() (gas: 48685)
[PASS] test_deposit_revertsWith_ERC20InsufficientAllowance_noApproval() (gas: 55989)
[PASS] test_mintZero_revertsWith_InvalidAmount() (gas: 48332)
[PASS] test_mint_revertsWith_ERC20InsufficientAllowance_noApproval() (gas: 61568)
[PASS] test_multipleMintDepositRedeemWithdraw() (gas: 595766)
[PASS] test_redeemZero_revertsWith_InvalidAmount() (gas: 191353)
[PASS] test_redeem_revertsWith_ERC20InsufficientAllowance_callerNotOwner() (gas: 191569)
[PASS] test_redeem_revertsWith_ERC20InsufficientBalance_noShares() (gas: 37311)
[PASS] test_redeem_revertsWith_ERC20InsufficientBalance_on_InsufficientShares() (gas: 187551)
[PASS] test_singleDepositWithdraw() (gas: 227041)
[PASS] test_singleMintRedeem() (gas: 231090)
[PASS] test_vaultInteractionsForSomeoneElse() (gas: 311568)
[PASS] test_withdrawZero_revertsWith_InvalidAmount() (gas: 191851)
[PASS] test_withdraw_revertsWith_ERC20InsufficientAllowance_callerNotOwner() (gas: 197576)
[PASS] test_withdraw_revertsWith_ERC20InsufficientBalance() (gas: 195176)
[PASS] test_withdraw_revertsWith_ERC20InsufficientBalance_noBalance() (gas: 43354)
Suite result: ok. 16 passed; 0 failed; 0 skipped; finished in 32.56ms (6.92ms CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersAddCapExactlyReachedTest
[PASS] test_maxDeposit_returnsZero() (gas: 41194)
[PASS] test_maxMint_returnsZero() (gas: 45260)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 25.81ms (258.56µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersAddCapMaxTest
[PASS] test_maxDeposit_returnsMaxUint() (gas: 23335)
[PASS] test_maxMint_returnsMaxUint() (gas: 23506)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 24.81ms (189.54µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersAddCapVariableEmptyTest
[PASS] test_maxDeposit_returnsCapTimesUnits() (gas: 44721)
[PASS] test_maxMint_returnsSharesOfCap() (gas: 56909)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 24.86ms (297.16µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersAddCapVariablePartialTest
[PASS] test_maxDeposit_returnsRemaining() (gas: 49351)
[PASS] test_maxMint_returnsSharesOfRemaining() (gas: 61475)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 25.25ms (353.05µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersAddCapZeroTest
[PASS] test_maxDeposit_returnsZero() (gas: 41194)
[PASS] test_maxMint_returnsZero() (gas: 45282)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 25.27ms (270.93µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersCapExceededByYieldTest
[PASS] test_maxDeposit_returnsZero() (gas: 41205)
[PASS] test_maxMint_returnsZero() (gas: 45271)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 25.43ms (279.47µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersExactBoundaryAfterYieldTest
[PASS] test_maxDeposit_exactBoundary_succeeds() (gas: 137781)
[PASS] test_maxMint_exactBoundary_succeeds() (gas: 146334)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 25.75ms (655.20µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersExactBoundaryLimitedLiquidityTest
[PASS] test_maxRedeem_exactBoundary_limitedLiquidity_succeeds() (gas: 104190)
[PASS] test_maxWithdraw_exactBoundary_limitedLiquidity_succeeds() (gas: 99769)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 25.38ms (498.72µs CPU time)
Ran 4 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersHaltedTest
[PASS] test_maxDeposit_returnsZero() (gas: 23325)
[PASS] test_maxMint_returnsZero() (gas: 39383)
[PASS] test_maxRedeem_returnsZero() (gas: 41573)
[PASS] test_maxWithdraw_returnsZero() (gas: 41475)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 24.76ms (431.69µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersLiquidityGreaterThanBalanceTest
[PASS] test_maxRedeem_returnsSharesOfBalance() (gas: 55737)
[PASS] test_maxWithdraw_returnsBalance() (gas: 55446)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 24.87ms (359.31µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersLiquidityLessThanBalanceTest
[PASS] test_maxRedeem_returnsSharesOfLiquidity() (gas: 55704)
[PASS] test_maxWithdraw_returnsLiquidity() (gas: 55445)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 25.15ms (379.19µs CPU time)
Ran 4 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersNotActiveAndHaltedTest
[PASS] test_maxDeposit_returnsZero() (gas: 23311)
[PASS] test_maxMint_returnsZero() (gas: 39369)
[PASS] test_maxRedeem_returnsZero() (gas: 41559)
[PASS] test_maxWithdraw_returnsZero() (gas: 41461)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 25.05ms (429.66µs CPU time)
Ran 4 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersNotActiveTest
[PASS] test_maxDeposit_returnsZero() (gas: 23311)
[PASS] test_maxMint_returnsZero() (gas: 39369)
[PASS] test_maxRedeem_returnsZero() (gas: 41559)
[PASS] test_maxWithdraw_returnsZero() (gas: 41461)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 24.89ms (424.26µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersOwnerZeroSharesTest
[PASS] test_maxRedeem_returnsZero() (gas: 42977)
[PASS] test_maxWithdraw_returnsZero() (gas: 42890)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 24.66ms (252.89µs CPU time)
Ran 2 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.MaxGetters.t.sol:TokenizationSpokeMaxGettersZeroLiquidityTest
[PASS] test_maxRedeem_returnsZero() (gas: 42977)
[PASS] test_maxWithdraw_returnsZero() (gas: 42912)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 24.85ms (261.11µs CPU time)
Ran 9 tests for tests/gas/TokenizationSpoke.Operations.gas.t.sol:TokenizationSpokeOperations_Gas_Tests
[PASS] test_deposit() (gas: 124100)
[PASS] test_depositWithSig() (gas: 209891)
[PASS] test_mint() (gas: 152102)
[PASS] test_mintWithSig() (gas: 239936)
[PASS] test_permit() (gas: 118522)
[PASS] test_redeem() (gas: 838771)
[PASS] test_redeemWithSig() (gas: 320341)
[PASS] test_withdraw() (gas: 804181)
[PASS] test_withdrawWithSig() (gas: 321171)
Suite result: ok. 9 passed; 0 failed; 0 skipped; finished in 50.12ms (6.25ms CPU time)
Ran 10 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.Permit.t.sol:TokenizationSpokePermitTest
[PASS] test_nonces_uses_permit_nonce_key_namespace(bytes32) (runs: 5000, μ: 17679, ~: 17679)
[PASS] test_permit() (gas: 189761)
[PASS] test_permit_revertsWith_InvalidAddress_dueTo_ZeroAddressOwner() (gas: 51015)
[PASS] test_permit_revertsWith_InvalidSignature_dueTo_ExpiredDeadline() (gas: 28541)
[PASS] test_permit_revertsWith_InvalidSignature_dueTo_InvalidSigner() (gas: 51490)
[PASS] test_permit_revertsWith_InvalidSignature_dueTo_invalid_nonce_at_arbitrary_namespace(bytes32) (runs: 5000, μ: 55264, ~: 55264)
[PASS] test_permit_revertsWith_InvalidSignature_dueTo_invalid_nonce_at_permit_key_namespace(bytes32) (runs: 5000, μ: 57097, ~: 57097)
[PASS] test_renounceAllowance() (gas: 35296)
[PASS] test_renounceAllowance_noop() (gas: 24125)
[PASS] test_usePermitNonce(bytes32) (runs: 5000, μ: 18166, ~: 18166)
Suite result: ok. 10 passed; 0 failed; 0 skipped; finished in 6.18s (6.15s CPU time)
Ran 4 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.Reverts.InsufficientAllowance.t.sol:TokenizationSpokeInsufficientAllowanceTest
[PASS] test_depositWithSig_revertsWith_ERC20InsufficientAllowance() (gas: 155503)
[PASS] test_deposit_revertsWith_ERC20InsufficientAllowance() (gas: 66648)
[PASS] test_mintWithSig_revertsWith_ERC20InsufficientAllowance() (gas: 166264)
[PASS] test_mint_revertsWith_ERC20InsufficientAllowance() (gas: 71178)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 29.86ms (2.49ms CPU time)
Ran 6 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.Upgradeable.t.sol:TokenizationSpokeUpgradeableTest
[PASS] test_implementation_constructor_fuzz(uint64) (runs: 5000, μ: 2807532, ~: 2807532)
[PASS] test_proxy_constructor_fuzz(uint64) (runs: 5000, μ: 2824610, ~: 2824602)
Logs:
Bound result 649
[PASS] test_proxy_constructor_fuzz_revertsWith_InvalidInitialization(uint64) (runs: 5000, μ: 5604148, ~: 5604140)
Logs:
Bound result 649
[PASS] test_proxy_constructor_revertsWith_InvalidInitialization_ZeroRevision() (gas: 2804292)
[PASS] test_proxy_reinitialization_fuzz(uint64) (runs: 5000, μ: 5614706, ~: 5614690)
Logs:
Bound result 649
[PASS] test_proxy_reinitialization_revertsWith_CallerNotProxyAdmin() (gas: 5592997)
Suite result: ok. 6 passed; 0 failed; 0 skipped; finished in 13.68s (13.66s CPU time)
Ran 6 tests for tests/unit/Hub/Hub.PayFee.t.sol:HubPayFeeTest
[PASS] test_payFee_fuzz(uint256,uint256) (runs: 5000, μ: 697349, ~: 697507)
Logs:
Bound result 68691281934999
Bound result 0
Bound result 100
[PASS] test_payFee_fuzz_with_interest(uint256,uint256,uint256) (runs: 5000, μ: 697788, ~: 698055)
Logs:
Bound result 615514462186775432459
Bound result 10765498
Bound result 571193127101173104469
[PASS] test_payFee_revertsWith_InvalidShares() (gas: 20356)
[PASS] test_payFee_revertsWith_SpokeNotActive() (gas: 61390)
[PASS] test_payFee_revertsWith_underflow_added_shares_exceeded() (gas: 135493)
[PASS] test_payFee_revertsWith_underflow_added_shares_exceeded_with_interest() (gas: 636899)
Suite result: ok. 6 passed; 0 failed; 0 skipped; finished in 24.99s (24.97s CPU time)
Ran 8 tests for tests/unit/Spoke/Spoke.Repay.Scenario.t.sol:SpokeRepayScenarioTest
[PASS] test_fuzz_repay_borrow_twice_repay_twice((uint256,uint256,uint256,uint40),(uint256,uint256,uint256,uint40)) (runs: 5000, μ: 1255289, ~: 1260098)
Logs:
Bound result 1
Bound result 14836
Bound result 4400000000000000000
Bound result 11543
Bound result 3209
Bound result 1903
[PASS] test_fuzz_repay_multiple_users_repay_same_reserve((uint256,uint256,uint256,uint256,uint256,uint256,address),(uint256,uint256,uint256,uint256,uint256,uint256,address),(uint256,uint256,uint256,uint256,uint256,uint256,address),uint256) (runs: 5000, μ: 2025366, ~: 1998172)
Logs:
Bound result 54690633323192279337696643400
Bound result 34560000
Bound result 500000000
Bound result 791
Bound result 100000000
Bound result 1397
Bound result 10301
[PASS] test_repay_fuzz_multiple_users_multiple_assets(((uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),address),((uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),address),((uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),address),uint40) (runs: 5000, μ: 6053331, ~: 6053622)
Logs:
Bound result 3074
Bound result 4500
Bound result 10442
Bound result 3362
Bound result 1600000000000000000000000000
Bound result 208
Bound result 10600
Bound result 184
Bound result 2111
Bound result 2000000000000000000000000000
Bound result 17664
Bound result 11495
Bound result 7000
Bound result 1800000000
Bound result 16499
Bound result 4218
Bound result 13
Bound result 553
Bound result 31474977379130400
Bound result 333
Bound result 31536000
Bound result 450552876409790643671482431940419874915447411150352389258589821042463539455
Bound result 72804214737418362637539853836006058574737022617871426945351382859961153355777
Bound result 1456770239255271530568016559394223011463851548326
Bound result 21743
[PASS] test_repay_fuzz_two_users_multiple_assets(((uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),address),((uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256),address),uint40) (runs: 5000, μ: 4287301, ~: 4287555)
Logs:
Bound result 4202047188
Bound result 23995
Bound result 125000000000000000
Bound result 939605761
Bound result 27820800
Bound result 7600
Bound result 4000000000000000000000
Bound result 3812
Bound result 125000000000000000000000000000
Bound result 255
Bound result 14754
Bound result 8606
Bound result 19508
Bound result 20100
Bound result 7542
Bound result 2000000000
Bound result 19
[PASS] test_repay_partial_then_max() (gas: 690270)
[PASS] test_repay_round_trip_borrow_repay(uint256,uint256,uint40,address,uint256) (runs: 5000, μ: 872066, ~: 875646)
Logs:
Bound result 0
Bound result 826074470
Bound result 193
Bound result 12305
[PASS] test_repay_round_trip_repay_borrow(uint256,uint256,uint256,uint40,address,uint256) (runs: 5000, μ: 953112, ~: 962482)
Logs:
Bound result 0
Bound result 1554
Bound result 13553
Bound result 15308
Bound result 8347
[PASS] test_repay_two_users_repay_same_reserve((uint256,uint256,uint256,uint256,uint256,uint256,address),(uint256,uint256,uint256,uint256,uint256,uint256,address),uint256) (runs: 5000, μ: 1463459, ~: 1493812)
Logs:
Bound result 5401549876140600956580819487
Bound result 65251468040295843421393
Bound result 11263328023241632836759
Bound result 7707153379656042561281651440489383780992440
Bound result 681445185
Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 301.56s (301.54s CPU time)
Ran 2 tests for tests/unit/Spoke/Spoke.Repay.Validation.t.sol:SpokeRepayValidationTest
[PASS] test_repay_revertsWith_ReserveNotListed() (gas: 23228)
[PASS] test_repay_revertsWith_ReservePaused() (gas: 63748)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 24.67ms (389.03µs CPU time)
Ran 11 tests for tests/unit/Hub/Hub.Reclaim.t.sol:HubReclaimTest
[PASS] test_reclaim() (gas: 634284)
Logs:
Bound result 1000000000000000000000
Bound result 500000000000000000000
Bound result 200000000000000000000
[PASS] test_reclaim_fullAmount() (gas: 616734)
[PASS] test_reclaim_fuzz(uint256,uint256,uint256) (runs: 5000, μ: 636000, ~: 635224)
Logs:
Bound result 615514462186775432459
Bound result 571193127101173104469
Bound result 564283877115702805413
[PASS] test_reclaim_multipleSweepsAndReclaims() (gas: 725320)
[PASS] test_reclaim_revertsWith_AssetNotListed() (gas: 13093)
[PASS] test_reclaim_revertsWith_InsufficientTransferred() (gas: 438036)
[PASS] test_reclaim_revertsWith_InsufficientTransferred_noSwept() (gas: 102540)
[PASS] test_reclaim_revertsWith_InvalidAmount_zero() (gas: 92710)
[PASS] test_reclaim_revertsWith_OnlyReinvestmentController(address) (runs: 5000, μ: 93593, ~: 93593)
[PASS] test_reclaim_revertsWith_OnlyReinvestmentController_init() (gas: 40516)
[PASS] test_reclaim_revertsWith_underflow_exceedsSwept_afterSweep() (gas: 601387)
Suite result: ok. 11 passed; 0 failed; 0 skipped; finished in 14.88s (14.86s CPU time)
Ran 12 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.WithSig.Reverts.InvalidSignature.t.sol:TokenizationSpokeWithSigInvalidSignatureTest
[PASS] test_depositWithSig_revertsWith_InvalidAccountNonce(bytes32) (runs: 5000, μ: 168645, ~: 171080)
[PASS] test_depositWithSig_revertsWith_InvalidSignature_dueTo_ExpiredDeadline() (gas: 29560)
[PASS] test_depositWithSig_revertsWith_InvalidSignature_dueTo_InvalidSigner() (gas: 27829)
[PASS] test_mintWithSig_revertsWith_InvalidAccountNonce(bytes32) (runs: 5000, μ: 168665, ~: 171100)
[PASS] test_mintWithSig_revertsWith_InvalidSignature_dueTo_ExpiredDeadline() (gas: 29515)
[PASS] test_mintWithSig_revertsWith_InvalidSignature_dueTo_InvalidSigner() (gas: 27793)
[PASS] test_redeemWithSig_revertsWith_InvalidAccountNonce(bytes32) (runs: 5000, μ: 168667, ~: 171102)
[PASS] test_redeemWithSig_revertsWith_InvalidSignature_dueTo_ExpiredDeadline() (gas: 29519)
[PASS] test_redeemWithSig_revertsWith_InvalidSignature_dueTo_InvalidSigner() (gas: 27819)
[PASS] test_withdrawWithSig_revertsWith_InvalidAccountNonce(bytes32) (runs: 5000, μ: 168664, ~: 171099)
[PASS] test_withdrawWithSig_revertsWith_InvalidSignature_dueTo_ExpiredDeadline() (gas: 29558)
[PASS] test_withdrawWithSig_revertsWith_InvalidSignature_dueTo_InvalidSigner() (gas: 27838)
Suite result: ok. 12 passed; 0 failed; 0 skipped; finished in 26.59s (26.56s CPU time)
Ran 12 tests for tests/unit/Hub/Hub.RefreshPremium.t.sol:HubRefreshPremiumTest
[PASS] test_refreshPremium_emitsEvent() (gas: 254727)
[PASS] test_refreshPremium_fuzz_positiveDeltas(uint256,int256,int256) (runs: 5000, μ: 488488, ~: 493693)
Logs:
Bound result 999999999910000000000000000001
Bound result 1
Bound result 8164
[PASS] test_refreshPremium_fuzz_withAccrual(uint256,uint256,uint256,uint256) (runs: 5000, μ: 465866, ~: 475158)
Logs:
Bound result 3373
Bound result 56
Bound result 7500000000000000
Bound result 84288
[PASS] test_refreshPremium_haltedSpokesAllowed() (gas: 121430)
[PASS] test_refreshPremium_maxRiskPremiumThreshold() (gas: 895057)
[PASS] test_refreshPremium_negativeDeltas(uint256) (runs: 5000, μ: 458483, ~: 459023)
Logs:
Bound result 3124043968137
[PASS] test_refreshPremium_negativeDeltas_withAccrual(uint256) (runs: 5000, μ: 528345, ~: 528559)
Logs:
Bound result 3124043968137
[PASS] test_refreshPremium_revertsWith_InvalidPremiumChange_NonZeroRestoredPremiumRay() (gas: 850467)
[PASS] test_refreshPremium_revertsWith_InvalidPremiumChange_RiskPremiumThresholdExceeded_DecreasingPremium() (gas: 871779)
[PASS] test_refreshPremium_revertsWith_SpokeNotActive() (gas: 58921)
[PASS] test_refreshPremium_riskPremiumThreshold() (gas: 917235)
[PASS] test_refreshPremium_spokePremiumUpdateIsContained() (gas: 707532)
Suite result: ok. 12 passed; 0 failed; 0 skipped; finished in 20.02s (19.99s CPU time)
Ran 15 tests for tests/unit/Hub/Hub.Remove.t.sol:HubRemoveTest
[PASS] test_remove() (gas: 205714)
Logs:
Bound result 2
Bound result 100000000000000000000
[PASS] test_remove_all_with_interest() (gas: 361850)
[PASS] test_remove_fuzz(uint256,uint256) (runs: 5000, μ: 204533, ~: 204587)
Logs:
Bound result 4
Bound result 100
[PASS] test_remove_fuzz_all_liquidity_with_interest(uint256,uint256) (runs: 5000, μ: 409805, ~: 410030)
Logs:
Bound result 68691281934999
Bound result 100
[PASS] test_remove_fuzz_multi_spoke(uint256,uint256) (runs: 5000, μ: 282496, ~: 282594)
Logs:
Bound result 68691281934999
Bound result 100
[PASS] test_remove_fuzz_multi_spoke_with_interest(uint256,uint256,uint256,uint256) (runs: 5000, μ: 412556, ~: 413053)
Logs:
Bound result 2938
Bound result 2198
Bound result 3984
Bound result 32718
[PASS] test_remove_revertsWith_InsufficientLiquidity() (gas: 155153)
[PASS] test_remove_revertsWith_InsufficientLiquidity_exceeding_added_amount() (gas: 144250)
[PASS] test_remove_revertsWith_InsufficientLiquidity_zero_added() (gas: 21376)
[PASS] test_remove_revertsWith_InvalidAddress() (gas: 16471)
[PASS] test_remove_revertsWith_InvalidAmount() (gas: 18628)
[PASS] test_remove_revertsWith_SpokeHalted() (gas: 61971)
[PASS] test_remove_revertsWith_SpokeNotActive() (gas: 61880)
[PASS] test_remove_revertsWith_underflow_exceeding_added_amount() (gas: 178890)
[PASS] test_remove_revertsWtih_underflow_one_extra_wei() (gas: 354295)
Suite result: ok. 15 passed; 0 failed; 0 skipped; finished in 29.49s (29.47s CPU time)
Ran 5 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.WithSig.t.sol:TokenizationSpokeWithSigTest
[PASS] test_depositWithSig(bytes32) (runs: 5000, μ: 349294, ~: 351730)
[PASS] test_mintWithSig(bytes32) (runs: 5000, μ: 348631, ~: 351067)
[PASS] test_redeemWithSig(bytes32) (runs: 5000, μ: 330392, ~: 332195)
[PASS] test_useNonce_monotonic(bytes32) (runs: 5000, μ: 17155, ~: 17155)
[PASS] test_withdrawWithSig(bytes32) (runs: 5000, μ: 331337, ~: 333120)
Suite result: ok. 5 passed; 0 failed; 0 skipped; finished in 48.51s (48.48s CPU time)
Ran 8 tests for tests/unit/TokenizationSpoke/TokenizationSpoke.t.sol:TokenizationSpokeTest
[PASS] test_deposit() (gas: 234699)
[PASS] test_deposit_receiverDifferentFromCaller() (gas: 222970)
[PASS] test_mint() (gas: 234051)
[PASS] test_mint_receiverDifferentFromCaller() (gas: 222349)
[PASS] test_redeem() (gas: 220093)
[PASS] test_redeem_ownerDifferentFromCaller() (gas: 252513)
[PASS] test_withdraw() (gas: 216427)
[PASS] test_withdraw_ownerDifferentFromCaller() (gas: 248832)
Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 35.99ms (10.91ms CPU time)
Ran 7 tests for tests/unit/Hub/Hub.ReportDeficit.t.sol:HubReportDeficitTest
[PASS] test_reportDeficit_fuzz_revertsWith_SurplusDrawnDeficitReported(uint256) (runs: 5000, μ: 220001, ~: 220435)
Logs:
Bound result 3124043968137
[PASS] test_reportDeficit_fuzz_revertsWith_SurplusPremiumRayDeficitReported(uint256) (runs: 5000, μ: 221026, ~: 221460)
Logs:
Bound result 3124043968137
[PASS] test_reportDeficit_fuzz_with_premium(uint256,uint256,uint256,uint256) (runs: 5000, μ: 674515, ~: 675264)
Logs:
Bound result 30047368
Bound result 20618
Bound result 12194
Bound result 7500000000000000
[PASS] test_reportDeficit_halted() (gas: 265108)
[PASS] test_reportDeficit_revertsWith_InvalidAmount() (gas: 22756)
[PASS] test_reportDeficit_revertsWith_SpokeNotActive(address) (runs: 5000, μ: 33911, ~: 33911)
[PASS] test_reportDeficit_with_premium() (gas: 673624)
Logs:
Bound result 10000000000
Bound result 31536000
Bound result 5000000000
Bound result 0
Suite result: ok. 7 passed; 0 failed; 0 skipped; finished in 17.99s (17.97s CPU time)
Ran 3 tests for tests/unit/Hub/Hub.Rescue.t.sol:HubRescueTest
[PASS] test_cannot_rescue_liquidity_fee_reverts_with_InsufficientTransferred() (gas: 264896)
[PASS] test_rescue_fuzz_with_interest(uint256,uint256) (runs: 5000, μ: 507020, ~: 506972)
Logs:
Bound result 351500639
Bound result 1256746
[PASS] test_rescue_scenario_fuzz(uint256) (runs: 5000, μ: 446548, ~: 446336)
Logs:
Bound result 3124043968137
Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 17.20s (17.18s CPU time)
Ran 23 tests for tests/unit/Hub/Hub.Restore.t.sol:HubRestoreTest
[PASS] test_restore_full_amount_with_interest() (gas: 364033)
Logs:
Bound result 1000000000000000000000
Bound result 500000000000000000000
Bound result 31536000
[PASS] test_restore_full_amount_with_interest_and_premium() (gas: 673992)
Logs:
Bound result 100000000000000000000
Bound result 50000000000000000000
Bound result 31536000
Bound result 1
[PASS] test_restore_fuzz_full_amount_with_interest(uint256,uint256,uint256) (runs: 5000, μ: 365364, ~: 365451)
Logs:
Bound result 615514462186775432459
Bound result 571193127101173104469
Bound result 173721804
[PASS] test_restore_fuzz_full_amount_with_interest_and_premium(uint256,uint256,uint256,uint256) (runs: 5000, μ: 664857, ~: 676053)
Logs:
Bound result 8945
Bound result 5138
Bound result 480000000
Bound result 76
[PASS] test_restore_fuzz_revertsWith_SurplusDrawnRestored_with_interest(uint256,uint256,uint256) (runs: 5000, μ: 243468, ~: 244624)
Logs:
Bound result 615514462186775432459
Bound result 571193127101173104469
Bound result 173721804
[PASS] test_restore_fuzz_revertsWith_SurplusDrawnRestored_with_interest_and_premium(uint256,uint256,uint256,uint256) (runs: 5000, μ: 638644, ~: 638890)
Logs:
Bound result 8945
Bound result 5138
Bound result 480000000
Bound result 76
[PASS] test_restore_one_share_delta_increase_revertsWith_InvalidPremiumChange() (gas: 211618)
[PASS] test_restore_partial_drawn() (gas: 322405)
[PASS] test_restore_partial_same_block() (gas: 322531)
[PASS] test_restore_premiumDeltas_twoWeiIncrease_realizedDelta() (gas: 232328)
[PASS] test_restore_revertsWith_InsufficientTransferred() (gas: 252128)
[PASS] test_restore_revertsWith_InvalidAmount_zero() (gas: 58090)
[PASS] test_restore_revertsWith_InvalidPremiumChange_premiumIncrease() (gas: 218581)
[PASS] test_restore_revertsWith_InvalidPremiumChange_premiumSharesIncrease() (gas: 218581)
[PASS] test_restore_revertsWith_SpokeHalted() (gas: 99279)
[PASS] test_restore_revertsWith_SpokeNotActive_whenPaused() (gas: 181407)
[PASS] test_restore_revertsWith_SurplusDrawnRestored() (gas: 358172)
[PASS] test_restore_revertsWith_SurplusDrawnRestored_with_interest() (gas: 243249)
Logs:
Bound result 100000000000000000000
Bound result 50000000000000000000
Bound result 15768000
[PASS] test_restore_revertsWith_SurplusDrawnRestored_with_interest_and_premium() (gas: 636852)
Logs:
Bound result 100000000000000000000
Bound result 50000000000000000000
Bound result 31536000
Bound result 1
[PASS] test_restore_revertsWith_SurplusPremiumRayRestored() (gas: 508498)
[PASS] test_restore_revertsWith_underflow_offsetIncrease() (gas: 227438)
[PASS] test_restore_tooMuchDrawn_revertsWith_SurplusDrawnRestored() (gas: 213936)
[PASS] test_restore_when_asset_caps_reset() (gas: 435330)
Suite result: ok. 23 passed; 0 failed; 0 skipped; finished in 18.47s (18.45s CPU time)
Ran 1 test for tests/unit/Hub/Hub.Rounding.t.sol:HubRoundingTest
[PASS] test_sharePriceWithMultipleDonations() (gas: 664395417)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 2.90s (2.88s CPU time)
Ran 17 tests for tests/unit/Spoke/TreasurySpoke.t.sol:TreasurySpokeTest
[PASS] test_borrow_revertsWith_UnsupportedAction() (gas: 9654)
[PASS] test_deploy_reverts_on_invalid_params() (gas: 4182)
[PASS] test_getters() (gas: 740264)
[PASS] test_initial_state() (gas: 167956)
[PASS] test_liquidationCall_revertsWith_UnsupportedAction() (gas: 10474)
[PASS] test_repay_revertsWith_UnsupportedAction() (gas: 9656)
[PASS] test_supply(uint256) (runs: 5000, μ: 124851, ~: 124633)
Logs:
Bound result 3124043968137
[PASS] test_supply_revertsWith_Unauthorized(address) (runs: 5000, μ: 16116, ~: 16116)
[PASS] test_transfer_fuzz(address,uint256,uint256) (runs: 5000, μ: 100162, ~: 101182)
Logs:
Bound result 9500000000000000000000
Bound result 20514
[PASS] test_transfer_revertsWith_ERC20InsufficientBalance(uint256) (runs: 5000, μ: 604011, ~: 604011)
[PASS] test_transfer_revertsWith_Unauthorized(address) (runs: 5000, μ: 14829, ~: 14829)
[PASS] test_withdraw_fuzz_amount_feesOnly(uint256) (runs: 5000, μ: 786062, ~: 785765)
Logs:
Bound result 3124043968137
[PASS] test_withdraw_fuzz_amount_interestAndFees(uint256) (runs: 5000, μ: 773032, ~: 772859)
Logs:
Bound result 3124043968137
[PASS] test_withdraw_fuzz_amount_interestOnly(uint256) (runs: 5000, μ: 806153, ~: 805851)
Logs:
Bound result 399452744467735387087512641102
[PASS] test_withdraw_fuzz_maxLiquidityFee(uint256,uint256,uint256) (runs: 5000, μ: 851327, ~: 851420)
Logs:
Bound result 4
Bound result 218470873395738003579119570309
Bound result 173721804
[PASS] test_withdraw_maxLiquidityFee() (gas: 852027)
Logs:
Bound result 2
Bound result 1000000000000000000000
Bound result 29376000
[PASS] test_withdraw_revertsWith_Unauthorized(address) (runs: 5000, μ: 16479, ~: 16479)
Suite result: ok. 17 passed; 0 failed; 0 skipped; finished in 53.09s (53.06s CPU time)
Ran 8 tests for tests/unit/UnitPriceFeed.t.sol:UnitPriceFeedTest
[PASS] tes...*[Comment body truncated]* |
Forge Build Sizes
🔕 Unchanged
|
| if ( | ||
| positionStatus.isUsingAsCollateral(reserveId) && positionStatus.borrowCount(_reserveCount) > 0 | ||
| ) { | ||
| uint256 newRiskPremium = _refreshAndValidateUserAccountData(onBehalfOf).riskPremium; |
There was a problem hiding this comment.
when i initially thought about it, the opt went in _processUserAccountData as a short circuit
There was a problem hiding this comment.
There was a problem hiding this comment.
debatable but we could assume a user has borrows if the asset is enabled as collateral. They could skip hf check by disabling the asset as collateral first (that runs HF check anyway) or not enabling it from the start.
This opt would benefit depositors (only; with no borrow intention), and not sure it's needed given that supply does not activate the asset as collateral by default.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Decided not to apply and favor codesize vs gas optimization |
Gas savings :
Check that
onBehalfOfis currently borrowing before executingin
withdraw()Saves between 18k - 23k gas when user is not borrowing, minimal increase when he is.