Skip to content

Commit

Permalink
fix: allow revoke keys via paymaster (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 authored Dec 4, 2024
1 parent 3ae42a7 commit f10f345
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"prepare": "husky",
"fmt": "pnpm prettier --write .",
"lint": "pnpm run lint:markdown && pnpm run lint:spelling && pnpm run lint:prettier",
"lint:fix": "pnpm run lint:prettier --write",
"lint:markdown": "markdownlint-cli2 '**/*.md'",
"lint:spelling": "cspell .",
"lint:prettier": "prettier --check .",
Expand Down
11 changes: 9 additions & 2 deletions src/test/ExampleAuthServerPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ contract ExampleAuthServerPaymaster is IPaymaster, Ownable {
address public immutable AA_FACTORY_CONTRACT_ADDRESS;
address public immutable SESSION_KEY_VALIDATOR_CONTRACT_ADDRESS;
bytes4 constant DEPLOY_ACCOUNT_SELECTOR = AAFactory.deployProxySsoAccount.selector;
bytes4 constant CREATE_SESSION_SELECTOR = SessionKeyValidator.createSession.selector;
bytes4 constant SESSION_CREATE_SELECTOR = SessionKeyValidator.createSession.selector;
bytes4 constant SESSION_REVOKE_KEY_SELECTOR = SessionKeyValidator.revokeKey.selector;
bytes4 constant SESSION_REVOKE_KEYS_SELECTOR = SessionKeyValidator.revokeKeys.selector;

modifier onlyBootloader() {
require(msg.sender == BOOTLOADER_FORMAL_ADDRESS, "Only bootloader can call this method");
Expand Down Expand Up @@ -53,7 +55,12 @@ contract ExampleAuthServerPaymaster is IPaymaster, Ownable {
require(methodSelector == DEPLOY_ACCOUNT_SELECTOR, "Unsupported method");
}
if (to == SESSION_KEY_VALIDATOR_CONTRACT_ADDRESS) {
require(methodSelector == CREATE_SESSION_SELECTOR, "Unsupported method");
require(
methodSelector == SESSION_CREATE_SELECTOR ||
methodSelector == SESSION_REVOKE_KEY_SELECTOR ||
methodSelector == SESSION_REVOKE_KEYS_SELECTOR,
"Unsupported method"
);
}

bytes4 paymasterInputSelector = bytes4(_transaction.paymasterInput[0:4]);
Expand Down

0 comments on commit f10f345

Please sign in to comment.