Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [quantstamp-15] only support executeWithSessionKey method in session key permission hooks #48

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ contract SessionKeyPermissionsPlugin is ISessionKeyPermissionsPlugin, SessionKey

/// @dev A pre user op validation hook that checks the permissions of the key used to validate the user op.
function _checkUserOpPermissions(UserOperation calldata userOp) internal returns (uint256) {
// If not calling executeWithSessionKey, nothing to do. Return 0 as validation success.
if (bytes4(userOp.callData) != ISessionKeyPlugin.executeWithSessionKey.selector) return 0;

// Decode the executions array and the session key from the user op's calldata
(Call[] memory calls, address sessionKey) = abi.decode(userOp.callData[4:], (Call[], address));

Expand Down Expand Up @@ -365,6 +368,9 @@ contract SessionKeyPermissionsPlugin is ISessionKeyPermissionsPlugin, SessionKey

/// @dev Runs as a pre exec hook, and updates the spend limits of the session key in use
function _updateLimitsPreExec(address account, bytes calldata callData) internal {
// If not calling executeWithSessionKey, nothing to do.
if (bytes4(callData) != ISessionKeyPlugin.executeWithSessionKey.selector) return;

(Call[] memory calls, address sessionKey) = abi.decode(callData[4:], (Call[], address));
uint256 callsLength = calls.length;

Expand Down