Skip to content

Commit

Permalink
🚀 Upgrade SMv3 with Better Error Handling
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredBorders authored Jun 4, 2024
2 parents 31603c2 + 552788e commit 2ff6d51
Show file tree
Hide file tree
Showing 15 changed files with 461 additions and 1,346 deletions.
122 changes: 61 additions & 61 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
AccountDelegate:test_isAccountDelegate_account_doesnt_exist() (gas: 26743)
AccountDelegate:test_isAccountDelegate_false() (gas: 397500)
AccountDelegate:test_isAccountDelegate_true() (gas: 395470)
AccountDelegate:test_isAccountDelegate_zero_address_caller() (gas: 27985)
AccountDelegate:test_isAccountDelegate_false() (gas: 397433)
AccountDelegate:test_isAccountDelegate_true() (gas: 395403)
AccountDelegate:test_isAccountDelegate_zero_address_caller() (gas: 28007)
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)
AccountOwner:test_isAccountOwner_false() (gas: 235169)
AccountOwner:test_isAccountOwner_true() (gas: 235159)
AccountOwner:test_isAccountOwner_zero_address_caller() (gas: 15677)
CanExecute:test_canExecute_false_insufficent_account_credit() (gas: 421074)
CanExecute:test_canExecute_false_invalid_signature() (gas: 455458)
CanExecute:test_canExecute_false_invalid_signature() (gas: 455480)
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_maxExecutorFee_exceeded() (gas: 403960)
CanExecute:test_canExecute_false_nonce_used() (gas: 1029091)
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() (gas: 585271)
CommitOrder:test_commitOrder_Unauthorized() (gas: 37862)
CommitOrder:test_commitOrder_insufficient_collateral() (gas: 425887)
CommitOrder:test_commitOrder_invalid_market() (gas: 44546)
Conditions:test_isOrderFeeBelow() (gas: 154802)
Conditions:test_isPositionSizeAbove() (gas: 24623)
Conditions:test_isPositionSizeBelow() (gas: 24598)
Conditions:test_isPriceAbove() (gas: 175814)
CommitOrder:test_commitOrder_invalid_market() (gas: 44524)
Conditions:test_isOrderFeeBelow() (gas: 154824)
Conditions:test_isPositionSizeAbove() (gas: 24579)
Conditions:test_isPositionSizeBelow() (gas: 24575)
Conditions:test_isPriceAbove() (gas: 175836)
Conditions:test_isPriceBelow() (gas: 175643)
Conditions:test_isTimestampAfter() (gas: 13288)
Conditions:test_isTimestampBefore() (gas: 13376)
Credit:test_credit(uint256) (runs: 256, μ: 96854, ~: 105108)
Conditions:test_isTimestampAfter() (gas: 13310)
Conditions:test_isTimestampBefore() (gas: 13398)
Credit:test_credit(uint256) (runs: 256, μ: 94831, ~: 105108)
Credit:test_credit_event() (gas: 88151)
Credit:test_credit_zap() (gas: 677111)
Debit:test_debit(uint256) (runs: 256, μ: 136737, ~: 147259)
Credit:test_credit_zap() (gas: 677093)
Debit:test_debit(uint256) (runs: 256, μ: 136580, ~: 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_Unauthorized() (gas: 122875)
Debit:test_debit_event() (gas: 104489)
Debit:test_debit_zap() (gas: 985201)
Debit:test_debit_zap_InsufficientBalance() (gas: 680643)
Debit:test_debit_zap_Unauthorized() (gas: 122887)
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() (gas: 433700)
DepositCollateral:test_depositCollateral_availableMargin() (gas: 437890)
DepositCollateral:test_depositCollateral_collateralAmount() (gas: 433843)
DepositCollateral:test_depositCollateral_collateralAmount() (gas: 433865)
DepositCollateral:test_depositCollateral_insufficient_balance() (gas: 61158)
DepositCollateral:test_depositCollateral_totalCollateralValue() (gas: 435519)
DepositCollateral:test_depositCollateral_zap() (gas: 940531)
DepositCollateral:test_depositCollateral_zap() (gas: 940477)
EIP712Test:test_DOMAIN_SEPARATOR() (gas: 5729)
EIP712Test:test_buildDomainSeparator() (gas: 6363)
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: 322511)
Execute:test_execute_CannotExecuteOrder_invalid_settlementStrategyId() (gas: 103724)
Execute:test_execute_CannotExecuteOrder_invalid_acceptablePrice() (gas: 322533)
Execute:test_execute_CannotExecuteOrder_invalid_settlementStrategyId() (gas: 103746)
Execute:test_execute_CannotExecuteOrder_too_leveraged() (gas: 469157)
Execute:test_execute_event() (gas: 635846)
Execute:test_execute_event() (gas: 635823)
Execute:test_execute_order_committed() (gas: 632413)
Fee:test_fee_exceeds_account_credit() (gas: 125744)
Fee:test_fee_exceeds_account_credit() (gas: 125721)
Fee:test_fee_exceeds_maxExecutorFee() (gas: 125306)
Fee:test_fee_imposed() (gas: 719924)
FulfillOracleQuery:test_fulfillOracleQuery(bytes) (runs: 256, μ: 31280, ~: 31272)
FulfillOracleQuery:test_fulfillOracleQuery(bytes) (runs: 256, μ: 31258, ~: 31250)
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, μ: 577, ~: 603)
MathLibTest:test_fuzz_abs128(int128) (runs: 256, μ: 578, ~: 603)
MathLibTest:test_fuzz_abs256(int256) (runs: 256, μ: 450, ~: 436)
MathLibTest:test_fuzz_toInt256(uint256) (runs: 256, μ: 567, ~: 438)
MathLibTest:test_fuzz_toInt256(uint256) (runs: 256, μ: 989, ~: 438)
MathLibTest:test_isSameSign() (gas: 999)
MathLibTest:test_toInt256() (gas: 3347)
MathLibTest:test_toInt256_overflow() (gas: 3251)
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)
MockUpgrade:test_upgrade_credit_state(uint256) (runs: 256, μ: 4680727, ~: 4680727)
MockUpgrade:test_upgrade_nonce_state(uint256) (runs: 256, μ: 4635945, ~: 4635945)
MockUpgrade:test_upgrade_only_pDAO() (gas: 4587330)
Multicall:testMulticallableBenchmark() (gas: 29251)
Multicall:testMulticallableOriginalBenchmark() (gas: 38474)
Multicall:testMulticallablePreservesMsgSender() (gas: 11116)
Multicall:testMulticallableReturnDataIsProperlyEncoded() (gas: 11637)
Multicall:testMulticallableReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 9570, ~: 7423)
Multicall:testMulticallableReturnDataIsProperlyEncoded(uint256,uint256,uint256,uint256) (runs: 256, μ: 11695, ~: 11695)
Multicall:testMulticallableReturnDataIsProperlyEncoded(string,string,uint256) (runs: 256, μ: 10035, ~: 11887)
Multicall:testMulticallableReturnDataIsProperlyEncoded(uint256,uint256,uint256,uint256) (runs: 256, μ: 11738, ~: 11738)
Multicall:testMulticallableRevertWithCustomError() (gas: 11746)
Multicall:testMulticallableRevertWithMessage() (gas: 13451)
Multicall:testMulticallableRevertWithMessage(string) (runs: 256, μ: 14035, ~: 13883)
Multicall:testMulticallableRevertWithMessage(string) (runs: 256, μ: 14013, ~: 13861)
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, μ: 58094, ~: 58094)
NonceBitmapTest:test_hasUnorderedNonceBeenUsed() (gas: 59883)
NonceBitmapTest:test_invalidateUnorderedNonces() (gas: 83563)
MulticallFulfillOracleQuery:test_fulfillOracleQuery_multicall_double_spend(bytes) (runs: 256, μ: 47615, ~: 47489)
MulticallableEngine:test_multicall_engine_fulfillOracleQuery_modifyCollateral() (gas: 454353)
NonceBitmapTest:test_fuzz_invalidateUnorderedNonces(uint256) (runs: 256, μ: 58116, ~: 58116)
NonceBitmapTest:test_hasUnorderedNonceBeenUsed() (gas: 59860)
NonceBitmapTest:test_invalidateUnorderedNonces() (gas: 83585)
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: 634127)
NonceBitmapTest:test_invalidateUnorderedNonces_event() (gas: 58334)
ReduceOnly:test_reduce_only() (gas: 634104)
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_truncate_size_up() (gas: 614854)
ReduceOnly:test_reduce_only_when_position_doesnt_exist() (gas: 167039)
ReduceOnly:test_reduce_only_zero_size_delta() (gas: 167073)
ReduceOnly:test_reduce_only_zero_size_delta() (gas: 167050)
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)
SignatureCheckerLibTest:testSignatureChecker(bytes32) (runs: 256, μ: 31232, ~: 28441)
SignatureCheckerLibTest:test_isValidSignatureNowCalldata(address,bytes32,bytes) (runs: 256, μ: 3487, ~: 3451)
StorageLayout:test_credit_slot() (gas: 5517)
StorageLayout:test_nonceBitmap_slot() (gas: 5520)
VerifyConditions:test_max_condition_size_exceeded() (gas: 51317)
VerifyConditions:test_verifyConditions_InvalidConditionSelector() (gas: 19096)
VerifyConditions:test_verify_conditions_not_verified() (gas: 127923)
VerifyConditions:test_verify_conditions_verified() (gas: 175747)
VerifyConditions:test_verify_conditions_verified() (gas: 175769)
VerifySignature:test_verifySignature(uint256) (runs: 256, μ: 30169, ~: 30169)
VerifySignature:test_verifySignature_false_private_key() (gas: 32833)
VerifySigner:test_verifySigner() (gas: 30918)
VerifySigner:test_verifySigner_false() (gas: 33626)
WithdrawCollateral:test_withdrawCollateral() (gas: 539605)
WithdrawCollateral:test_withdrawCollateral_insufficient_account_collateral_balance() (gas: 445821)
WithdrawCollateral:test_withdrawCollateral_zap() (gas: 934846)
WithdrawCollateral:test_withdrawCollateral_zero() (gas: 441471)
VerifySignature:test_verifySignature_false_private_key() (gas: 32788)
VerifySigner:test_verifySigner() (gas: 30873)
VerifySigner:test_verifySigner_false() (gas: 33603)
WithdrawCollateral:test_withdrawCollateral() (gas: 539627)
WithdrawCollateral:test_withdrawCollateral_insufficient_account_collateral_balance() (gas: 445843)
WithdrawCollateral:test_withdrawCollateral_zap() (gas: 934868)
WithdrawCollateral:test_withdrawCollateral_zero() (gas: 441404)
12 changes: 4 additions & 8 deletions deployments/Base.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"Synthetix": {
"EngineImplementation": "",
"EngineProxy": ""
},
"Andromeda": {
"EngineImplementation": "0xD1F129e0cDd3Cc5c65ea00041623841C3d709F83",
"EngineImplementation": "0x7219cECaA0923dDfE7cDB3b782Aff7a69A2Ae478",
"EngineProxy": "0xe331a7eeC851Ba702aA8BF43070a178451d6D28E"
},
"Kwenta": {
"EngineImplementation": "",
"EngineProxy": ""
"test": {
"EngineImplementation": "0x3eF73cD1B3B708ab1F2ccB4AcDA036Ac3FDc3615",
"EngineProxy": "0xA2dF816B2C5D8d799069d6a8a9f8464D402b5D25"
}
}
14 changes: 0 additions & 14 deletions deployments/BaseGoerli.json

This file was deleted.

10 changes: 3 additions & 7 deletions deployments/BaseSepolia.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"Synthetix": {
"EngineImplementation": "",
"EngineProxy": ""
},
"Andromeda": {
"EngineImplementation": "0x33B725a1B2dE9178121D423D2A1c062C5452f310",
"EngineImplementation": "0xA2dF816B2C5D8d799069d6a8a9f8464D402b5D25",
"EngineProxy": "0xe5bB889B1f0B6B4B7384Bd19cbb37adBDDa941a6"
},
"Kwenta": {
"test": {
"EngineImplementation": "",
"EngineProxy": ""
}
}
}
6 changes: 1 addition & 5 deletions deployments/Optimism.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"Synthetix": {
"EngineImplementation": "",
"EngineProxy": ""
},
"Andromeda": {
"EngineImplementation": "",
"EngineProxy": ""
},
"Kwenta": {
"test": {
"EngineImplementation": "",
"EngineProxy": ""
}
Expand Down
6 changes: 1 addition & 5 deletions deployments/OptimismGoerli.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"Synthetix": {
"EngineImplementation": "",
"EngineProxy": ""
},
"Andromeda": {
"EngineImplementation": "",
"EngineProxy": ""
},
"Kwenta": {
"test": {
"EngineImplementation": "",
"EngineProxy": ""
}
Expand Down
Loading

0 comments on commit 2ff6d51

Please sign in to comment.