@@ -20,6 +20,8 @@ contract AccountFactory is Ownable {
2020 IEntryPoint public immutable ENTRY_POINT;
2121 address public immutable SINGLE_SIGNER_VALIDATION_MODULE;
2222
23+ error SemiModularAccountAddressMismatch (address expected , address returned );
24+
2325 constructor (
2426 IEntryPoint _entryPoint ,
2527 UpgradeableModularAccount _accountImpl ,
@@ -66,21 +68,23 @@ contract AccountFactory is Ownable {
6668 return UpgradeableModularAccount (payable (addr));
6769 }
6870
69- function createSemiModularAccount (address owner , uint256 salt ) external returns (UpgradeableModularAccount ) {
71+ function createSemiModularAccount (address owner , uint256 salt ) external returns (SemiModularAccount ) {
7072 // both module address and entityId for fallback validations are hardcoded at the maximum value.
7173 bytes32 fullSalt = getSalt (owner, salt, type (uint32 ).max);
7274
7375 bytes memory immutables = _getImmutableArgs (owner);
7476
7577 address addr = _getAddressFallbackSigner (immutables, fullSalt);
7678
77- // short circuit if exists
78- if (addr.code.length == 0 ) {
79- // not necessary to check return addr since next call will fail if so
79+ // LibClone short-circuits if it's already deployed.
80+ (, address instance ) =
8081 LibClone.createDeterministicERC1967 (address (SEMI_MODULAR_ACCOUNT_IMPL), immutables, fullSalt);
82+
83+ if (instance != addr) {
84+ revert SemiModularAccountAddressMismatch (addr, instance);
8185 }
8286
83- return UpgradeableModularAccount (payable (addr));
87+ return SemiModularAccount (payable (addr));
8488 }
8589
8690 function addStake (uint32 unstakeDelay ) external payable onlyOwner {
0 commit comments