Skip to content

Commit 1c646f0

Browse files
committed
fix: SessionKeyOwnedKernel owner data for account creation
1 parent 84015fc commit 1c646f0

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/factory/SessionKeyOwnedKernelFactory.sol

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,21 @@ contract SessionKeyOwnedKernelFactory {
1616
}
1717

1818
function createAccount(address _owner, uint256 _index) external returns (EIP1967Proxy proxy) {
19-
bytes memory data = abi.encodePacked(_owner);
19+
bytes memory data = _getOwnerData(_owner);
20+
2021
proxy = singletonFactory.createAccount(validator, data, _index);
2122
}
2223

2324
function getAccountAddress(address _owner, uint256 _index) public view returns (address) {
24-
bytes memory data = abi.encodePacked(_owner);
25+
bytes memory data = _getOwnerData(_owner);
2526
return singletonFactory.getAccountAddress(validator, data, _index);
2627
}
28+
29+
function _getOwnerData(address _owner) internal pure returns (bytes memory data) {
30+
// the owner is treated as a session key that lasts forever
31+
uint48 validUntil = type(uint48).max;
32+
uint48 validAfter = 0;
33+
34+
data = abi.encodePacked(_owner, validUntil, validAfter);
35+
}
2736
}

0 commit comments

Comments
 (0)