diff --git a/.gas-snapshot b/.gas-snapshot index ff5f8ed..df9efbb 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,19 +1,19 @@ ValidateSessionParams:test_validateSessionParams() (gas: 29469) -ValidateSessionParams:test_validateSessionParams() (gas: 76317) -ValidateSessionParams:test_validateSessionParams_callValue_invalid(uint256) (runs: 256, μ: 107033, ~: 107033) +ValidateSessionParams:test_validateSessionParams() (gas: 79125) +ValidateSessionParams:test_validateSessionParams_callValue_invalid(uint256) (runs: 256, μ: 109712, ~: 109712) ValidateSessionParams:test_validateSessionParams_destinationContract_invalid(address) (runs: 256, μ: 30633, ~: 30633) ValidateSessionParams:test_validateSessionParams_destinationContract_invalid(address) (runs: 256, μ: 30641, ~: 30641) -ValidateSessionParams:test_validateSessionParams_funcCallData_invalid(bytes4) (runs: 256, μ: 24502, ~: 24502) -ValidateSessionParams:test_validateSessionParams_funcCallData_invalid(bytes4) (runs: 256, μ: 39815, ~: 39928) +ValidateSessionParams:test_validateSessionParams_funcCallData_invalid() (gas: 24048) +ValidateSessionParams:test_validateSessionParams_funcCallData_invalid() (gas: 37720) ValidateSessionParams:test_validateSessionParams_sessionKeyData_invalid(address,address) (runs: 256, μ: 31495, ~: 31495) -ValidateSessionParams:test_validateSessionParams_sessionKeyData_invalid(address,address) (runs: 256, μ: 31633, ~: 31633) -ValidateSessionUserOp:test_validateSessionUserOp() (gas: 308778) -ValidateSessionUserOp:test_validateSessionUserOp() (gas: 71829) -ValidateSessionUserOp:test_validateSessionUserOp_op_callData_invalid(bytes4,address,uint256) (runs: 256, μ: 130244, ~: 130244) -ValidateSessionUserOp:test_validateSessionUserOp_op_callData_invalid(bytes4,address,uint256) (runs: 256, μ: 282952, ~: 282231) -ValidateSessionUserOp:test_validateSessionUserOp_sessionKeyData_invalid(address,address) (runs: 256, μ: 93063, ~: 93082) -ValidateSessionUserOp:test_validateSessionUserOp_sessionKeyData_invalid(address,address) (runs: 256, μ: 95222, ~: 95260) -ValidateSessionUserOp:test_validateSessionUserOp_sessionKeySignature_invalid(uint256) (runs: 256, μ: 82854, ~: 82854) -ValidateSessionUserOp:test_validateSessionUserOp_sessionKeySignature_invalid(uint256) (runs: 256, μ: 83024, ~: 83024) -ValidateSessionUserOp:test_validateSessionUserOp_userOpHash_invalid(bytes32) (runs: 256, μ: 74764, ~: 74764) -ValidateSessionUserOp:test_validateSessionUserOp_userOpHash_invalid(bytes32) (runs: 256, μ: 74934, ~: 74934) \ No newline at end of file +ValidateSessionParams:test_validateSessionParams_sessionKeyData_invalid(address,address) (runs: 256, μ: 31733, ~: 31733) +ValidateSessionUserOp:test_validateSessionUserOp() (gas: 311526) +ValidateSessionUserOp:test_validateSessionUserOp() (gas: 71771) +ValidateSessionUserOp:test_validateSessionUserOp_op_callData_invalid(address) (runs: 256, μ: 114525, ~: 114525) +ValidateSessionUserOp:test_validateSessionUserOp_op_callData_invalid(address,uint256) (runs: 256, μ: 283271, ~: 284818) +ValidateSessionUserOp:test_validateSessionUserOp_sessionKeyData_invalid(address,address) (runs: 256, μ: 93040, ~: 93040) +ValidateSessionUserOp:test_validateSessionUserOp_sessionKeyData_invalid(address,address) (runs: 256, μ: 95241, ~: 95316) +ValidateSessionUserOp:test_validateSessionUserOp_sessionKeySignature_invalid(uint256) (runs: 256, μ: 82818, ~: 82818) +ValidateSessionUserOp:test_validateSessionUserOp_sessionKeySignature_invalid(uint256) (runs: 256, μ: 83146, ~: 83146) +ValidateSessionUserOp:test_validateSessionUserOp_userOpHash_invalid(bytes32) (runs: 256, μ: 74706, ~: 74706) +ValidateSessionUserOp:test_validateSessionUserOp_userOpHash_invalid(bytes32) (runs: 256, μ: 75034, ~: 75034) \ No newline at end of file diff --git a/deployments/BaseGoerli.json b/deployments/BaseGoerli.json index 02b3a06..281ee38 100644 --- a/deployments/BaseGoerli.json +++ b/deployments/BaseGoerli.json @@ -1,4 +1,4 @@ { - "SMv2SessionValidationModule": "0x690ef7a21816A6570d0b500b805bc7ea190E5188", - "SMv3SessionValidationModule": "0xBEc5605040987e52E99c6F97787c7822814b73ca" -} \ No newline at end of file + "SMv2SessionValidationModule": "0x64Db098EDbB149DBe99900c96CC73b6F9A1Af2db", + "SMv3SessionValidationModule": "0x3026c03EEA11204b8dC77969fa36E546f8DC82C9" +} diff --git a/deployments/Optimism.json b/deployments/Optimism.json index 6a6ce82..4230fe1 100644 --- a/deployments/Optimism.json +++ b/deployments/Optimism.json @@ -1,4 +1,4 @@ { - "SMv2SessionValidationModule": "0xBB959E12f9cDd7ba5EcEC3662063D9B97f44208a", - "SMv3SessionValidationModule": "0xf349243bDe8b0Aeee0e52Cb3553047Be8F9cE57c" + "SMv2SessionValidationModule": "tbd", + "SMv3SessionValidationModule": "tbd" } \ No newline at end of file diff --git a/deployments/OptimismGoerli.json b/deployments/OptimismGoerli.json index 812077c..f71e2c2 100644 --- a/deployments/OptimismGoerli.json +++ b/deployments/OptimismGoerli.json @@ -1,4 +1,4 @@ { - "SMv2SessionValidationModule": "0x5D283bE42cEA50cC74F6CeD79A9844efa34F8A5D", - "SMv3SessionValidationModule": "0xAE55743B6Df1df7194a708460950851a74910D9F" + "SMv2SessionValidationModule": "0xF4243f4d3F8014DE6A085F901d3Fc32339f7A088", + "SMv3SessionValidationModule": "0x25EBde897bA211885982b5e74E8F65F3CDdAfA17" } \ No newline at end of file diff --git a/lcov.info b/lcov.info index d47961c..ee2cd3c 100644 --- a/lcov.info +++ b/lcov.info @@ -1,23 +1,23 @@ TN: SF:script/Deploy.s.sol -FN:62,DeployOptimism.run -FNDA:0,DeployOptimism.run -DA:63,0 -DA:64,0 -DA:66,0 -DA:68,0 FN:48,DeployBaseGoerli.run FNDA:0,DeployBaseGoerli.run DA:49,0 DA:50,0 DA:52,0 DA:54,0 -FN:34,DeployBase.run -FNDA:0,DeployBase.run -DA:35,0 -DA:36,0 -DA:38,0 -DA:40,0 +FN:77,DeployOptimismGoerli.run +FNDA:0,DeployOptimismGoerli.run +DA:78,0 +DA:79,0 +DA:81,0 +DA:83,0 +FN:62,DeployOptimism.run +FNDA:0,DeployOptimism.run +DA:63,0 +DA:64,0 +DA:66,0 +DA:68,0 FN:18,Setup.deploySystem FNDA:0,Setup.deploySystem DA:19,0 @@ -25,12 +25,12 @@ DA:20,0 DA:21,0 DA:22,0 DA:23,0 -FN:77,DeployOptimismGoerli.run -FNDA:0,DeployOptimismGoerli.run -DA:78,0 -DA:79,0 -DA:81,0 -DA:83,0 +FN:34,DeployBase.run +FNDA:0,DeployBase.run +DA:35,0 +DA:36,0 +DA:38,0 +DA:40,0 FNF:5 FNH:0 LF:21 @@ -40,133 +40,118 @@ BRH:0 end_of_record TN: SF:src/SMv2SessionValidationModule.sol -FN:29,SMv2SessionValidationModule.validateSessionParams -FNDA:1025,SMv2SessionValidationModule.validateSessionParams -DA:36,1025 -DA:37,1025 -DA:40,1025 -BRDA:40,0,0,512 -BRDA:40,0,1,513 -DA:41,512 -DA:45,513 -BRDA:45,1,0,256 -BRDA:45,1,1,257 -DA:46,256 -DA:49,257 -FN:62,SMv2SessionValidationModule.validateSessionUserOp -FNDA:2049,SMv2SessionValidationModule.validateSessionUserOp -DA:70,2049 -DA:71,256 -BRDA:69,2,0,256 -BRDA:69,2,1,1793 +FN:28,SMv2SessionValidationModule.validateSessionParams +FNDA:770,SMv2SessionValidationModule.validateSessionParams +DA:35,770 +DA:36,770 +DA:39,770 +BRDA:39,0,0,512 +BRDA:39,0,1,258 +DA:40,512 +DA:44,258 +BRDA:44,1,0,1 +BRDA:44,1,1,257 +DA:45,1 +DA:48,257 +FN:61,SMv2SessionValidationModule.validateSessionUserOp +FNDA:1793,SMv2SessionValidationModule.validateSessionUserOp +DA:72,1793 DA:73,256 -DA:76,1793 -DA:77,1793 -DA:79,1793 -DA:85,1793 -BRDA:85,3,0,512 -BRDA:85,3,1,1281 -DA:86,512 -DA:90,1281 -BRDA:90,4,0,256 -BRDA:90,4,1,1025 -DA:91,256 +BRDA:71,2,0,256 +BRDA:71,2,1,1537 +DA:75,256 +DA:78,1537 +DA:79,1537 +DA:81,1537 +DA:87,1537 +BRDA:87,3,0,512 +BRDA:87,3,1,1025 +DA:88,512 +DA:93,1025 +DA:95,1025 DA:96,1025 -DA:98,1025 +DA:97,1025 DA:99,1025 -DA:100,1025 -DA:102,1025 -DA:106,1025 -BRDA:106,5,0,256 -BRDA:106,5,1,769 -DA:107,256 -DA:112,769 +DA:103,1025 +BRDA:103,4,0,256 +BRDA:103,4,1,769 +DA:104,256 +DA:109,769 FNF:2 FNH:2 -LF:25 -LH:25 -BRF:12 -BRH:12 +LF:23 +LH:23 +BRF:10 +BRH:10 end_of_record TN: SF:src/SMv3SessionValidationModule.sol FN:31,SMv3SessionValidationModule.validateSessionParams -FNDA:2566,SMv3SessionValidationModule.validateSessionParams -DA:38,2566 -DA:39,2566 -DA:42,2566 +FNDA:2311,SMv3SessionValidationModule.validateSessionParams +DA:38,2311 +DA:39,2311 +DA:42,2311 BRDA:42,0,0,512 -BRDA:42,0,1,2054 +BRDA:42,0,1,1799 DA:43,512 -DA:47,2054 -DA:49,2054 -DA:50,1541 -DA:51,1284 -DA:52,1027 -DA:53,770 -DA:54,513 -BRDA:48,1,0,256 -BRDA:48,1,1,1798 -DA:56,256 -DA:60,1798 -BRDA:60,2,0,256 -BRDA:60,2,1,1 -DA:61,257 -BRDA:61,3,0,256 -BRDA:61,3,1,1 -DA:62,256 -DA:64,1541 -BRDA:64,4,0,1280 -BRDA:64,4,1,261 -DA:65,1280 -DA:68,262 -FN:81,SMv3SessionValidationModule.validateSessionUserOp +DA:47,1799 +DA:51,1799 +DA:55,1798 +DA:57,262 +FN:70,SMv3SessionValidationModule.validateSessionUserOp FNDA:3334,SMv3SessionValidationModule.validateSessionUserOp -DA:89,3334 -DA:90,256 -BRDA:88,5,0,256 -BRDA:88,5,1,3078 -DA:92,256 -DA:95,3078 +DA:81,3334 +DA:82,256 +BRDA:80,1,0,256 +BRDA:80,1,1,3078 +DA:84,256 +DA:87,3078 +DA:88,3078 +DA:90,3078 DA:96,3078 -DA:98,3078 -DA:104,3078 -BRDA:104,6,0,512 -BRDA:104,6,1,2566 -DA:105,512 -DA:110,2566 -DA:112,2566 -DA:113,2566 -DA:114,2566 +BRDA:96,2,0,512 +BRDA:96,2,1,2566 +DA:97,512 +DA:102,2566 +DA:104,2566 +DA:105,2566 +DA:106,2566 +DA:107,2566 +DA:111,2566 DA:115,2566 -DA:119,2566 -DA:121,2566 -DA:122,1541 -DA:123,1284 -DA:124,1027 -DA:125,770 -DA:126,513 -BRDA:120,7,0,256 -BRDA:120,7,1,2310 -DA:128,256 -DA:132,2310 -BRDA:132,8,0,256 -BRDA:132,8,1,1 -DA:133,257 -BRDA:133,9,0,256 -BRDA:133,9,1,1 -DA:134,256 -DA:136,2053 -BRDA:136,10,0,1280 -BRDA:136,10,1,773 -DA:137,1280 -DA:142,774 -FNF:2 -FNH:2 -LF:45 -LH:45 -BRF:22 -BRH:22 +DA:119,2310 +DA:123,774 +FN:132,SMv3SessionValidationModule._sanitizeSelector +FNDA:4365,SMv3SessionValidationModule._sanitizeSelector +DA:134,4365 +DA:135,2827 +DA:136,2313 +DA:137,1799 +DA:138,1285 +DA:139,771 +BRDA:133,3,0,257 +BRDA:133,3,1,4108 +DA:141,257 +FN:149,SMv3SessionValidationModule._sanitizeCallValue +FNDA:4108,SMv3SessionValidationModule._sanitizeCallValue +DA:154,4108 +DA:155,3594 +BRDA:153,4,0,1024 +BRDA:153,4,1,4 +DA:157,1028 +BRDA:157,5,0,1024 +BRDA:157,5,1,4 +DA:158,1024 +DA:160,3080 +BRDA:160,6,0,2048 +BRDA:160,6,1,1032 +DA:161,2048 +FNF:4 +FNH:4 +LF:38 +LH:38 +BRF:14 +BRH:14 end_of_record TN: SF:src/biconomy/interfaces/UserOperation.sol @@ -202,6 +187,18 @@ BRF:2 BRH:0 end_of_record TN: +SF:src/kwenta/smv3/EIP7412.sol +FN:14,EIP7412.fulfillOracleQuery +FNDA:0,EIP7412.fulfillOracleQuery +DA:18,0 +FNF:1 +FNH:0 +LF:1 +LH:0 +BRF:0 +BRH:0 +end_of_record +TN: SF:src/openzeppelin/ECDSA.sol FN:56,ECDSA.tryRecover FNDA:1543,ECDSA.tryRecover diff --git a/package.json b/package.json index e380a82..54dd8df 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,12 @@ "homepage": "https://github.com/Kwenta/scw-contracts#readme", "scripts": { "compile": "forge build", - "test": "forge test --fork-url $(grep OPTIMISM_GOERLI_RPC_URL .env | cut -d '=' -f2) --etherscan-api-key $(grep OPTIMISM_ETHERSCAN_API_KEY .env | cut -d '=' -f2) --gas-report -vvv", + "test": "forge test --gas-report -vvv", "format": "forge fmt", - "coverage": "forge coverage --fork-url $(grep OPTIMISM_GOERLI_RPC_URL .env | cut -d '=' -f2)", - "coverage:generate-lcov": "forge coverage --fork-url $(grep OPTIMISM_GOERLI_RPC_URL .env | cut -d '=' -f2) --report lcov", + "coverage": "forge coverage", + "coverage:generate-lcov": "forge coverage --report lcov", "analysis:slither": "slither .", - "gas-snapshot": "forge snapshot --fork-url $(grep OPTIMISM_GOERLI_RPC_URL .env | cut -d '=' -f2)", + "gas-snapshot": "forge snapshot", "decode-custom-error": "npx @usecannon/cli decode synthetix-perps-market" }, "repository": { diff --git a/src/SMv2SessionValidationModule.sol b/src/SMv2SessionValidationModule.sol index ea8624c..05f0810 100644 --- a/src/SMv2SessionValidationModule.sol +++ b/src/SMv2SessionValidationModule.sol @@ -64,7 +64,10 @@ contract SMv2SessionValidationModule is ISessionValidationModule { bytes calldata _sessionKeyData, bytes calldata _sessionKeySignature ) external pure override returns (bool) { - /// @dev ensure function selector is `IAccount.execute` + /// @dev ensure function selector either + /// `execute(address,uint256,bytes)` + /// or + /// `execute_ncC(address,uint256,bytes)` if ( bytes4(_op.callData[0:4]) != EXECUTE_SELECTOR && bytes4(_op.callData[0:4]) != EXECUTE_OPTIMIZED_SELECTOR diff --git a/src/SMv3SessionValidationModule.sol b/src/SMv3SessionValidationModule.sol index 331038f..58d4221 100644 --- a/src/SMv3SessionValidationModule.sol +++ b/src/SMv3SessionValidationModule.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.18; import {ECDSA} from "src/openzeppelin/ECDSA.sol"; import {IEngine} from "src/kwenta/smv3/IEngine.sol"; -import {IERC7412} from "src/kwenta/smv3/IERC7412.sol"; +import {EIP7412} from "src/kwenta/smv3/EIP7412.sol"; import { ISessionValidationModule, UserOperation @@ -45,25 +45,14 @@ contract SMv3SessionValidationModule is ISessionValidationModule { /// @dev ensure the function selector is the a valid IEngine selector bytes4 funcSelector = bytes4(_funcCallData[0:4]); - if ( - funcSelector != IEngine.modifyCollateral.selector - && funcSelector != IEngine.commitOrder.selector - && funcSelector != IEngine.invalidateUnorderedNonces.selector - && funcSelector != IERC7412.fulfillOracleQuery.selector - && funcSelector != IEngine.depositEth.selector - && funcSelector != IEngine.withdrawEth.selector - ) { - revert InvalidSMv3Selector(); - } - /// @dev ensure call value is zero unless calling IEngine.depositEth - if (funcSelector == IEngine.depositEth.selector) { - if (callValue == 0) { - revert InvalidCallValue(); - } - } else if (callValue != 0) { - revert InvalidCallValue(); - } + // sanitize the selector; ensure it is a valid selector + // that can be called on the smv3Engine) + _sanitizeSelector(funcSelector); + + // sanitize the call value; ensure it is zero unless calling + // IEngine.depositEth or EIP7412.fulfillOracleQuery + _sanitizeCallValue(funcSelector, callValue); return sessionKey; } @@ -84,7 +73,10 @@ contract SMv3SessionValidationModule is ISessionValidationModule { bytes calldata _sessionKeyData, bytes calldata _sessionKeySignature ) external pure override returns (bool) { - /// @dev ensure function selector is `IAccount.execute` + /// @dev ensure function selector either + /// `execute(address,uint256,bytes)` + /// or + /// `execute_ncC(address,uint256,bytes)` if ( bytes4(_op.callData[0:4]) != EXECUTE_SELECTOR && bytes4(_op.callData[0:4]) != EXECUTE_OPTIMIZED_SELECTOR @@ -115,32 +107,58 @@ contract SMv3SessionValidationModule is ISessionValidationModule { data = _op.callData[4 + offset + 32:4 + offset + 32 + length]; } - /// @dev ensure the function selector is the a valid IEngine selector + // define the function selector bytes4 funcSelector = bytes4(data[0:4]); + + // sanitize the selector; ensure it is a valid selector + // that can be called on the smv3Engine) + _sanitizeSelector(funcSelector); + + // sanitize the call value; ensure it is zero unless calling + // IEngine.depositEth or EIP7412.fulfillOracleQuery + _sanitizeCallValue(funcSelector, callValue); + + /// @dev this method of signature validation is out-of-date + /// see https://github.com/OpenZeppelin/openzeppelin-sdk/blob/7d96de7248ae2e7e81a743513ccc617a2e6bba21/packages/lib/contracts/cryptography/ECDSA.sol#L6 + return ECDSA.recover( + ECDSA.toEthSignedMessageHash(_userOpHash), _sessionKeySignature + ) == sessionKey; + } + + /// @notice sanitize the selector to ensure it is a + /// valid selector that can be called on the smv3Engine + /// @param _selector the selector to sanitize + /// @dev will revert if the selector is not valid + function _sanitizeSelector(bytes4 _selector) internal pure { if ( - funcSelector != IEngine.modifyCollateral.selector - && funcSelector != IEngine.commitOrder.selector - && funcSelector != IEngine.invalidateUnorderedNonces.selector - && funcSelector != IERC7412.fulfillOracleQuery.selector - && funcSelector != IEngine.depositEth.selector - && funcSelector != IEngine.withdrawEth.selector + _selector != IEngine.modifyCollateral.selector + && _selector != IEngine.commitOrder.selector + && _selector != IEngine.invalidateUnorderedNonces.selector + && _selector != EIP7412.fulfillOracleQuery.selector + && _selector != IEngine.depositEth.selector + && _selector != IEngine.withdrawEth.selector ) { revert InvalidSMv3Selector(); } + } - /// @dev ensure call value is zero unless calling IEngine.depositEth - if (funcSelector == IEngine.depositEth.selector) { - if (callValue == 0) { + /// @notice sanitize the call value to ensure it is zero unless calling + /// IEngine.depositEth or EIP7412.fulfillOracleQuery + /// @param _selector the selector to sanitize + /// @dev will revert if the call value is not valid + function _sanitizeCallValue(bytes4 _selector, uint256 _callValue) + internal + pure + { + if ( + _selector == IEngine.depositEth.selector + || _selector == EIP7412.fulfillOracleQuery.selector + ) { + if (_callValue == 0) { revert InvalidCallValue(); } - } else if (callValue != 0) { + } else if (_callValue != 0) { revert InvalidCallValue(); } - - /// @dev this method of signature validation is out-of-date - /// see https://github.com/OpenZeppelin/openzeppelin-sdk/blob/7d96de7248ae2e7e81a743513ccc617a2e6bba21/packages/lib/contracts/cryptography/ECDSA.sol#L6 - return ECDSA.recover( - ECDSA.toEthSignedMessageHash(_userOpHash), _sessionKeySignature - ) == sessionKey; } } diff --git a/src/kwenta/smv3/EIP7412.sol b/src/kwenta/smv3/EIP7412.sol new file mode 100644 index 0000000..b95d3f1 --- /dev/null +++ b/src/kwenta/smv3/EIP7412.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity 0.8.18; + +import {IERC7412} from "./IERC7412.sol"; + +/// @title Kwenta Smart Margin v3: EIP-7412 Utility Contract +/// @notice Responsible for fulfilling EIP-7412 oracle queries +/// @author JaredBorders (jaredborders@pm.me) +contract EIP7412 { + /// @notice Fulfill an EIP-7412 oracle query + /// @param EIP7412Implementer The address of the EIP-7412 implementer + /// @param signedOffchainData The data that was returned + /// from the off-chain interface, signed by the oracle + function fulfillOracleQuery( + address EIP7412Implementer, + bytes calldata signedOffchainData + ) external payable { + IERC7412(EIP7412Implementer).fulfillOracleQuery(signedOffchainData); + } +} diff --git a/test/SMv3SessionValidationModule.t.sol b/test/SMv3SessionValidationModule.t.sol index b9a3eb9..307bb5e 100644 --- a/test/SMv3SessionValidationModule.t.sol +++ b/test/SMv3SessionValidationModule.t.sol @@ -10,7 +10,7 @@ import { UserOperationLib } from "test/utils/UserOperationSignature.sol"; import {IEngine} from "src/kwenta/smv3/IEngine.sol"; -import {IERC7412} from "src/kwenta/smv3/IERC7412.sol"; +import {EIP7412} from "src/kwenta/smv3/EIP7412.sol"; contract SMv3SessionValidationModuleTest is Bootstrap { address signer; @@ -73,7 +73,7 @@ contract SMv3SessionValidationModuleTest is Bootstrap { validSelectors.push(IEngine.modifyCollateral.selector); validSelectors.push(IEngine.commitOrder.selector); validSelectors.push(IEngine.invalidateUnorderedNonces.selector); - validSelectors.push(IERC7412.fulfillOracleQuery.selector); + validSelectors.push(EIP7412.fulfillOracleQuery.selector); validSelectors.push(IEngine.depositEth.selector); validSelectors.push(IEngine.withdrawEth.selector); } @@ -85,10 +85,15 @@ contract ValidateSessionParams is SMv3SessionValidationModuleTest { // ensure each valid selector is accepted funcCallData = abi.encode(validSelectors[i], bytes32("")); - if (validSelectors[i] == IEngine.depositEth.selector) { - callValue = 1; // valid for depositEth + if ( + validSelectors[i] == IEngine.depositEth.selector + || validSelectors[i] == EIP7412.fulfillOracleQuery.selector + ) { + // ONLY non-zero call values are valid when + // calling depositEth() or fulfillOracleQuery() + callValue = 1; } else { - callValue = 0; // invalid for depositEth + callValue = 0; } address retSessionKey = smv3SessionValidationModule @@ -135,6 +140,9 @@ contract ValidateSessionParams is SMv3SessionValidationModuleTest { if (validSelectors[i] == IEngine.depositEth.selector) { callValue = 0; // i.e. invalid for depositEth + } else if (validSelectors[i] == EIP7412.fulfillOracleQuery.selector) + { + callValue = 0; // valid for fulfillOracleQuery } else { callValue = invalid_callValue; } @@ -224,6 +232,9 @@ contract ValidateSessionUserOp is SMv3SessionValidationModuleTest { if (validSelectors[i] == IEngine.depositEth.selector) { callValue = 1; // valid for depositEth + } else if (validSelectors[i] == EIP7412.fulfillOracleQuery.selector) + { + callValue = 1; // valid for fulfillOracleQuery } else { callValue = 0; // invalid for depositEth } @@ -292,6 +303,9 @@ contract ValidateSessionUserOp is SMv3SessionValidationModuleTest { if (validSelectors[i] == IEngine.depositEth.selector) { callValue = 0; // i.e. invalid for depositEth + } else if (validSelectors[i] == EIP7412.fulfillOracleQuery.selector) + { + callValue = 0; // valid for fulfillOracleQuery } else { callValue = invalid_callValue; }