diff --git a/.gas-snapshot b/.gas-snapshot index 99babd14..1f69f0f5 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -6,14 +6,14 @@ AccountOwner:test_isAccountOwner_account_doesnt_exist() (gas: 29956) AccountOwner:test_isAccountOwner_false() (gas: 235147) AccountOwner:test_isAccountOwner_true() (gas: 235137) AccountOwner:test_isAccountOwner_zero_address_caller() (gas: 15655) -CanExecute:test_canExecute_false_insufficent_account_credit() (gas: 420851) -CanExecute:test_canExecute_false_invalid_signature() (gas: 455238) -CanExecute:test_canExecute_false_invalid_signer() (gas: 448229) -CanExecute:test_canExecute_false_maxExecutorFee_exceeded() (gas: 403715) -CanExecute:test_canExecute_false_nonce_used() (gas: 1028874) -CanExecute:test_canExecute_false_require_verify_condition_not_met() (gas: 538419) -CanExecute:test_canExecute_false_trusted_executor() (gas: 444513) -CanExecute:test_canExecute_true() (gas: 444130) +CanExecute:test_canExecute_false_insufficent_account_credit() (gas: 421074) +CanExecute:test_canExecute_false_invalid_signature() (gas: 455458) +CanExecute:test_canExecute_false_invalid_signer() (gas: 448449) +CanExecute:test_canExecute_false_maxExecutorFee_exceeded() (gas: 403938) +CanExecute:test_canExecute_false_nonce_used() (gas: 1029134) +CanExecute:test_canExecute_false_require_verify_condition_not_met() (gas: 538639) +CanExecute:test_canExecute_false_trusted_executor() (gas: 444733) +CanExecute:test_canExecute_true() (gas: 444350) CommitOrder:test_commitOrder() (gas: 585293) CommitOrder:test_commitOrder_Unauthorized() (gas: 37862) CommitOrder:test_commitOrder_insufficient_collateral() (gas: 425887) @@ -25,20 +25,20 @@ Conditions:test_isPriceAbove() (gas: 175814) Conditions:test_isPriceBelow() (gas: 175643) Conditions:test_isTimestampAfter() (gas: 13288) Conditions:test_isTimestampBefore() (gas: 13376) -Credit:test_credit(uint256) (runs: 256, μ: 94630, ~: 105108) +Credit:test_credit(uint256) (runs: 256, μ: 96854, ~: 105108) Credit:test_credit_event() (gas: 88151) Credit:test_credit_zap() (gas: 677111) -Debit:test_debit(uint256) (runs: 256, μ: 136580, ~: 147259) +Debit:test_debit(uint256) (runs: 256, μ: 136737, ~: 147259) Debit:test_debit_InsufficientBalance() (gas: 122814) Debit:test_debit_Unauthorized() (gas: 122831) Debit:test_debit_event() (gas: 104507) Debit:test_debit_zap() (gas: 985220) Debit:test_debit_zap_InsufficientBalance() (gas: 680643) Debit:test_debit_zap_Unauthorized() (gas: 122887) -DeploymentTest:test_deploy() (gas: 4543332) -DeploymentTest:test_deploy_perps_market_proxy_zero_address() (gas: 58607) -DeploymentTest:test_deploy_spot_market_proxy_zero_address() (gas: 56011) -DeploymentTest:test_deploy_susd_proxy_zero_address() (gas: 55998) +DeploymentTest:test_deploy() (gas: 4578038) +DeploymentTest:test_deploy_perps_market_proxy_zero_address() (gas: 58661) +DeploymentTest:test_deploy_spot_market_proxy_zero_address() (gas: 56065) +DeploymentTest:test_deploy_susd_proxy_zero_address() (gas: 56052) DepositCollateral:test_depositCollateral() (gas: 433723) DepositCollateral:test_depositCollateral_availableMargin() (gas: 437890) DepositCollateral:test_depositCollateral_collateralAmount() (gas: 433843) @@ -51,62 +51,62 @@ EIP712Test:test_cachedDomainSeparatorInvalidated() (gas: 5454) EIP712Test:test_domainNameAndVersion() (gas: 1261) EIP712Test:test_eip712Domain() (gas: 10831) EIP712Test:test_hashTypedData() (gas: 37085) -Execute:test_execute_CannotExecuteOrder_invalid_acceptablePrice() (gas: 322478) -Execute:test_execute_CannotExecuteOrder_invalid_settlementStrategyId() (gas: 103691) -Execute:test_execute_CannotExecuteOrder_too_leveraged() (gas: 469124) -Execute:test_execute_event() (gas: 635809) -Execute:test_execute_order_committed() (gas: 632376) -Fee:test_fee_exceeds_account_credit() (gas: 125039) -Fee:test_fee_exceeds_maxExecutorFee() (gas: 124601) -Fee:test_fee_imposed() (gas: 719887) +Execute:test_execute_CannotExecuteOrder_invalid_acceptablePrice() (gas: 322511) +Execute:test_execute_CannotExecuteOrder_invalid_settlementStrategyId() (gas: 103724) +Execute:test_execute_CannotExecuteOrder_too_leveraged() (gas: 469157) +Execute:test_execute_event() (gas: 635846) +Execute:test_execute_order_committed() (gas: 632413) +Fee:test_fee_exceeds_account_credit() (gas: 125744) +Fee:test_fee_exceeds_maxExecutorFee() (gas: 125306) +Fee:test_fee_imposed() (gas: 719924) FulfillOracleQuery:test_fulfillOracleQuery(bytes) (runs: 256, μ: 31280, ~: 31272) FulfillOracleQuery:test_fulfillOracleQuery_refund(bytes) (runs: 256, μ: 40303, ~: 40295) FulfillOracleQuery:test_fulfillOracleQuery_revert(bytes) (runs: 256, μ: 32927, ~: 32919) MathLibTest:test_abs128() (gas: 448) MathLibTest:test_abs256() (gas: 458) -MathLibTest:test_fuzz_abs128(int128) (runs: 256, μ: 578, ~: 603) -MathLibTest:test_fuzz_abs256(int256) (runs: 256, μ: 451, ~: 436) -MathLibTest:test_fuzz_toInt256(uint256) (runs: 256, μ: 1000, ~: 438) +MathLibTest:test_fuzz_abs128(int128) (runs: 256, μ: 577, ~: 603) +MathLibTest:test_fuzz_abs256(int256) (runs: 256, μ: 450, ~: 436) +MathLibTest:test_fuzz_toInt256(uint256) (runs: 256, μ: 567, ~: 438) MathLibTest:test_isSameSign() (gas: 999) MathLibTest:test_toInt256() (gas: 3347) MathLibTest:test_toInt256_overflow() (gas: 3251) -MockUpgrade:test_upgrade() (gas: 4567510) -MockUpgrade:test_upgrade_credit_state(uint256) (runs: 256, μ: 4646007, ~: 4646007) -MockUpgrade:test_upgrade_nonce_state(uint256) (runs: 256, μ: 4601314, ~: 4601314) -MockUpgrade:test_upgrade_only_pDAO() (gas: 4552610) +MockUpgrade:test_upgrade() (gas: 4602208) +MockUpgrade:test_upgrade_credit_state(uint256) (runs: 256, μ: 4680705, ~: 4680705) +MockUpgrade:test_upgrade_nonce_state(uint256) (runs: 256, μ: 4636012, ~: 4636012) +MockUpgrade:test_upgrade_only_pDAO() (gas: 4587308) Multicall:testMulticallableBenchmark() (gas: 29229) Multicall:testMulticallableOriginalBenchmark() (gas: 38452) Multicall:testMulticallablePreservesMsgSender() (gas: 11116) Multicall:testMulticallableReturnDataIsProperlyEncoded() (gas: 11637) -Multicall:testMulticallableReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 9680, ~: 7435) +Multicall:testMulticallableReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 9570, ~: 7423) Multicall:testMulticallableReturnDataIsProperlyEncoded(uint256,uint256,uint256,uint256) (runs: 256, μ: 11695, ~: 11695) Multicall:testMulticallableRevertWithCustomError() (gas: 11746) Multicall:testMulticallableRevertWithMessage() (gas: 13451) -Multicall:testMulticallableRevertWithMessage(string) (runs: 256, μ: 14138, ~: 14177) +Multicall:testMulticallableRevertWithMessage(string) (runs: 256, μ: 14035, ~: 13883) Multicall:testMulticallableRevertWithNothing() (gas: 11655) Multicall:testMulticallableWithNoData() (gas: 6311) MulticallFulfillOracleQuery:test_fulfillOracleQuery_multicall(bytes) (runs: 256, μ: 34608, ~: 34543) MulticallFulfillOracleQuery:test_fulfillOracleQuery_multicall_double_spend(bytes) (runs: 256, μ: 47637, ~: 47511) MulticallableEngine:test_multicall_engine_fulfillOracleQuery_modifyCollateral() (gas: 454331) -NonceBitmapTest:test_fuzz_invalidateUnorderedNonces(uint256) (runs: 256, μ: 58059, ~: 58059) -NonceBitmapTest:test_hasUnorderedNonceBeenUsed() (gas: 59813) -NonceBitmapTest:test_invalidateUnorderedNonces() (gas: 83116) -NonceBitmapTest:test_invalidateUnorderedNonces_Only_Owner_Delegate() (gas: 196587) +NonceBitmapTest:test_fuzz_invalidateUnorderedNonces(uint256) (runs: 256, μ: 58094, ~: 58094) +NonceBitmapTest:test_hasUnorderedNonceBeenUsed() (gas: 59883) +NonceBitmapTest:test_invalidateUnorderedNonces() (gas: 83563) +NonceBitmapTest:test_invalidateUnorderedNonces_Only_Owner_Delegate() (gas: 196657) NonceBitmapTest:test_invalidateUnorderedNonces_Unauthorized() (gas: 35549) NonceBitmapTest:test_invalidateUnorderedNonces_event() (gas: 58312) -ReduceOnly:test_reduce_only() (gas: 634098) -ReduceOnly:test_reduce_only_same_sign() (gas: 77892) -ReduceOnly:test_reduce_only_truncate_size_down() (gas: 634238) -ReduceOnly:test_reduce_only_truncate_size_up() (gas: 614783) -ReduceOnly:test_reduce_only_when_position_doesnt_exist() (gas: 166346) -ReduceOnly:test_reduce_only_zero_size_delta() (gas: 166380) -RemoveUpgradability:test_removeUpgradability() (gas: 4537931) -SignatureCheckerLibTest:testSignatureChecker(bytes32) (runs: 256, μ: 31623, ~: 28584) -SignatureCheckerLibTest:test_isValidSignatureNowCalldata(address,bytes32,bytes) (runs: 256, μ: 35465847065546046, ~: 3451) +ReduceOnly:test_reduce_only() (gas: 634127) +ReduceOnly:test_reduce_only_same_sign() (gas: 78584) +ReduceOnly:test_reduce_only_truncate_size_down() (gas: 634267) +ReduceOnly:test_reduce_only_truncate_size_up() (gas: 614812) +ReduceOnly:test_reduce_only_when_position_doesnt_exist() (gas: 167039) +ReduceOnly:test_reduce_only_zero_size_delta() (gas: 167073) +RemoveUpgradability:test_removeUpgradability() (gas: 4572629) +SignatureCheckerLibTest:testSignatureChecker(bytes32) (runs: 256, μ: 31267, ~: 28574) +SignatureCheckerLibTest:test_isValidSignatureNowCalldata(address,bytes32,bytes) (runs: 256, μ: 3493, ~: 3451) StorageLayout:test_credit_slot() (gas: 5584) StorageLayout:test_nonceBitmap_slot() (gas: 5520) VerifyConditions:test_max_condition_size_exceeded() (gas: 51317) -VerifyConditions:test_verifyConditions_InvalidConditionSelector() (gas: 19085) +VerifyConditions:test_verifyConditions_InvalidConditionSelector() (gas: 19096) VerifyConditions:test_verify_conditions_not_verified() (gas: 127923) VerifyConditions:test_verify_conditions_verified() (gas: 175747) VerifySignature:test_verifySignature(uint256) (runs: 256, μ: 30169, ~: 30169) diff --git a/lcov.info b/lcov.info index df0b6ded..7488d067 100644 --- a/lcov.info +++ b/lcov.info @@ -3,56 +3,100 @@ SF:script/Deploy.s.sol FN:209,DeployOptimismGoerli_Synthetix.run FNDA:0,DeployOptimismGoerli_Synthetix.run DA:210,0 +DA:210,0 +DA:210,0 DA:211,0 +DA:211,0 +DA:213,0 DA:213,0 DA:222,0 -FN:101,DeployBaseGoerli_Synthetix.run -FNDA:0,DeployBaseGoerli_Synthetix.run -DA:102,0 -DA:103,0 -DA:105,0 -DA:114,0 +DA:222,0 FN:59,DeployBase_Synthetix.run FNDA:0,DeployBase_Synthetix.run DA:60,0 +DA:60,0 +DA:60,0 +DA:61,0 DA:61,0 DA:63,0 +DA:63,0 +DA:72,0 DA:72,0 FN:143,DeployBaseSepolia_Andromeda.run FNDA:0,DeployBaseSepolia_Andromeda.run DA:144,0 +DA:144,0 +DA:144,0 +DA:145,0 DA:145,0 DA:147,0 +DA:147,0 +DA:156,0 DA:156,0 FN:80,DeployBase_Andromeda.run FNDA:0,DeployBase_Andromeda.run DA:81,0 +DA:81,0 +DA:81,0 DA:82,0 +DA:82,0 +DA:84,0 DA:84,0 DA:93,0 -FN:167,DeployBaseGoerli_KwentaFork.run -FNDA:0,DeployBaseGoerli_KwentaFork.run -DA:168,0 -DA:169,0 -DA:171,0 -DA:180,0 +DA:93,0 FN:188,DeployOptimism_Synthetix.run FNDA:0,DeployOptimism_Synthetix.run DA:189,0 +DA:189,0 +DA:189,0 DA:190,0 +DA:190,0 +DA:192,0 DA:192,0 DA:201,0 +DA:201,0 FN:122,DeployBaseGoerli_Andromeda.run FNDA:0,DeployBaseGoerli_Andromeda.run DA:123,0 +DA:123,0 +DA:123,0 +DA:124,0 DA:124,0 DA:126,0 +DA:126,0 +DA:135,0 DA:135,0 +FN:101,DeployBaseGoerli_Synthetix.run +FNDA:0,DeployBaseGoerli_Synthetix.run +DA:102,0 +DA:102,0 +DA:102,0 +DA:103,0 +DA:103,0 +DA:105,0 +DA:105,0 +DA:114,0 +DA:114,0 +FN:167,DeployBaseGoerli_KwentaFork.run +FNDA:0,DeployBaseGoerli_KwentaFork.run +DA:168,0 +DA:168,0 +DA:168,0 +DA:169,0 +DA:169,0 +DA:171,0 +DA:171,0 +DA:180,0 +DA:180,0 FN:30,Setup.deploySystem FNDA:4,Setup.deploySystem -DA:38,4 -DA:48,1 -DA:51,1 +DA:38,103 +DA:38,103 +DA:48,100 +DA:48,100 +DA:48,100 +DA:51,100 +DA:51,100 FNF:9 FNH:1 LF:35 @@ -62,45 +106,76 @@ BRH:0 end_of_record TN: SF:script/Upgrade.s.sol -FN:25,Setup.deployImplementation -FNDA:0,Setup.deployImplementation -DA:33,0 FN:69,DeployBaseGoerli_Synthetix.run FNDA:0,DeployBaseGoerli_Synthetix.run DA:70,0 +DA:70,0 +DA:70,0 +DA:71,0 DA:71,0 DA:73,0 +DA:73,0 DA:82,0 -FN:156,DeployOptimismGoerli_Synthetix.run -FNDA:0,DeployOptimismGoerli_Synthetix.run -DA:157,0 -DA:158,0 -DA:160,0 -DA:169,0 -FN:48,DeployBase_Synthetix.run -FNDA:0,DeployBase_Synthetix.run -DA:49,0 -DA:50,0 -DA:52,0 -DA:61,0 +DA:82,0 +FN:114,DeployBaseGoerli_Andromeda.run +FNDA:0,DeployBaseGoerli_Andromeda.run +DA:115,0 +DA:115,0 +DA:115,0 +DA:116,0 +DA:116,0 +DA:118,0 +DA:118,0 +DA:127,0 +DA:127,0 FN:93,DeployBaseGoerli_KwentaFork.run FNDA:0,DeployBaseGoerli_KwentaFork.run DA:94,0 +DA:94,0 +DA:94,0 +DA:95,0 DA:95,0 DA:97,0 +DA:97,0 +DA:106,0 DA:106,0 +FN:48,DeployBase_Synthetix.run +FNDA:0,DeployBase_Synthetix.run +DA:49,0 +DA:49,0 +DA:49,0 +DA:50,0 +DA:50,0 +DA:52,0 +DA:52,0 +DA:61,0 +DA:61,0 FN:135,DeployOptimism_Synthetix.run FNDA:0,DeployOptimism_Synthetix.run DA:136,0 +DA:136,0 +DA:136,0 +DA:137,0 DA:137,0 DA:139,0 +DA:139,0 DA:148,0 -FN:114,DeployBaseGoerli_Andromeda.run -FNDA:0,DeployBaseGoerli_Andromeda.run -DA:115,0 -DA:116,0 -DA:118,0 -DA:127,0 +DA:148,0 +FN:156,DeployOptimismGoerli_Synthetix.run +FNDA:0,DeployOptimismGoerli_Synthetix.run +DA:157,0 +DA:157,0 +DA:157,0 +DA:158,0 +DA:158,0 +DA:160,0 +DA:160,0 +DA:169,0 +DA:169,0 +FN:25,Setup.deployImplementation +FNDA:0,Setup.deployImplementation +DA:33,0 +DA:33,0 FNF:7 FNH:0 LF:25 @@ -110,311 +185,543 @@ BRH:0 end_of_record TN: SF:src/Engine.sol +FN:105,Engine. +FNDA:524,Engine. +DA:113,522 +DA:113,522 +DA:113,522 +BRDA:113,0,0,1 +BRDA:113,0,1,527 +DA:113,1 +DA:115,521 +DA:115,521 +DA:119,521 +DA:119,521 FN:127,Engine._authorizeUpgrade FNDA:516,Engine._authorizeUpgrade DA:132,516 -BRDA:132,0,0,1 -BRDA:132,0,1,515 +DA:132,516 +DA:132,516 +BRDA:132,1,0,1 +BRDA:132,1,1,515 +DA:132,1 +DA:133,515 DA:133,515 -BRDA:133,1,0,1 -BRDA:133,1,1,514 +BRDA:133,2,0,1 +BRDA:133,2,1,514 +DA:133,1 FN:141,Engine.isAccountOwner FNDA:4,Engine.isAccountOwner DA:147,270 +DA:147,270 +DA:147,270 +DA:147,270 +DA:147,270 +DA:148,269 +DA:148,269 DA:148,269 FN:152,Engine.isAccountDelegate FNDA:3,Engine.isAccountDelegate DA:158,3 +DA:158,3 +DA:158,3 FN:163,Engine._isAccountOwnerOrDelegate FNDA:543,Engine._isAccountOwnerOrDelegate DA:168,543 +DA:168,543 +DA:168,543 +DA:168,543 +DA:168,543 +DA:169,543 DA:169,543 FN:179,Engine.invalidateUnorderedNonces FNDA:518,Engine.invalidateUnorderedNonces DA:184,518 -BRDA:184,2,0,517 -BRDA:184,2,1,1 +DA:184,518 +BRDA:184,3,0,517 +BRDA:184,3,1,1 +DA:190,517 DA:190,517 DA:192,517 +DA:192,517 +DA:194,1 DA:194,1 FN:199,Engine.hasUnorderedNonceBeenUsed FNDA:772,Engine.hasUnorderedNonceBeenUsed DA:205,793 +DA:205,793 +DA:205,793 +DA:209,793 +DA:209,793 DA:209,793 DA:226,793 +DA:226,793 +DA:226,793 +DA:226,793 FN:241,Engine._bitmapPositions FNDA:806,Engine._bitmapPositions DA:250,806 +DA:250,806 +DA:254,806 DA:254,806 FN:262,Engine._useUnorderedNonce FNDA:13,Engine._useUnorderedNonce DA:263,13 +DA:263,13 +DA:263,13 DA:267,13 +DA:267,13 +DA:267,13 +DA:275,13 +DA:275,13 DA:275,13 DA:298,13 -BRDA:298,3,0,- -BRDA:298,3,1,13 +DA:298,13 +DA:298,13 +BRDA:298,4,0,- +BRDA:298,4,1,13 +DA:298,0 FN:306,Engine.modifyCollateral -FNDA:13,Engine.modifyCollateral -DA:311,13 -DA:313,13 -BRDA:313,4,0,10 -BRDA:313,4,1,3 -DA:314,10 +FNDA:60,Engine.modifyCollateral +DA:311,60 +DA:311,60 +DA:311,60 +DA:313,60 +DA:313,60 +BRDA:313,5,0,57 +BRDA:313,5,1,3 +DA:314,57 +DA:314,57 DA:318,3 -BRDA:318,5,0,- -BRDA:318,5,1,3 +DA:318,3 +BRDA:318,6,0,- +BRDA:318,6,1,3 +DA:318,0 +DA:320,3 DA:320,3 FN:327,Engine.modifyCollateralZap FNDA:2,Engine.modifyCollateralZap DA:332,2 -BRDA:332,6,0,- -BRDA:332,6,1,1 +DA:332,2 +BRDA:332,7,0,- +BRDA:332,7,1,1 +DA:336,1 +DA:336,1 DA:336,1 DA:338,1 +DA:338,1 +DA:340,1 DA:340,1 DA:344,1 -BRDA:344,7,0,- -BRDA:344,7,1,1 +DA:344,1 +BRDA:344,8,0,- +BRDA:344,8,1,1 +DA:344,0 +DA:346,1 DA:346,1 DA:353,1 +DA:353,1 +DA:353,1 +DA:356,1 DA:356,1 FN:360,Engine._depositCollateral -FNDA:10,Engine._depositCollateral -DA:369,10 -DA:371,9 -DA:373,9 +FNDA:57,Engine._depositCollateral +DA:369,57 +DA:369,57 +DA:371,56 +DA:371,56 +DA:373,56 +DA:373,56 FN:376,Engine._withdrawCollateral FNDA:3,Engine._withdrawCollateral DA:383,3 +DA:383,3 +DA:387,1 DA:387,1 FN:395,Engine._getSynthAddress -FNDA:13,Engine._getSynthAddress -DA:400,13 +FNDA:60,Engine._getSynthAddress +DA:400,60 +DA:400,60 FN:410,Engine.commitOrder FNDA:4,Engine.commitOrder DA:426,4 -BRDA:426,8,0,3 -BRDA:426,8,1,1 +DA:426,4 +BRDA:426,9,0,3 +BRDA:426,9,1,1 DA:427,3 +DA:427,3 +DA:437,1 DA:437,1 FN:441,Engine._commitOrder FNDA:13,Engine._commitOrder DA:450,13 +DA:450,13 FN:468,Engine.creditAccount FNDA:776,Engine.creditAccount DA:473,776 +DA:473,776 +DA:476,776 DA:476,776 -DA:478,661 +DA:478,658 +DA:478,658 FN:482,Engine.creditAccountZap FNDA:3,Engine.creditAccountZap DA:488,3 +DA:488,3 +DA:488,3 DA:490,3 +DA:490,3 +DA:492,3 DA:492,3 FN:496,Engine.debitAccount FNDA:259,Engine.debitAccount DA:501,259 -BRDA:501,9,0,1 -BRDA:501,9,1,258 +DA:501,259 +BRDA:501,10,0,1 +BRDA:501,10,1,258 +DA:501,1 +DA:503,258 DA:503,258 -DA:505,143 +DA:505,146 +DA:505,146 FN:509,Engine.debitAccountZap FNDA:3,Engine.debitAccountZap DA:514,3 -BRDA:514,10,0,1 -BRDA:514,10,1,2 +DA:514,3 +BRDA:514,11,0,1 +BRDA:514,11,1,2 +DA:514,1 +DA:516,2 DA:516,2 -BRDA:516,11,0,1 -BRDA:516,11,1,1 +BRDA:516,12,0,1 +BRDA:516,12,1,1 +DA:516,1 DA:519,1 +DA:519,1 +DA:522,1 DA:522,1 +DA:522,1 +DA:525,1 DA:525,1 DA:527,1 +DA:527,1 FN:530,Engine._debit FNDA:259,Engine._debit DA:533,259 -BRDA:533,12,0,105 -BRDA:533,12,1,154 -DA:536,154 -DA:539,154 +DA:533,259 +BRDA:533,13,0,110 +BRDA:533,13,1,149 +DA:533,110 +DA:536,149 +DA:536,149 +DA:539,149 +DA:539,149 FN:547,Engine.execute FNDA:15,Engine.execute DA:563,15 -BRDA:563,13,0,2 -BRDA:563,13,1,13 -DA:566,13 -DA:574,13 -BRDA:574,14,0,1 -BRDA:574,14,1,13 -DA:577,13 -DA:580,13 -BRDA:580,15,0,2 -BRDA:580,15,1,3 -DA:581,6 -DA:587,6 -BRDA:587,16,0,2 -BRDA:587,16,1,4 -DA:588,2 -DA:594,4 -BRDA:594,17,0,1 -BRDA:594,17,1,3 -DA:595,1 -DA:604,3 -BRDA:604,18,0,2 -BRDA:604,18,1,3 -DA:620,2 -DA:625,10 -DA:635,7 -FN:643,Engine.canExecute +DA:563,15 +DA:564,15 +DA:564,15 +DA:565,15 +DA:565,15 +BRDA:565,14,0,2 +BRDA:565,14,1,13 +DA:565,2 +DA:568,13 +DA:568,13 +DA:576,13 +DA:576,13 +BRDA:576,15,0,1 +BRDA:576,15,1,13 +DA:576,1 +DA:579,13 +DA:579,13 +DA:582,13 +BRDA:582,16,0,2 +BRDA:582,16,1,3 +DA:583,6 +DA:583,6 +DA:583,6 +DA:589,6 +DA:589,6 +BRDA:589,17,0,2 +BRDA:589,17,1,4 +DA:590,2 +DA:590,2 +DA:596,4 +DA:596,4 +DA:596,4 +DA:596,4 +BRDA:596,18,0,1 +BRDA:596,18,1,3 +DA:597,1 +DA:597,1 +DA:608,3 +DA:608,3 +DA:608,3 +DA:608,3 +BRDA:608,19,0,2 +BRDA:608,19,1,3 +DA:624,2 +DA:624,2 +DA:629,10 +DA:629,10 +DA:639,7 +DA:639,7 +FN:647,Engine.canExecute FNDA:10,Engine.canExecute -DA:650,25 -BRDA:650,19,0,2 -BRDA:650,19,1,23 -DA:653,23 -BRDA:653,20,0,2 -BRDA:653,20,1,21 -DA:656,21 -BRDA:656,21,0,2 -BRDA:656,21,1,19 -DA:657,2 -DA:662,19 -BRDA:662,22,0,1 -BRDA:662,22,1,18 -DA:665,18 -BRDA:665,23,0,1 -BRDA:665,23,1,17 -DA:668,17 -BRDA:668,24,0,1 -BRDA:668,24,1,- -DA:671,1 -BRDA:671,25,0,1 -BRDA:671,25,1,- -DA:675,16 -BRDA:675,26,0,1 -BRDA:675,26,1,15 -DA:678,15 -FN:686,Engine.verifySigner +DA:654,25 +DA:654,25 +BRDA:654,20,0,2 +BRDA:654,20,1,23 +DA:655,2 +DA:655,2 +DA:659,23 +DA:659,23 +BRDA:659,21,0,2 +BRDA:659,21,1,21 +DA:660,2 +DA:660,2 +DA:664,21 +DA:664,21 +BRDA:664,22,0,2 +BRDA:664,22,1,19 +DA:665,2 +DA:665,2 +DA:670,19 +DA:670,19 +BRDA:670,23,0,1 +BRDA:670,23,1,18 +DA:670,1 +DA:673,18 +DA:673,18 +BRDA:673,24,0,1 +BRDA:673,24,1,17 +DA:674,1 +DA:674,1 +DA:678,17 +BRDA:678,25,0,1 +BRDA:678,25,1,- +DA:681,1 +DA:681,1 +BRDA:681,26,0,1 +BRDA:681,26,1,- +DA:682,1 +DA:682,1 +DA:687,16 +DA:687,16 +BRDA:687,27,0,1 +BRDA:687,27,1,15 +DA:688,1 +DA:688,1 +DA:692,15 +DA:692,15 +FN:700,Engine.verifySigner FNDA:2,Engine.verifySigner -DA:692,21 -FN:696,Engine.verifySignature +DA:706,21 +DA:706,21 +DA:706,21 +FN:710,Engine.verifySignature FNDA:257,Engine.verifySignature -DA:700,275 -FN:708,Engine.verifyConditions +DA:714,275 +DA:714,275 +DA:714,275 +FN:722,Engine.verifyConditions FNDA:4,Engine.verifyConditions -DA:714,5 -DA:715,5 -BRDA:715,27,0,1 -BRDA:715,27,1,4 -DA:716,1 -DA:719,4 -DA:720,14 -DA:721,14 -DA:724,14 -DA:730,14 -DA:731,12 -DA:732,10 -DA:733,7 -DA:734,5 -DA:735,4 -DA:736,3 -DA:737,2 -BRDA:729,28,0,2 -BRDA:729,28,1,11 -DA:741,13 -DA:744,13 -BRDA:744,29,0,2 -BRDA:744,29,1,11 -DA:747,11 -DA:750,1 -DA:754,1 -FN:762,Engine.isTimestampAfter +DA:728,5 +DA:728,5 +DA:729,5 +DA:729,5 +BRDA:729,28,0,1 +BRDA:729,28,1,4 +DA:730,1 +DA:730,1 +DA:733,4 +DA:733,4 +DA:733,15 +DA:734,14 +DA:734,14 +DA:735,14 +DA:735,14 +DA:738,14 +DA:738,14 +DA:738,14 +DA:744,14 +DA:744,14 +DA:744,14 +DA:744,14 +DA:744,14 +DA:744,14 +DA:744,14 +DA:744,14 +DA:744,14 +DA:745,12 +DA:745,12 +DA:746,10 +DA:746,10 +DA:747,7 +DA:747,7 +DA:748,5 +DA:748,5 +DA:749,4 +DA:749,4 +DA:750,3 +DA:750,3 +DA:751,2 +DA:751,2 +BRDA:743,29,0,2 +BRDA:743,29,1,11 +DA:755,13 +DA:755,13 +DA:758,13 +DA:758,13 +DA:758,13 +DA:758,13 +BRDA:758,30,0,2 +BRDA:758,30,1,11 +DA:758,2 +DA:761,11 +DA:761,11 +DA:764,1 +DA:764,1 +DA:768,1 +DA:768,1 +FN:776,Engine.isTimestampAfter FNDA:6,Engine.isTimestampAfter -DA:768,6 -FN:772,Engine.isTimestampBefore +DA:782,6 +DA:782,6 +DA:782,6 +FN:786,Engine.isTimestampBefore FNDA:5,Engine.isTimestampBefore -DA:778,5 -FN:782,Engine.isPriceAbove +DA:792,5 +DA:792,5 +DA:792,5 +FN:796,Engine.isPriceAbove FNDA:6,Engine.isPriceAbove -DA:788,6 -DA:793,6 -FN:797,Engine.isPriceBelow +DA:802,6 +DA:802,6 +DA:802,6 +DA:807,6 +DA:807,6 +DA:807,6 +FN:811,Engine.isPriceBelow FNDA:6,Engine.isPriceBelow -DA:803,6 -DA:808,6 -FN:812,Engine.isMarketOpen +DA:817,6 +DA:817,6 +DA:817,6 +DA:822,6 +DA:822,6 +DA:822,6 +FN:826,Engine.isMarketOpen FNDA:1,Engine.isMarketOpen -DA:818,1 -FN:822,Engine.isPositionSizeAbove +DA:832,1 +DA:832,1 +DA:832,1 +DA:832,1 +FN:836,Engine.isPositionSizeAbove FNDA:4,Engine.isPositionSizeAbove -DA:827,4 -DA:828,4 -DA:830,4 -FN:834,Engine.isPositionSizeBelow -FNDA:4,Engine.isPositionSizeBelow -DA:839,4 -DA:840,4 +DA:841,4 +DA:841,4 +DA:842,4 DA:842,4 -FN:846,Engine.isOrderFeeBelow +DA:844,4 +DA:844,4 +DA:844,4 +FN:848,Engine.isPositionSizeBelow +FNDA:4,Engine.isPositionSizeBelow +DA:853,4 +DA:853,4 +DA:854,4 +DA:854,4 +DA:856,4 +DA:856,4 +DA:856,4 +FN:860,Engine.isOrderFeeBelow FNDA:4,Engine.isOrderFeeBelow -DA:852,4 -DA:857,4 -FNF:33 -FNH:33 -LF:122 -LH:122 -BRF:60 -BRH:54 +DA:866,4 +DA:866,4 +DA:866,4 +DA:871,4 +DA:871,4 +DA:871,4 +FNF:34 +FNH:34 +LF:132 +LH:132 +BRF:62 +BRH:56 end_of_record TN: SF:src/libraries/ConditionalOrderHashLib.sol FN:23,ConditionalOrderHashLib.hash -FNDA:0,ConditionalOrderHashLib.hash -DA:28,0 +FNDA:275,ConditionalOrderHashLib.hash +DA:28,275 +DA:28,275 +DA:28,275 FN:46,ConditionalOrderHashLib.hash -FNDA:0,ConditionalOrderHashLib.hash -DA:51,0 -DA:55,0 -DA:56,0 -DA:57,0 -DA:60,0 +FNDA:275,ConditionalOrderHashLib.hash +DA:51,275 +DA:51,275 +DA:51,275 +DA:55,275 +DA:55,275 +DA:55,275 +DA:56,275 +DA:56,275 +DA:56,276 +DA:56,1 +DA:57,1 +DA:57,1 +DA:60,275 +DA:60,275 +DA:60,275 FNF:2 -FNH:0 +FNH:2 LF:6 -LH:0 +LH:6 BRF:0 BRH:0 end_of_record TN: SF:src/libraries/MathLib.sol FN:12,MathLib.abs128 -FNDA:0,MathLib.abs128 -DA:23,0 +FNDA:265,MathLib.abs128 +DA:23,265 +DA:23,265 FN:30,MathLib.abs256 -FNDA:0,MathLib.abs256 -DA:44,0 +FNDA:261,MathLib.abs256 +DA:44,261 +DA:44,261 FN:53,MathLib.isSameSign -FNDA:0,MathLib.isSameSign -DA:54,0 +FNDA:8,MathLib.isSameSign +DA:54,8 +DA:54,8 BRDA:54,0,0,- -BRDA:54,0,1,- -DA:55,0 +BRDA:54,0,1,8 +DA:55,8 +DA:55,8 +DA:55,8 FN:62,MathLib.toInt256 -FNDA:0,MathLib.toInt256 -DA:63,0 -BRDA:63,1,0,- -BRDA:63,1,1,- -DA:72,0 +FNDA:262,MathLib.toInt256 +DA:63,262 +DA:63,262 +DA:63,262 +BRDA:63,1,0,8 +BRDA:63,1,1,254 +DA:72,254 +DA:72,254 +DA:72,254 FNF:4 -FNH:0 +FNH:4 LF:6 -LH:0 +LH:6 BRF:4 -BRH:0 +BRH:3 end_of_record TN: SF:src/libraries/SignatureCheckerLib.sol FN:32,SignatureCheckerLib.isValidSignatureNowCalldata -FNDA:275,SignatureCheckerLib.isValidSignatureNowCalldata +FNDA:666,SignatureCheckerLib.isValidSignatureNowCalldata FNF:1 FNH:1 LF:0 @@ -424,47 +731,93 @@ BRH:0 end_of_record TN: SF:src/utils/EIP712.sol +FN:38,EIP712. +FNDA:530,EIP712. +DA:39,530 +DA:39,530 +DA:40,541 +DA:40,541 +DA:42,535 +DA:42,535 +DA:42,535 +DA:43,536 +DA:43,536 +DA:43,535 +DA:44,541 +DA:44,541 +DA:44,541 +DA:45,535 +DA:45,535 +DA:46,540 +DA:46,540 +DA:48,535 +DA:48,535 +DA:57,535 +DA:57,535 +DA:59,546 +DA:59,546 FN:69,EIP712._domainNameAndVersion -FNDA:0,EIP712._domainNameAndVersion -DA:74,0 -DA:75,0 +FNDA:537,EIP712._domainNameAndVersion +DA:74,537 +DA:74,537 +DA:75,537 +DA:75,537 FN:80,EIP712.DOMAIN_SEPARATOR FNDA:283,EIP712.DOMAIN_SEPARATOR DA:81,283 +DA:81,283 +DA:82,283 DA:82,283 BRDA:82,0,0,283 BRDA:82,0,1,283 DA:83,283 +DA:83,283 FN:100,EIP712._hashTypedData FNDA:275,EIP712._hashTypedData DA:106,275 +DA:106,275 +DA:107,275 DA:107,275 BRDA:107,1,0,275 BRDA:107,1,1,275 DA:108,275 +DA:108,275 +DA:116,275 DA:116,275 FN:128,EIP712.eip712Domain FNDA:0,EIP712.eip712Domain DA:141,0 +DA:141,0 +DA:142,0 DA:142,0 DA:143,0 +DA:143,0 DA:144,0 +DA:144,0 +DA:145,0 DA:145,0 DA:146,0 +DA:146,0 FN:154,EIP712._buildDomainSeparator FNDA:558,EIP712._buildDomainSeparator DA:156,558 +DA:156,558 DA:157,558 +DA:157,558 +DA:166,558 DA:166,558 FN:171,EIP712._cachedDomainSeparatorInvalidated FNDA:558,EIP712._cachedDomainSeparatorInvalidated DA:176,558 +DA:176,558 +DA:177,558 DA:177,558 DA:180,558 -FNF:6 -FNH:4 -LF:21 -LH:13 +DA:180,558 +FNF:7 +FNH:6 +LF:31 +LH:25 BRF:4 BRH:4 end_of_record @@ -473,6 +826,7 @@ SF:src/utils/EIP7412.sol FN:15,EIP7412.fulfillOracleQuery FNDA:1537,EIP7412.fulfillOracleQuery DA:21,1537 +DA:21,1537 FNF:1 FNH:1 LF:1 @@ -485,8 +839,9 @@ SF:src/utils/MulticallablePayable.sol FN:24,MulticallablePayable.multicall FNDA:1288,MulticallablePayable.multicall DA:33,1288 -BRDA:33,0,0,121 -DA:43,1167 +BRDA:33,0,0,132 +DA:43,1156 +DA:43,1156 FNF:1 FNH:1 LF:2 @@ -497,252 +852,397 @@ end_of_record TN: SF:test/AsyncOrder.t.sol FN:10,AsyncOrderTest.setUp -FNDA:0,AsyncOrderTest.setUp -DA:11,0 -DA:12,0 -DA:14,0 -DA:16,0 -DA:18,0 -DA:24,0 +FNDA:4,AsyncOrderTest.setUp +DA:11,4 +DA:11,4 +DA:12,4 +DA:12,4 +DA:14,4 +DA:14,4 +DA:16,4 +DA:16,4 +DA:18,4 +DA:18,4 +DA:24,4 +DA:24,4 FNF:1 -FNH:0 +FNH:1 LF:6 -LH:0 +LH:6 BRF:0 BRH:0 end_of_record TN: SF:test/Authentication.t.sol FN:7,AuthenticationTest.setUp -FNDA:0,AuthenticationTest.setUp -DA:8,0 -DA:9,0 +FNDA:8,AuthenticationTest.setUp +DA:8,8 +DA:8,8 +DA:9,8 +DA:9,8 FNF:1 -FNH:0 +FNH:1 LF:2 -LH:0 +LH:2 BRF:0 BRH:0 end_of_record TN: SF:test/Collateral.t.sol FN:7,CollateralTest.setUp -FNDA:0,CollateralTest.setUp -DA:8,0 -DA:9,0 +FNDA:10,CollateralTest.setUp +DA:8,10 +DA:8,10 +DA:9,10 +DA:9,10 FNF:1 -FNH:0 +FNH:1 LF:2 -LH:0 +LH:2 BRF:0 BRH:0 end_of_record TN: SF:test/ConditionalOrder.t.sol FN:21,ConditionalOrderTest.setUp -FNDA:0,ConditionalOrderTest.setUp -DA:22,0 -DA:23,0 -DA:25,0 -DA:26,0 -DA:28,0 -DA:29,0 -DA:31,0 -DA:33,0 -DA:35,0 -DA:37,0 -DA:43,0 -DA:45,0 -DA:51,0 +FNDA:37,ConditionalOrderTest.setUp +DA:22,37 +DA:22,37 +DA:23,37 +DA:23,37 +DA:25,37 +DA:25,37 +DA:26,37 +DA:26,37 +DA:28,37 +DA:28,37 +DA:29,37 +DA:29,37 +DA:31,37 +DA:31,37 +DA:33,37 +DA:33,37 +DA:35,37 +DA:35,37 +DA:37,37 +DA:37,37 +DA:43,37 +DA:43,37 +DA:45,37 +DA:45,37 +DA:51,37 +DA:51,37 FNF:1 -FNH:0 +FNH:1 LF:13 -LH:0 +LH:13 BRF:0 BRH:0 end_of_record TN: SF:test/Credit.t.sol FN:11,CreditTest.setUp -FNDA:0,CreditTest.setUp -DA:12,0 -DA:13,0 +FNDA:10,CreditTest.setUp +DA:12,10 +DA:12,10 +DA:13,10 +DA:13,10 FNF:1 -FNH:0 +FNH:1 LF:2 -LH:0 +LH:2 BRF:0 BRH:0 end_of_record TN: SF:test/EIP7412.t.sol FN:17,EIP7412Test.setUp -FNDA:0,EIP7412Test.setUp -DA:18,0 -DA:19,0 -DA:21,0 -DA:22,0 -DA:23,0 +FNDA:5,EIP7412Test.setUp +DA:18,5 +DA:18,5 +DA:19,5 +DA:19,5 +DA:21,5 +DA:21,5 +DA:22,5 +DA:22,5 +DA:23,5 +DA:23,5 FNF:1 -FNH:0 +FNH:1 LF:5 -LH:0 +LH:5 BRF:0 BRH:0 end_of_record TN: SF:test/MulticallablePayableTest.t.sol FN:16,MulticallablePayableTest.setUp -FNDA:0,MulticallablePayableTest.setUp -DA:17,0 -DA:18,0 -DA:20,0 -DA:21,0 +FNDA:12,MulticallablePayableTest.setUp +DA:17,12 +DA:17,12 +DA:18,12 +DA:18,12 +DA:20,12 +DA:20,12 +DA:21,12 +DA:21,12 FNF:1 -FNH:0 +FNH:1 LF:4 -LH:0 +LH:4 BRF:0 BRH:0 end_of_record TN: SF:test/Upgrade.t.sol FN:9,UpgradeTest.setUp -FNDA:0,UpgradeTest.setUp -DA:10,0 -DA:11,0 +FNDA:7,UpgradeTest.setUp +DA:10,7 +DA:10,7 +DA:11,7 +DA:11,7 FNF:1 -FNH:0 +FNH:1 LF:2 -LH:0 +LH:2 BRF:0 BRH:0 end_of_record TN: SF:test/utils/Bootstrap.sol -FN:207,BootstrapOptimism.init -FNDA:0,BootstrapOptimism.init -DA:220,0 -DA:229,0 -DA:238,0 +FN:252,BootstrapOptimismGoerli.init +FNDA:0,BootstrapOptimismGoerli.init +DA:265,0 +DA:265,0 +DA:265,0 +DA:274,0 +DA:274,0 +DA:274,0 +DA:283,0 +DA:283,0 FN:65,Bootstrap.initializeOptimism FNDA:0,Bootstrap.initializeOptimism DA:66,0 +DA:66,0 +DA:66,0 +DA:67,0 DA:67,0 DA:76,0 +DA:76,0 +DA:78,0 DA:78,0 DA:79,0 +DA:79,0 +DA:80,0 DA:80,0 DA:81,0 +DA:81,0 +DA:82,0 DA:82,0 DA:83,0 +DA:83,0 +DA:84,0 DA:84,0 DA:85,0 +DA:85,0 +DA:86,0 DA:86,0 DA:88,0 +DA:88,0 DA:89,0 +DA:89,0 +DA:90,0 DA:90,0 DA:95,0 +DA:95,0 +DA:97,0 DA:97,0 FN:100,Bootstrap.initializeOptimismGoerli FNDA:0,Bootstrap.initializeOptimismGoerli DA:101,0 +DA:101,0 +DA:101,0 DA:102,0 +DA:102,0 +DA:111,0 DA:111,0 DA:113,0 +DA:113,0 +DA:114,0 DA:114,0 DA:115,0 +DA:115,0 +DA:116,0 DA:116,0 DA:117,0 +DA:117,0 +DA:118,0 DA:118,0 DA:119,0 +DA:119,0 DA:120,0 +DA:120,0 +DA:121,0 DA:121,0 DA:123,0 +DA:123,0 +DA:124,0 DA:124,0 DA:125,0 +DA:125,0 +DA:130,0 DA:130,0 DA:132,0 +DA:132,0 FN:135,Bootstrap.initializeBase FNDA:0,Bootstrap.initializeBase -DA:136,0 -DA:137,0 -DA:146,0 -DA:148,0 -DA:149,0 -DA:150,0 -DA:151,0 -DA:152,0 -DA:153,0 -DA:154,0 -DA:155,0 -DA:156,0 -DA:158,0 -DA:159,0 -DA:160,0 -DA:165,0 -DA:167,0 +DA:136,99 +DA:136,99 +DA:136,99 +DA:137,99 +DA:137,99 +DA:146,99 +DA:146,99 +DA:148,99 +DA:148,99 +DA:149,99 +DA:149,99 +DA:150,99 +DA:150,99 +DA:151,99 +DA:151,99 +DA:152,99 +DA:152,99 +DA:153,99 +DA:153,99 +DA:154,99 +DA:154,99 +DA:155,99 +DA:155,99 +DA:156,99 +DA:156,99 +DA:158,99 +DA:158,99 +DA:159,99 +DA:159,99 +DA:160,99 +DA:160,99 +DA:165,99 +DA:165,99 +DA:167,99 +DA:167,99 FN:170,Bootstrap.initializeBaseGoerli FNDA:0,Bootstrap.initializeBaseGoerli DA:171,0 +DA:171,0 +DA:171,0 +DA:172,0 DA:172,0 DA:181,0 +DA:181,0 +DA:183,0 DA:183,0 DA:184,0 +DA:184,0 +DA:185,0 DA:185,0 DA:186,0 +DA:186,0 DA:187,0 +DA:187,0 +DA:188,0 DA:188,0 DA:189,0 +DA:189,0 +DA:190,0 DA:190,0 DA:191,0 +DA:191,0 +DA:193,0 DA:193,0 DA:194,0 +DA:194,0 DA:195,0 +DA:195,0 +DA:200,0 DA:200,0 DA:202,0 +DA:202,0 FN:297,BootstrapBase.init -FNDA:0,BootstrapBase.init -DA:310,0 -DA:319,0 -DA:328,0 -FN:252,BootstrapOptimismGoerli.init -FNDA:0,BootstrapOptimismGoerli.init -DA:265,0 -DA:274,0 -DA:283,0 +FNDA:99,BootstrapBase.init +DA:310,99 +DA:310,99 +DA:310,99 +DA:319,99 +DA:319,99 +DA:319,99 +DA:328,99 +DA:328,99 FN:342,BootstrapBaseGoerli.init FNDA:0,BootstrapBaseGoerli.init DA:355,0 +DA:355,0 +DA:355,0 +DA:364,0 +DA:364,0 DA:364,0 DA:373,0 +DA:373,0 +FN:207,BootstrapOptimism.init +FNDA:0,BootstrapOptimism.init +DA:220,0 +DA:220,0 +DA:220,0 +DA:229,0 +DA:229,0 +DA:229,0 +DA:238,0 +DA:238,0 FNF:8 -FNH:0 +FNH:1 LF:80 -LH:0 +LH:20 BRF:0 BRH:0 end_of_record TN: SF:test/utils/ConditionalOrderSignature.sol FN:24,ConditionalOrderSignature.getConditionalOrderSignatureRaw -FNDA:0,ConditionalOrderSignature.getConditionalOrderSignatureRaw -DA:29,0 -DA:45,0 -DA:46,0 -DA:47,0 -DA:50,0 -DA:63,0 -DA:67,0 +FNDA:283,ConditionalOrderSignature.getConditionalOrderSignatureRaw +DA:29,283 +DA:29,283 +DA:29,283 +DA:45,283 +DA:45,283 +DA:45,283 +DA:46,283 +DA:46,283 +DA:46,284 +DA:46,1 +DA:47,1 +DA:47,1 +DA:50,283 +DA:50,283 +DA:50,283 +DA:63,283 +DA:63,283 +DA:63,283 +DA:67,283 +DA:67,283 FN:70,ConditionalOrderSignature.getConditionalOrderSignature -FNDA:0,ConditionalOrderSignature.getConditionalOrderSignature -DA:75,0 -DA:76,0 -DA:77,0 +FNDA:283,ConditionalOrderSignature.getConditionalOrderSignature +DA:75,283 +DA:75,283 +DA:76,283 +DA:76,283 +DA:77,283 +DA:77,283 +DA:77,283 FNF:2 -FNH:0 +FNH:2 LF:10 -LH:0 +LH:10 BRF:0 BRH:0 end_of_record @@ -750,89 +1250,125 @@ TN: SF:test/utils/Conditions.sol FN:10,Conditions.isTimestampAfter FNDA:0,Conditions.isTimestampAfter -DA:15,0 -DA:16,0 +DA:15,3 +DA:15,3 +DA:16,3 +DA:16,3 FN:19,Conditions.isTimestampBefore FNDA:0,Conditions.isTimestampBefore -DA:24,0 -DA:25,0 +DA:24,2 +DA:24,2 +DA:25,2 +DA:25,2 FN:28,Conditions.isPriceAbove FNDA:0,Conditions.isPriceAbove -DA:33,0 +DA:33,2 +DA:33,2 +DA:33,2 FN:38,Conditions.isPriceBelow FNDA:0,Conditions.isPriceBelow -DA:43,0 +DA:43,2 +DA:43,2 +DA:43,2 FN:48,Conditions.isMarketOpen FNDA:0,Conditions.isMarketOpen -DA:53,0 +DA:53,2 +DA:53,2 +DA:53,2 FN:56,Conditions.isPositionSizeAbove FNDA:0,Conditions.isPositionSizeAbove -DA:61,0 +DA:61,1 +DA:61,1 +DA:61,1 FN:66,Conditions.isPositionSizeBelow FNDA:0,Conditions.isPositionSizeBelow -DA:71,0 +DA:71,1 +DA:71,1 +DA:71,1 FN:76,Conditions.isOrderFeeBelow FNDA:0,Conditions.isOrderFeeBelow -DA:81,0 +DA:81,1 +DA:81,1 +DA:81,1 FNF:8 FNH:0 LF:10 -LH:0 +LH:10 BRF:0 BRH:0 end_of_record TN: SF:test/utils/RandomSigner.sol FN:8,RandomSigner._random -FNDA:0,RandomSigner._random -DA:17,0 -DA:20,0 -BRDA:20,0,0,- -DA:21,0 -DA:24,0 +FNDA:1316,RandomSigner._random +DA:17,1316 +DA:17,1316 +DA:20,1316 +BRDA:20,0,0,257 +DA:21,257 +DA:21,257 +DA:24,257 +DA:24,257 FN:72,RandomSigner._randomSigner -FNDA:0,RandomSigner._randomSigner -DA:76,0 -DA:78,0 -DA:83,0 +FNDA:258,RandomSigner._randomSigner +DA:76,258 +DA:76,258 +DA:78,258 +DA:78,258 +DA:83,258 BRDA:83,1,0,- -DA:94,0 +DA:94,258 +DA:94,258 FN:101,RandomSigner._hem -FNDA:0,RandomSigner._hem -DA:107,0 +FNDA:258,RandomSigner._hem +DA:107,258 +DA:107,258 BRDA:107,2,0,- -BRDA:107,2,1,- +BRDA:107,2,1,258 FNF:3 -FNH:0 +FNH:3 LF:9 -LH:0 +LH:9 BRF:4 -BRH:0 +BRH:2 end_of_record TN: SF:test/utils/SynthMinter.sol +FN:13,SynthMinter. +FNDA:0,SynthMinter. +DA:14,0 +DA:14,0 +DA:15,0 +DA:15,0 FN:18,SynthMinter.mint_sUSD -FNDA:0,SynthMinter.mint_sUSD -DA:19,0 -FNF:1 -FNH:0 -LF:1 -LH:0 +FNDA:142,SynthMinter.mint_sUSD +DA:19,142 +DA:19,142 +FNF:2 +FNH:1 +LF:3 +LH:1 BRF:0 BRH:0 end_of_record TN: SF:test/utils/exposed/EngineExposed.sol +FN:9,EngineExposed. +FNDA:0,EngineExposed. FN:27,EngineExposed.getSynthAddress FNDA:0,EngineExposed.getSynthAddress DA:32,0 +DA:32,0 +DA:32,0 FN:35,EngineExposed.getNonceBitmapSlot FNDA:1,EngineExposed.getNonceBitmapSlot DA:37,1 +DA:37,1 FN:41,EngineExposed.getCreditSlot FNDA:1,EngineExposed.getCreditSlot DA:43,1 -FNF:3 +DA:43,1 +FNF:4 FNH:2 LF:3 LH:2 @@ -841,21 +1377,28 @@ BRH:0 end_of_record TN: SF:test/utils/mocks/EIP7412Mock.sol -FN:24,EIP7412MockRevert.fulfillOracleQuery -FNDA:256,EIP7412MockRevert.fulfillOracleQuery -DA:25,256 FN:9,EIP7412Mock.fulfillOracleQuery FNDA:769,EIP7412Mock.fulfillOracleQuery DA:10,769 +DA:10,769 BRDA:10,0,0,- BRDA:10,0,1,769 DA:11,769 +DA:11,769 +FN:24,EIP7412MockRevert.fulfillOracleQuery +FNDA:256,EIP7412MockRevert.fulfillOracleQuery +DA:25,256 +DA:25,256 FN:16,EIP7412MockRefund.fulfillOracleQuery FNDA:256,EIP7412MockRefund.fulfillOracleQuery DA:17,256 +DA:17,256 BRDA:17,0,0,- BRDA:17,0,1,256 DA:18,256 +DA:18,256 +DA:18,256 +DA:19,256 DA:19,256 BRDA:19,1,0,256 BRDA:19,1,1,- @@ -868,33 +1411,69 @@ BRH:3 end_of_record TN: SF:test/utils/mocks/MockEIP712.sol +FN:15,MockEIP712. +FNDA:6,MockEIP712. +DA:16,6 +DA:16,6 +DA:17,6 +DA:17,6 +DA:19,6 +DA:19,6 +DA:19,6 +DA:20,6 +DA:20,6 +DA:20,6 +DA:21,6 +DA:21,6 +DA:21,6 +DA:22,6 +DA:22,6 +DA:23,6 +DA:23,6 +DA:25,6 +DA:25,6 +DA:34,6 +DA:34,6 +DA:36,6 +DA:36,6 FN:39,MockEIP712.hashTypedData FNDA:0,MockEIP712.hashTypedData DA:44,0 +DA:44,0 +DA:44,0 FN:48,MockEIP712.buildDomainSeparator FNDA:0,MockEIP712.buildDomainSeparator DA:50,0 +DA:50,0 +DA:51,0 DA:51,0 DA:60,0 +DA:60,0 FN:65,MockEIP712.cachedDomainSeparatorInvalidated FNDA:0,MockEIP712.cachedDomainSeparatorInvalidated DA:70,0 +DA:70,0 +DA:71,0 DA:71,0 DA:74,0 -FNF:3 -FNH:0 -LF:7 -LH:0 +DA:74,0 +FNF:4 +FNH:1 +LF:17 +LH:10 BRF:0 BRH:0 end_of_record TN: SF:test/utils/mocks/MockEngineUpgrade.sol +FN:9,MockEngineUpgrade. +FNDA:530,MockEngineUpgrade. FN:27,MockEngineUpgrade.echo FNDA:1,MockEngineUpgrade.echo DA:28,1 -FNF:1 -FNH:1 +DA:28,1 +FNF:2 +FNH:2 LF:1 LH:1 BRF:0 @@ -905,39 +1484,58 @@ SF:test/utils/mocks/MockMulticallablePayable.sol FN:17,MockMulticallablePayable.revertsWithString FNDA:257,MockMulticallablePayable.revertsWithString DA:18,257 +DA:18,257 FN:21,MockMulticallablePayable.revertsWithCustomError FNDA:1,MockMulticallablePayable.revertsWithCustomError DA:22,1 +DA:22,1 FN:25,MockMulticallablePayable.revertsWithNothing FNDA:1,MockMulticallablePayable.revertsWithNothing DA:26,1 +DA:26,1 FN:29,MockMulticallablePayable.returnsTuple FNDA:534,MockMulticallablePayable.returnsTuple DA:34,534 +DA:34,534 FN:37,MockMulticallablePayable.returnsString -FNDA:136,MockMulticallablePayable.returnsString -DA:42,136 +FNDA:125,MockMulticallablePayable.returnsString +DA:42,125 +DA:42,125 FN:47,MockMulticallablePayable.pay FNDA:0,MockMulticallablePayable.pay DA:48,0 +DA:48,0 FN:51,MockMulticallablePayable.returnsSender FNDA:1,MockMulticallablePayable.returnsSender DA:52,1 +DA:52,1 FN:55,MockMulticallablePayable.multicallOriginal FNDA:1,MockMulticallablePayable.multicallOriginal DA:61,1 +DA:61,1 +DA:62,1 DA:62,1 +DA:62,11 +DA:62,10 DA:63,10 +DA:63,10 +DA:64,10 DA:64,10 DA:65,10 +DA:65,10 BRDA:65,0,0,- BRDA:65,0,1,- DA:67,0 +DA:67,0 BRDA:67,1,0,- BRDA:67,1,1,- +DA:67,0 DA:70,0 +DA:70,0 +DA:72,0 DA:72,0 DA:74,10 +DA:74,10 FNF:8 FNH:7 LF:16 @@ -949,17 +1547,20 @@ TN: SF:test/utils/mocks/SynthetixMock.sol FN:10,SynthetixMock.mock_getOpenPosition FNDA:0,SynthetixMock.mock_getOpenPosition -DA:16,0 +DA:16,7 +DA:16,7 FN:25,SynthetixMock.mock_getMaxMarketSize FNDA:0,SynthetixMock.mock_getMaxMarketSize DA:30,0 +DA:30,0 FN:39,SynthetixMock.mock_getAccountOwner FNDA:0,SynthetixMock.mock_getAccountOwner DA:44,0 +DA:44,0 FNF:3 FNH:0 LF:3 -LH:0 +LH:1 BRF:0 BRH:0 end_of_record diff --git a/src/Engine.sol b/src/Engine.sol index 0bcd78c1..572ee2df 100644 --- a/src/Engine.sol +++ b/src/Engine.sol @@ -20,6 +20,7 @@ import {UUPSUpgradeable} from /// @notice Responsible for interacting with /// Synthetix v3 perps markets /// @author JaredBorders (jaredborders@pm.me) +/// @author Flocqst (florian@kwenta.io) contract Engine is IEngine, EIP712, @@ -560,7 +561,9 @@ contract Engine is /// @dev check: (4) signer is authorized to interact with the account /// @dev check: (5) signature for the order was signed by the signer /// @dev check: (6) conditions are met || trusted executor is msg sender - if (!canExecute(_co, _signature, _fee)) revert CannotExecuteOrder(); + (bool canExecuteOrder, CanExecuteResponse reason) = + canExecute(_co, _signature, _fee); + if (!canExecuteOrder) revert CannotExecuteOrder(reason); /// @dev spend the nonce associated with the order; this prevents replay _useUnorderedNonce(_co.orderDetails.accountId, _co.nonce); @@ -585,14 +588,18 @@ contract Engine is // ensure position exists; reduce only orders // cannot increase position size if (positionSize == 0) { - revert CannotExecuteOrder(); + revert CannotExecuteOrder( + CanExecuteResponse.ReduceOnlyPositionDoesNotExist + ); } // ensure incoming size delta is non-zero and // NOT the same sign; // i.e. reduce only orders cannot increase position size if (sizeDelta == 0 || positionSize.isSameSign(sizeDelta)) { - revert CannotExecuteOrder(); + revert CannotExecuteOrder( + CanExecuteResponse.ReduceOnlyCannotIncreasePositionSize + ); } // ensure incoming size delta is not larger @@ -644,38 +651,50 @@ contract Engine is ConditionalOrder calldata _co, bytes calldata _signature, uint256 _fee - ) public view override returns (bool) { + ) public view override returns (bool, CanExecuteResponse) { // verify fee does not exceed the max fee // set by the conditional order - if (_fee > _co.maxExecutorFee) return false; + if (_fee > _co.maxExecutorFee) { + return (false, CanExecuteResponse.FeeExceedsMaxExecutorFee); + } // verify account has enough credit to pay the fee - if (_fee > credit[_co.orderDetails.accountId]) return false; + if (_fee > credit[_co.orderDetails.accountId]) { + return (false, CanExecuteResponse.InsufficientCredit); + } // verify nonce has not been executed before if (hasUnorderedNonceBeenUsed(_co.orderDetails.accountId, _co.nonce)) { - return false; + return (false, CanExecuteResponse.NonceAlreadyUsed); } // verify signer is authorized to interact // with the account - if (!verifySigner(_co)) return false; + if (!verifySigner(_co)) { + return (false, CanExecuteResponse.UnauthorizedSigner); + } // verify signature is valid for signer and order - if (!verifySignature(_co, _signature)) return false; + if (!verifySignature(_co, _signature)) { + return (false, CanExecuteResponse.InvalidSignature); + } // verify conditions are met if (_co.requireVerified) { // if the order requires verification, then all conditions // defined by "conditions" for the order must be met - if (!verifyConditions(_co)) return false; + if (!verifyConditions(_co)) { + return (false, CanExecuteResponse.ConditionsNotVerified); + } } else { // if the order does not require verification, then the caller // must be the trusted executor defined by "trustedExecutor" - if (msg.sender != _co.trustedExecutor) return false; + if (msg.sender != _co.trustedExecutor) { + return (false, CanExecuteResponse.CallerNotTrustedExecutor); + } } - return true; + return (true, CanExecuteResponse.None); } /*////////////////////////////////////////////////////////////// diff --git a/src/interfaces/IEngine.sol b/src/interfaces/IEngine.sol index 2ddfacfc..28c5956a 100644 --- a/src/interfaces/IEngine.sol +++ b/src/interfaces/IEngine.sol @@ -6,6 +6,7 @@ import {IPerpsMarketProxy} from "src/interfaces/synthetix/IPerpsMarketProxy.sol" /// @title Kwenta Smart Margin v3: Engine Interface /// @notice Conditional Order -> "co" /// @author JaredBorders (jaredborders@pm.me) +/// @author Flocqst (florian@kwenta.io) interface IEngine { /*////////////////////////////////////////////////////////////// TYPES @@ -57,6 +58,20 @@ interface IEngine { bytes[] conditions; } + /// @notice canExecute response codes + enum CanExecuteResponse { + None, + FeeExceedsMaxExecutorFee, + InsufficientCredit, + NonceAlreadyUsed, + UnauthorizedSigner, + InvalidSignature, + ConditionsNotVerified, + CallerNotTrustedExecutor, + ReduceOnlyCannotIncreasePositionSize, + ReduceOnlyPositionDoesNotExist + } + /*////////////////////////////////////////////////////////////// ERRORS //////////////////////////////////////////////////////////////*/ @@ -66,7 +81,7 @@ interface IEngine { error Unauthorized(); /// @notice thrown when an order cannot be executed - error CannotExecuteOrder(); + error CannotExecuteOrder(CanExecuteResponse reason); /// @notice thrown when number of conditions /// exceeds max allowed @@ -457,11 +472,12 @@ interface IEngine { /// market is in a state that is not predictable /// (ex: unpredictable updates to the market's simulated fill price) /// @return true if the order can be executed, false otherwise + /// along with CanExecuteResponse response code. function canExecute( ConditionalOrder calldata _co, bytes calldata _signature, uint256 _fee - ) external view returns (bool); + ) external view returns (bool, CanExecuteResponse); /// @notice verify the co signer is the owner or delegate of the account /// @param _co the co diff --git a/test/ConditionalOrder.t.sol b/test/ConditionalOrder.t.sol index 17d05486..421654c1 100644 --- a/test/ConditionalOrder.t.sol +++ b/test/ConditionalOrder.t.sol @@ -89,7 +89,7 @@ contract CanExecute is ConditionalOrderTest { function test_canExecute_true() public { _defineConditionalOrder(); - bool canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertTrue(canExec); } @@ -106,7 +106,7 @@ contract CanExecute is ConditionalOrderTest { }); // CO_FEE is non-zero, so it exceeds the maxExecutorFee - bool canExec = engine.canExecute(co, signature, CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, CO_FEE); assertFalse(canExec); } @@ -118,7 +118,7 @@ contract CanExecute is ConditionalOrderTest { assertEq(engine.credit(accountId), 0); // CO_FEE is non-zero, and the account has no credit - bool canExec = engine.canExecute(co, signature, CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, CO_FEE); assertFalse(canExec); } @@ -129,7 +129,7 @@ contract CanExecute is ConditionalOrderTest { engine.execute(co, signature, ZERO_CO_FEE); // nonce is now used; cannot execute again - bool canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertFalse(canExec); } @@ -145,7 +145,7 @@ contract CanExecute is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - bool canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertFalse(canExec); } @@ -159,7 +159,7 @@ contract CanExecute is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - bool canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertFalse(canExec); } @@ -169,7 +169,7 @@ contract CanExecute is ConditionalOrderTest { vm.prank(BAD_ACTOR); - bool canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertFalse(canExec); } @@ -205,7 +205,7 @@ contract CanExecute is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - bool canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertFalse(canExec); } @@ -736,7 +736,12 @@ contract Fee is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - vm.expectRevert(IEngine.CannotExecuteOrder.selector); + vm.expectRevert( + abi.encodeWithSelector( + IEngine.CannotExecuteOrder.selector, + IEngine.CanExecuteResponse.InsufficientCredit + ) + ); engine.execute(co, signature, CO_FEE + 1); } @@ -771,7 +776,12 @@ contract Fee is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - vm.expectRevert(IEngine.CannotExecuteOrder.selector); + vm.expectRevert( + abi.encodeWithSelector( + IEngine.CannotExecuteOrder.selector, + IEngine.CanExecuteResponse.FeeExceedsMaxExecutorFee + ) + ); engine.execute(co, signature, CO_FEE); } @@ -848,7 +858,12 @@ contract ReduceOnly is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - vm.expectRevert(IEngine.CannotExecuteOrder.selector); + vm.expectRevert( + abi.encodeWithSelector( + IEngine.CannotExecuteOrder.selector, + IEngine.CanExecuteResponse.ReduceOnlyPositionDoesNotExist + ) + ); engine.execute(co, signature, ZERO_CO_FEE); } @@ -885,7 +900,12 @@ contract ReduceOnly is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - vm.expectRevert(IEngine.CannotExecuteOrder.selector); + vm.expectRevert( + abi.encodeWithSelector( + IEngine.CannotExecuteOrder.selector, + IEngine.CanExecuteResponse.ReduceOnlyPositionDoesNotExist + ) + ); engine.execute(co, signature, ZERO_CO_FEE); } @@ -926,7 +946,12 @@ contract ReduceOnly is ConditionalOrderTest { domainSeparator: engine.DOMAIN_SEPARATOR() }); - vm.expectRevert(IEngine.CannotExecuteOrder.selector); + vm.expectRevert( + abi.encodeWithSelector( + IEngine.CannotExecuteOrder.selector, + IEngine.CanExecuteResponse.ReduceOnlyCannotIncreasePositionSize + ) + ); engine.execute(co, signature, ZERO_CO_FEE); } diff --git a/test/NonceBitmap.t.sol b/test/NonceBitmap.t.sol index ea9bad86..f7e945c4 100644 --- a/test/NonceBitmap.t.sol +++ b/test/NonceBitmap.t.sol @@ -75,7 +75,7 @@ contract NonceBitmapTest is Bootstrap, ConditionalOrderSignature { domainSeparator: engine.DOMAIN_SEPARATOR() }); - bool canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (bool canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertTrue(canExec); @@ -83,7 +83,7 @@ contract NonceBitmapTest is Bootstrap, ConditionalOrderSignature { engine.invalidateUnorderedNonces(accountId, uint248(nonce >> 8), mask); - canExec = engine.canExecute(co, signature, ZERO_CO_FEE); + (canExec,) = engine.canExecute(co, signature, ZERO_CO_FEE); assertFalse(canExec); }