Skip to content

Commit

Permalink
πŸ‘·πŸ»β€β™‚οΈ Nonce Type Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredBorders authored Oct 25, 2023
2 parents 6c07465 + fe9aea6 commit db65363
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Conditions:test_isPriceAbove() (gas: 19186)
Conditions:test_isPriceBelow() (gas: 19092)
Conditions:test_isTimestampAfter() (gas: 7711)
Conditions:test_isTimestampBefore() (gas: 7645)
DeploymentTest:test_deploy() (gas: 4550522)
DeploymentTest:test_deploy() (gas: 4550600)
DeploymentTest:test_deploy_oracle_zero_address() (gas: 1681379)
DeploymentTest:test_deploy_perps_market_proxy_zero_address() (gas: 1681295)
DeploymentTest:test_deploy_spot_market_proxy_zero_address() (gas: 1681362)
DeploymentTest:test_deploy_susd_proxy_zero_address() (gas: 1681375)
DeploymentTest:test_deploy_trusted_forwarder_zero_address() (gas: 37411)
Deposit:test_depositEth() (gas: 40987)
Deposit:test_depositEth_event() (gas: 42524)
Deposit:test_depositEth_fuzz(uint256,uint128) (runs: 256, ΞΌ: 39369, ~: 40409)
Deposit:test_depositEth_fuzz(uint256,uint128) (runs: 256, ΞΌ: 39473, ~: 40409)
Deposit:test_depositEth_via_trustedForwarder() (gas: 68274)
Deposit:test_depositEth_via_trustedForwarder_value_mismatch() (gas: 72575)
DepositCollateral:test_depositCollateral() (gas: 258530)
Expand Down Expand Up @@ -68,7 +68,7 @@ VerifyConditions:test_max_condition_size_exceeded() (gas: 45101)
VerifyConditions:test_verifyConditions_InvalidConditionSelector() (gas: 14132)
VerifyConditions:test_verify_conditions_not_verified() (gas: 29751)
VerifyConditions:test_verify_conditions_verified() (gas: 135901)
VerifySignature:test_verifySignature() (gas: 23931)
VerifySignature:test_verifySignature(uint256) (runs: 256, ΞΌ: 24009, ~: 24009)
VerifySignature:test_verifySignature_false_private_key() (gas: 26685)
VerifySigner:test_verifySigner() (gas: 25884)
VerifySigner:test_verifySigner_false() (gas: 28636)
Expand Down
4 changes: 2 additions & 2 deletions deployments/BaseGoerli.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"Engine": "0xD56b9537ee5E0779F0522475525053eE614b07Ba",
"TrustedMulticallForwarder": "0xF84CcAD694ad8F37495b25D3Dd11edAd33d69Fb2"
"Engine": "0x91DFAbeb5a6DEf989a227A2D091589cf6Cd37f36",
"TrustedMulticallForwarder": "0x79bB35A27bfC441b21078debeE52DE3215106A5B"
}
4 changes: 2 additions & 2 deletions deployments/OptimismGoerli.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"Engine": "0xAF9C3649db02B97100aD99801613C8166516E486",
"TrustedMulticallForwarder": "0x00681795118B33814B5B53D8A2d43b5ff71e1Fd7"
"Engine": "0xb120612084CffFF52c2B005597C3d738124C4193",
"TrustedMulticallForwarder": "0xe8bd72765CAED2Ce995B06Fbf51c9c8fDea3f47C"
}
74 changes: 37 additions & 37 deletions lcov.info
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
TN:
SF:script/Deploy.s.sol
FN:24,Setup.deploySystem
FNDA:5,Setup.deploySystem
DA:36,5
DA:38,5
FN:90,DeployOptimism.run
FNDA:0,DeployOptimism.run
DA:91,0
DA:92,0
DA:94,0
DA:101,0
FN:71,DeployBaseGoerli.run
FNDA:0,DeployBaseGoerli.run
DA:72,0
DA:73,0
DA:75,0
DA:82,0
FN:109,DeployOptimismGoerli.run
FNDA:0,DeployOptimismGoerli.run
DA:110,0
Expand All @@ -24,10 +22,12 @@ DA:53,0
DA:54,0
DA:56,0
DA:63,0
FN:24,Setup.deploySystem
FNDA:5,Setup.deploySystem
DA:36,5
DA:38,5
FN:71,DeployBaseGoerli.run
FNDA:0,DeployBaseGoerli.run
DA:72,0
DA:73,0
DA:75,0
DA:82,0
FNF:5
FNH:1
LF:18
Expand Down Expand Up @@ -185,8 +185,8 @@ FN:561,Engine.verifySigner
FNDA:2,Engine.verifySigner
DA:567,19
FN:571,Engine.verifySignature
FNDA:2,Engine.verifySignature
DA:575,18
FNDA:257,Engine.verifySignature
DA:575,273
FN:581,Engine.verifyConditions
FNDA:4,Engine.verifyConditions
DA:587,4
Expand Down Expand Up @@ -315,20 +315,20 @@ FNDA:0,EIP712._domainNameAndVersion
DA:74,0
DA:75,0
FN:80,EIP712.DOMAIN_SEPARATOR
FNDA:26,EIP712.DOMAIN_SEPARATOR
DA:81,26
DA:82,26
FNDA:281,EIP712.DOMAIN_SEPARATOR
DA:81,281
DA:82,281
BRDA:82,0,0,-
BRDA:82,0,1,26
BRDA:82,0,1,281
DA:83,0
FN:100,EIP712._hashTypedData
FNDA:18,EIP712._hashTypedData
DA:105,18
DA:106,18
FNDA:273,EIP712._hashTypedData
DA:105,273
DA:106,273
BRDA:106,1,0,-
BRDA:106,1,1,18
BRDA:106,1,1,273
DA:107,0
DA:115,18
DA:115,273
FN:127,EIP712.eip712Domain
FNDA:0,EIP712.eip712Domain
DA:140,0
Expand All @@ -343,10 +343,10 @@ DA:154,0
DA:155,0
DA:164,0
FN:169,EIP712._cachedDomainSeparatorInvalidated
FNDA:44,EIP712._cachedDomainSeparatorInvalidated
DA:174,44
DA:175,44
DA:178,44
FNDA:554,EIP712._cachedDomainSeparatorInvalidated
DA:174,554
DA:175,554
DA:178,554
FNF:6
FNH:3
LF:21
Expand Down Expand Up @@ -448,6 +448,18 @@ BRH:0
end_of_record
TN:
SF:test/utils/Bootstrap.sol
FN:146,BootstrapOptimismGoerli.init
FNDA:0,BootstrapOptimismGoerli.init
DA:150,0
DA:151,0
DA:158,0
DA:166,0
FN:113,BootstrapOptimism.init
FNDA:0,BootstrapOptimism.init
DA:117,0
DA:118,0
DA:125,0
DA:133,0
FN:41,Bootstrap.initializeOptimismGoerli
FNDA:0,Bootstrap.initializeOptimismGoerli
DA:42,0
Expand Down Expand Up @@ -486,18 +498,6 @@ DA:100,0
DA:101,0
DA:106,0
DA:108,0
FN:146,BootstrapOptimismGoerli.init
FNDA:0,BootstrapOptimismGoerli.init
DA:150,0
DA:151,0
DA:158,0
DA:166,0
FN:113,BootstrapOptimism.init
FNDA:0,BootstrapOptimism.init
DA:117,0
DA:118,0
DA:125,0
DA:133,0
FNF:4
FNH:0
LF:42
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/ConditionalOrderHashLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ library ConditionalOrderHashLib {

/// @notice pre-computed keccak256(ConditionalOrder struct)
bytes32 public constant _CONDITIONAL_ORDER_TYPEHASH = keccak256(
"ConditionalOrder(OrderDetails orderDetails,address signer,uint128 nonce,bool requireVerified,address trustedExecutor,uint256 maxExecutorFee,bytes[] conditions)OrderDetails(uint128 marketId,uint128 accountId,int128 sizeDelta,uint128 settlementStrategyId,uint256 acceptablePrice,bool isReduceOnly,bytes32 trackingCode,address referrer)"
"ConditionalOrder(OrderDetails orderDetails,address signer,uint256 nonce,bool requireVerified,address trustedExecutor,uint256 maxExecutorFee,bytes[] conditions)OrderDetails(uint128 marketId,uint128 accountId,int128 sizeDelta,uint128 settlementStrategyId,uint256 acceptablePrice,bool isReduceOnly,bytes32 trackingCode,address referrer)"
);

/// @notice hash the OrderDetails struct
Expand Down
4 changes: 2 additions & 2 deletions test/ConditionalOrder.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ contract VerifySigner is ConditionalOrderTest {
}

contract VerifySignature is ConditionalOrderTest {
function test_verifySignature() public {
function test_verifySignature(uint256 fuzzyNonce) public {
IEngine.OrderDetails memory orderDetails = IEngine.OrderDetails({
marketId: 0,
accountId: 0,
Expand All @@ -248,7 +248,7 @@ contract VerifySignature is ConditionalOrderTest {
IEngine.ConditionalOrder memory co = IEngine.ConditionalOrder({
orderDetails: orderDetails,
signer: signer,
nonce: 0,
nonce: fuzzyNonce,
requireVerified: false,
trustedExecutor: address(this),
maxExecutorFee: type(uint256).max,
Expand Down
2 changes: 1 addition & 1 deletion test/utils/ConditionalOrderSignature.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract ConditionalOrderSignature {

/// @notice pre-computed keccak256(ConditionalOrder struct)
bytes32 public constant _CONDITIONAL_ORDER_TYPEHASH = keccak256(
"ConditionalOrder(OrderDetails orderDetails,address signer,uint128 nonce,bool requireVerified,address trustedExecutor,uint256 maxExecutorFee,bytes[] conditions)OrderDetails(uint128 marketId,uint128 accountId,int128 sizeDelta,uint128 settlementStrategyId,uint256 acceptablePrice,bool isReduceOnly,bytes32 trackingCode,address referrer)"
"ConditionalOrder(OrderDetails orderDetails,address signer,uint256 nonce,bool requireVerified,address trustedExecutor,uint256 maxExecutorFee,bytes[] conditions)OrderDetails(uint128 marketId,uint128 accountId,int128 sizeDelta,uint128 settlementStrategyId,uint256 acceptablePrice,bool isReduceOnly,bytes32 trackingCode,address referrer)"
);

function getConditionalOrderSignatureRaw(
Expand Down

0 comments on commit db65363

Please sign in to comment.