-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6574b8
commit 30da23c
Showing
11 changed files
with
105 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"solidity.compileUsingRemoteVersion": "v0.8.21+commit.d9974bed" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ pragma solidity ^0.8.20; | |
* @author Ankur Dubey - <[email protected]> | ||
* @author Fil Makarov - <[email protected]> | ||
*/ | ||
interface ISessionKeyManagerModuleStatefull { | ||
interface ISessionKeyManagerModuleStateful { | ||
struct SessionData { | ||
uint48 validUntil; | ||
uint48 validAfter; | ||
|
33 changes: 0 additions & 33 deletions
33
contracts/smart-account/interfaces/modules/ISessionKeyManagerModuleStateless.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,9 @@ import {BaseAuthorizationModule} from "./BaseAuthorizationModule.sol"; | |
import {_packValidationData} from "@account-abstraction/contracts/core/Helpers.sol"; | ||
import {UserOperation} from "@account-abstraction/contracts/interfaces/UserOperation.sol"; | ||
import {ISessionValidationModule} from "../interfaces/modules/ISessionValidationModule.sol"; | ||
import {ISessionKeyManagerModuleStatefull} from "../interfaces/modules/ISessionKeyManagerModuleStatefull.sol"; | ||
import {ISessionKeyManagerModuleStateful} from "../interfaces/modules/ISessionKeyManagerModuleStateful.sol"; | ||
import {IAuthorizationModule} from "../interfaces/IAuthorizationModule.sol"; | ||
import {ISignatureValidator} from "../interfaces/ISignatureValidator.sol"; | ||
import "hardhat/console.sol"; | ||
|
||
/** | ||
* @title Session Key Manager module for Biconomy Modular Smart Accounts. | ||
|
@@ -17,9 +16,9 @@ import "hardhat/console.sol"; | |
* @author Fil Makarov - <[email protected]> | ||
*/ | ||
|
||
contract SessionKeyManagerStatefull is | ||
contract SessionKeyManagerStateful is | ||
BaseAuthorizationModule, | ||
ISessionKeyManagerModuleStatefull | ||
ISessionKeyManagerModuleStateful | ||
{ | ||
// Inverting the order of the mapping seems to make it non-compliant with the bundlers | ||
mapping(bytes32 sessionDataDigest => mapping(address sa => SessionData data)) | ||
|
@@ -30,8 +29,6 @@ contract SessionKeyManagerStatefull is | |
UserOperation calldata userOp, | ||
bytes32 userOpHash | ||
) external virtual returns (uint256 rv) { | ||
uint256 gas = gasleft(); | ||
|
||
(bytes memory moduleSignature, ) = abi.decode( | ||
userOp.signature, | ||
(bytes, address) | ||
|
@@ -58,23 +55,9 @@ contract SessionKeyManagerStatefull is | |
sessionData.validUntil, | ||
sessionData.validAfter | ||
); | ||
|
||
console.log("Statefull Validation Gas: ", gas - gasleft()); | ||
} | ||
|
||
/// @inheritdoc ISessionKeyManagerModuleStatefull | ||
function validateSessionKey( | ||
address smartAccount, | ||
bytes32 sessionKeyDataDigest | ||
) public virtual override { | ||
require( | ||
enabledSessions[sessionKeyDataDigest][smartAccount] | ||
.sessionValidationModule != address(0), | ||
"SessionKeyManager: session key is not enabled" | ||
); | ||
} | ||
|
||
/// @inheritdoc ISessionKeyManagerModuleStatefull | ||
/// @inheritdoc ISessionKeyManagerModuleStateful | ||
function enableSessionKey( | ||
SessionData calldata sessionData | ||
) external override { | ||
|
@@ -89,6 +72,18 @@ contract SessionKeyManagerStatefull is | |
enabledSessions[sessionDataDigest][msg.sender] = sessionData; | ||
} | ||
|
||
/// @inheritdoc ISessionKeyManagerModuleStateful | ||
function validateSessionKey( | ||
address smartAccount, | ||
bytes32 sessionKeyDataDigest | ||
) public virtual override { | ||
require( | ||
enabledSessions[sessionKeyDataDigest][smartAccount] | ||
.sessionValidationModule != address(0), | ||
"SKM: Session Key is not enabled" | ||
); | ||
} | ||
|
||
/// @inheritdoc ISignatureValidator | ||
function isValidSignature( | ||
bytes32 _dataHash, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.