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

feat: session key native token transfer support #106

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
url = https://github.com/leekt/I4337
[submodule "lib/FreshCryptoLib"]
path = lib/FreshCryptoLib
url = https://github.com/rdubois-crypto/FreshCryptoLib
url = https://github.com/rdubois-crypto/FreshCryptoLib
[submodule "lib/p256-verifier"]
path = lib/p256-verifier
url = https://github.com/daimo-eth/p256-verifier
path = lib/p256-verifier
url = https://github.com/daimo-eth/p256-verifier
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
3 changes: 2 additions & 1 deletion src/validator/SessionKeyValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract SessionKeyValidator is IKernelValidator {
// to make this fully work with paymaster service, prepack the address of paymaster up front
if (session.paymaster == address(1)) {
// any paymaster
require(userOp.paymasterAndData.length != 0, "SessionKeyValidator: paymaster not set");
require(userOp.paymasterAndData.length != 0 && bytes20(userOp.paymasterAndData[0:20]) != bytes20(0), "SessionKeyValidator: paymaster not set");
} else if (session.paymaster != address(0)) {
// specific paymaster
require(
Expand Down Expand Up @@ -280,6 +280,7 @@ contract SessionKeyValidator is IKernelValidator {
}

function verifyPermission(bytes calldata data, Permission calldata permission) internal pure returns (bool) {
if(data.length == 0 && permission.sig == bytes4(0x0)) return true;
if (bytes4(data[0:4]) != permission.sig) return false;
for (uint256 i = 0; i < permission.rules.length; i++) {
ParamRule calldata rule = permission.rules[i];
Expand Down
Loading