From 9822752a29a0cd41ef0e66e1eaa624996bb430e7 Mon Sep 17 00:00:00 2001 From: Andrew Redden Date: Mon, 20 Nov 2023 17:11:30 -0400 Subject: [PATCH] chore: add snapshot, remvoe dead comments --- .gas-snapshot | 84 +++++++++++++++++++++------------------ lib/starport | 2 +- test/TestV1Settlement.sol | 18 --------- test/TestV1Status.sol | 1 - 4 files changed, 46 insertions(+), 59 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 6833cd1..a5cc648 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,48 +1,54 @@ -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaim() (gas: 653045) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaimRandomFulfiller() (gas: 644029) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallBase() (gas: 1041643) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 666522) -TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 1437972) -TestAstariaV1Pricing:testGetRefinanceConsiderationAsBorrowerZeroRate() (gas: 79761) -TestAstariaV1Pricing:testGetRefinanceConsiderationInsufficientRefinance() (gas: 110639) -TestAstariaV1Pricing:testGetRefinanceConsiderationInvalidRefinance() (gas: 87576) -TestAstariaV1Pricing:testGetRefinanceConsiderationValidEqualRate() (gas: 149408) -TestAstariaV1Pricing:testGetRefinanceConsiderationValidHigherRate() (gas: 162784) -TestAstariaV1Pricing:testGetRefinanceConsiderationValidLowerRate() (gas: 157603) -TestAstariaV1Pricing:testGetRefinanceConsiderationZeroRate() (gas: 141978) -TestAstariaV1Settlement:testGetAuctionStart() (gas: 468404) -TestAstariaV1Settlement:testGetAuctionStartNotStarted() (gas: 467934) -TestAstariaV1Settlement:testGetCurrentAuctionPrice() (gas: 483586) -TestAstariaV1Settlement:testGetCurrentAuctionPriceNoAuction() (gas: 471587) -TestAstariaV1Settlement:testGetSettlementConsiderationDutchAuctionSettlementAbove() (gas: 524392) -TestAstariaV1Settlement:testGetSettlementConsiderationFailedDutchAuction() (gas: 484065) -TestAstariaV1Settlement:testGetSettlementConsiderationLoanNotRecalled() (gas: 474180) -TestAstariaV1Settlement:testGetSettlementConsiderationLoanRecalledByLender() (gas: 506679) -TestAstariaV1Settlement:testGetSettlementConsiderationNoRecallRate() (gas: 485871) -TestAstariaV1Settlement:testV1SettlementHandlerValidate() (gas: 454816) -TestAstariaV1Settlement:testV1SettlementHandlerValidateInvalidHandler() (gas: 454757) -TestAstariaV1Status:testCannotRecallTwice() (gas: 581737) -TestAstariaV1Status:testCannotWithdrawLoanHasNotBeenRefinanced() (gas: 462929) -TestAstariaV1Status:testCannotWithdrawWithdrawDoesNotExist() (gas: 469550) -TestAstariaV1Status:testGenerateRecallConsideration() (gas: 508017) -TestAstariaV1Status:testInvalidRecallInvalidStakeType() (gas: 523463) -TestAstariaV1Status:testInvalidRecallLoanDoesNotExist() (gas: 510755) -TestAstariaV1Status:testIsActive() (gas: 467636) -TestAstariaV1Status:testIsRecalledInsideWindow() (gas: 596196) -TestAstariaV1Status:testIsRecalledOutsideWindow() (gas: 594128) -TestAstariaV1Status:testRecallAndRefinanceInsideWindow() (gas: 752887) -TestAstariaV1Status:testRecallRateActiveRecall() (gas: 582697) -TestAstariaV1Status:testRecallRateEmptyRecall() (gas: 465970) -TestCompoundInterest:testDecimalsTooHigh() (gas: 3362) -TestCompoundInterest:testDecimalsTooLowZero() (gas: 3281) -TestCompoundInterest:testInterestAccrual() (gas: 67039) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaim() (gas: 653231) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallAuctionFailLenderClaimRandomFulfiller() (gas: 644215) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallBase() (gas: 1042358) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLender() (gas: 666730) +TestAstariaV1Loan:testNewLoanERC721CollateralDefaultTermsRecallLiquidation() (gas: 1438180) +TestAstariaV1Pricing:testGetRefinanceConsiderationAsBorrowerZeroRate() (gas: 79783) +TestAstariaV1Pricing:testGetRefinanceConsiderationInsufficientRefinance() (gas: 111189) +TestAstariaV1Pricing:testGetRefinanceConsiderationInvalidRefinance() (gas: 88304) +TestAstariaV1Pricing:testGetRefinanceConsiderationValidEqualRate() (gas: 149516) +TestAstariaV1Pricing:testGetRefinanceConsiderationValidHigherRate() (gas: 162892) +TestAstariaV1Pricing:testGetRefinanceConsiderationValidLowerRate() (gas: 157711) +TestAstariaV1Pricing:testGetRefinanceConsiderationZeroRate() (gas: 81207) +TestAstariaV1Pricing:testGetRefinanceNewDecimalMismatch() (gas: 81092) +TestAstariaV1Pricing:testV1PricingValidateInvalid() (gas: 69869) +TestAstariaV1Pricing:testV1PricingValidateValid() (gas: 69677) +TestAstariaV1Settlement:testGetAuctionStart() (gas: 468743) +TestAstariaV1Settlement:testGetAuctionStartNotStarted() (gas: 468163) +TestAstariaV1Settlement:testGetCurrentAuctionPrice() (gas: 483815) +TestAstariaV1Settlement:testGetCurrentAuctionPriceNoAuction() (gas: 471816) +TestAstariaV1Settlement:testGetSettlementConsiderationDutchAuctionSettlementAbove() (gas: 524599) +TestAstariaV1Settlement:testGetSettlementConsiderationFailedDutchAuction() (gas: 484272) +TestAstariaV1Settlement:testGetSettlementConsiderationLoanNotRecalled() (gas: 474409) +TestAstariaV1Settlement:testGetSettlementConsiderationLoanRecalledByLender() (gas: 506886) +TestAstariaV1Settlement:testGetSettlementConsiderationNoRecallRate() (gas: 486189) +TestAstariaV1Settlement:testV1SettlementHandlerValidate() (gas: 454714) +TestAstariaV1Settlement:testV1SettlementValidateInvalid() (gas: 62616) +TestAstariaV1Settlement:testV1SettlementValidateValid() (gas: 61991) +TestAstariaV1Status:testCannotRecallTwice() (gas: 581966) +TestAstariaV1Status:testCannotWithdrawLoanHasNotBeenRefinanced() (gas: 463071) +TestAstariaV1Status:testCannotWithdrawWithdrawDoesNotExist() (gas: 469779) +TestAstariaV1Status:testGenerateRecallConsideration() (gas: 508246) +TestAstariaV1Status:testInvalidRecallInvalidStakeType() (gas: 523692) +TestAstariaV1Status:testInvalidRecallLoanDoesNotExist() (gas: 510984) +TestAstariaV1Status:testIsActive() (gas: 467865) +TestAstariaV1Status:testIsRecalledInsideWindow() (gas: 596425) +TestAstariaV1Status:testIsRecalledOutsideWindow() (gas: 594357) +TestAstariaV1Status:testRecallAndRefinanceInsideWindow() (gas: 753362) +TestAstariaV1Status:testRecallRateActiveRecall() (gas: 582949) +TestAstariaV1Status:testRecallRateEmptyRecall() (gas: 466199) +TestAstariaV1Status:testV1StatusValidateInValid() (gas: 69799) +TestAstariaV1Status:testV1StatusValidateValid() (gas: 63252) +TestCompoundInterest:testDecimalsTooHigh() (gas: 3340) +TestCompoundInterest:testDecimalsTooLowZero() (gas: 3391) +TestCompoundInterest:testInterestAccrual() (gas: 67017) TestCompoundInterest:testMaxAmountDecimals() (gas: 171733) TestCompoundInterest:testRateExceedsMaxRecallRate() (gas: 3319) TestCompoundInterest:testRateTooLowOne() (gas: 5105) TestCompoundInterest:testRateTooLowOneNonWADDecimal() (gas: 6412) TestCompoundInterest:testRateTooLowZero() (gas: 5126) TestV1BorrowerEnforcer:testFuzzRateMethods((uint256,uint256,uint256),uint256) (runs: 200, μ: 1107, ~: 1107) -TestV1BorrowerEnforcer:testRevertLocateCurrentRateAndAmount() (gas: 61186) +TestV1BorrowerEnforcer:testRevertLocateCurrentRateAndAmount() (gas: 61164) TestV1BorrowerEnforcer:testV1BorrowerEnforcerAmountOOB() (gas: 114125) TestV1BorrowerEnforcer:testV1BorrowerEnforcerDebtBundlesNotSupported() (gas: 75113) TestV1BorrowerEnforcer:testV1BorrowerEnforcerEnd() (gas: 121194) diff --git a/lib/starport b/lib/starport index b64d925..15f71cf 160000 --- a/lib/starport +++ b/lib/starport @@ -1 +1 @@ -Subproject commit b64d9252360b7c5027cd55c076a650079efb65c6 +Subproject commit 15f71cf0d6e9eb15f017ab38c961b3a88b897db6 diff --git a/test/TestV1Settlement.sol b/test/TestV1Settlement.sol index ef55dd2..80ba532 100644 --- a/test/TestV1Settlement.sol +++ b/test/TestV1Settlement.sol @@ -301,24 +301,6 @@ contract TestAstariaV1Settlement is AstariaV1Test, DeepEq { assertEq(AstariaV1Settlement(loan.terms.settlement).validate(loan), Validation.validate.selector); } - function testV1SettlementHandlerValidateInvalidHandler() public { - Starport.Terms memory terms = Starport.Terms({ - status: address(status), - settlement: address(settlement), - pricing: address(pricing), - pricingData: defaultPricingData, - settlementData: defaultSettlementData, - statusData: defaultStatusData - }); - Starport.Loan memory loan = - _createLoan721Collateral20Debt({lender: lender.addr, borrowAmount: 1e18, terms: terms}); - - address settlement = loan.terms.settlement; - loan.terms.settlement = address(0); - vm.expectRevert(abi.encodeWithSelector(AstariaV1Settlement.InvalidHandler.selector)); - AstariaV1Settlement(settlement).validate(loan); - } - function testV1SettlementValidateValid() public { Starport.Loan memory loan = generateDefaultLoanTerms(); assert(Validation(loan.terms.settlement).validate(loan) == Validation.validate.selector); diff --git a/test/TestV1Status.sol b/test/TestV1Status.sol index 1277af4..0063bd5 100644 --- a/test/TestV1Status.sol +++ b/test/TestV1Status.sol @@ -321,7 +321,6 @@ contract TestAstariaV1Status is AstariaV1Test, DeepEq { assert(Validation(loan.terms.status).validate(loan) == Validation.validate.selector); } - //if (details.recallerRewardRatio > 10 ** pDetails.decimals || details.recallMax > 10 * 10 ** pDetails.decimals) { function testV1StatusValidateInValid() public { Starport.Loan memory loan = generateDefaultLoanTerms(); bytes memory defaultDetailsData = loan.terms.statusData;