Skip to content

Conversation

@hazim-j
Copy link
Contributor

@hazim-j hazim-j commented Nov 18, 2024

This PR allows SudoPolicy to be assigned as an IUserOpPolicy. Without this we cannot assign a sudo session where canUsePaymaster is set to true since it would violate the following logic:

// by default, minPolicies for userOp policies is 0
// in the case of the UserOp having paymasterAndData and the user opted in, to allow the PermissionID to use
// paymasters, this value will be 1
uint256 minPolicies;
// if a paymaster is used in this userop, we must ensure that the user authorized this PermissionID to use
// any
// paymasters. Should this be the case, a UserOpPolicy must run, this could be a yes policy, or a specific
// UserOpPolicy that can destructure the paymasterAndData and inspect it
if (userOp.paymasterAndData.length != 0) {
if ($canUsePaymaster[permissionId][account]) minPolicies = 1;
else revert PaymasterValidationNotEnabled(permissionId);
}

Without this fix we would need to create a seperate "SudoUserOpPolicy" if we want to ensure that the sudo session can be used with a paymaster.

@filmakarov filmakarov requested a review from zeroknots November 18, 2024 12:38
@filmakarov filmakarov merged commit 62bc58e into erc7579:main Dec 2, 2024
@filmakarov
Copy link
Collaborator

I see no security issues here, proceeding with the merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants