-
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.
test: Basic Foundry Tests for Hybrid Session Key Manager
- Loading branch information
1 parent
6a84e57
commit 089e7cb
Showing
5 changed files
with
719 additions
and
23 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
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ import {StatefulSessionKeyManagerBase} from "./StatefulSessionKeyManagerBase.sol | |
* @title Session Key Manager module for Biconomy Modular Smart Accounts. | ||
* @dev Similar to the Stateful Session Key Manager module, but the session enable transaction | ||
* is batched with the first transaction that uses the session key. | ||
* Session creation is offline and completely free. | ||
* Session creation is offline. | ||
* @author Ankur Dubey - <[email protected]> | ||
* @author Fil Makarov - <[email protected]> | ||
*/ | ||
|
@@ -27,6 +27,8 @@ contract SessionKeyManagerHybrid is | |
UserOperation calldata userOp, | ||
bytes32 userOpHash | ||
) external virtual override returns (uint256 rv) { | ||
// TODO: Optimize | ||
// TODO use calldata references wherever possible | ||
(bytes memory moduleSignature, ) = abi.decode( | ||
userOp.signature, | ||
(bytes, address) | ||
|
@@ -40,9 +42,9 @@ contract SessionKeyManagerHybrid is | |
if (isSessionEnableTransaction == 1) { | ||
( | ||
, | ||
uint256 sessionKeyIndex, | ||
uint48 validUntil, | ||
uint48 validAfter, | ||
uint256 sessionKeyIndex, | ||
address sessionValidationModule, | ||
bytes memory sessionKeyData, | ||
bytes memory sessionEnableData, | ||
|
@@ -51,10 +53,10 @@ contract SessionKeyManagerHybrid is | |
) = abi.decode( | ||
moduleSignature, | ||
( | ||
uint256, | ||
uint256, | ||
uint48, | ||
uint48, | ||
uint256, | ||
address, | ||
bytes, | ||
bytes, | ||
|
@@ -179,6 +181,7 @@ contract SessionKeyManagerHybrid is | |
sessionValidationModule, | ||
sessionKeyData | ||
); | ||
|
||
if (sessionDigest != computedDigest) { | ||
revert("SessionKeyDataHashMismatch"); | ||
} | ||
|
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
Oops, something went wrong.