Skip to content

Commit

Permalink
fix: accountId and moduleId cleanup (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypaik authored Oct 16, 2024
1 parent 88cd733 commit dbfd294
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 16 deletions.
9 changes: 8 additions & 1 deletion src/account/ModularAccount.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import {ValidationConfig} from "@erc6900/reference-implementation/interfaces/IModularAccount.sol";
import {
IModularAccount, ValidationConfig
} from "@erc6900/reference-implementation/interfaces/IModularAccount.sol";
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";

import {ModularAccountBase} from "./ModularAccountBase.sol";
Expand All @@ -23,4 +25,9 @@ contract ModularAccount is ModularAccountBase {
) external virtual initializer {
_installValidation(validationConfig, selectors, installData, hooks);
}

/// @inheritdoc IModularAccount
function accountId() external pure override returns (string memory) {
return "alchemy.modular-account.2.0.0";
}
}
4 changes: 1 addition & 3 deletions src/account/ModularAccountBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,7 @@ abstract contract ModularAccountBase is
}

/// @inheritdoc IModularAccount
function accountId() external pure virtual returns (string memory) {
return "alchemy.modular-account.0.0.1";
}
function accountId() external pure virtual returns (string memory);

/// @inheritdoc UUPSUpgradeable
/// @notice May be validated by a global validation.
Expand Down
7 changes: 1 addition & 6 deletions src/account/SemiModularAccountBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.26;

import {DIRECT_CALL_VALIDATION_ENTITYID} from "@erc6900/reference-implementation/helpers/Constants.sol";
import {IModularAccount, ModuleEntity} from "@erc6900/reference-implementation/interfaces/IModularAccount.sol";
import {ModuleEntity} from "@erc6900/reference-implementation/interfaces/IModularAccount.sol";
import {ModuleEntityLib} from "@erc6900/reference-implementation/libraries/ModuleEntityLib.sol";
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
Expand Down Expand Up @@ -75,11 +75,6 @@ abstract contract SemiModularAccountBase is ModularAccountBase {
return _retrieveFallbackSignerUnchecked(_getSemiModularAccountStorage());
}

/// @inheritdoc IModularAccount
function accountId() external pure override returns (string memory) {
return "alchemy.semi-modular-account.0.0.1";
}

function _execUserOpValidation(
ModuleEntity userOpValidationFunction,
bytes32 userOpHash,
Expand Down
6 changes: 6 additions & 0 deletions src/account/SemiModularAccountBytecode.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import {IModularAccount} from "@erc6900/reference-implementation/interfaces/IModularAccount.sol";
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";
import {LibClone} from "solady/utils/LibClone.sol";

Expand All @@ -16,6 +17,11 @@ import {SemiModularAccountBase} from "./SemiModularAccountBase.sol";
contract SemiModularAccountBytecode is SemiModularAccountBase {
constructor(IEntryPoint anEntryPoint) SemiModularAccountBase(anEntryPoint) {}

/// @inheritdoc IModularAccount
function accountId() external pure override returns (string memory) {
return "alchemy.sma-bytecode.1.0.0";
}

/// @dev If the fallback signer is set in storage, we ignore the bytecode signer.
function _retrieveFallbackSignerUnchecked(SemiModularAccountStorage storage _storage)
internal
Expand Down
6 changes: 6 additions & 0 deletions src/account/SemiModularAccountStorageOnly.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import {IModularAccount} from "@erc6900/reference-implementation/interfaces/IModularAccount.sol";
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";

import {SemiModularAccountBase} from "./SemiModularAccountBase.sol";
Expand All @@ -25,4 +26,9 @@ contract SemiModularAccountStorageOnly is SemiModularAccountBase {
// initialization. However, reading it here would add costs in the vast majority of cases.
emit FallbackSignerSet(address(0), initialSigner);
}

/// @inheritdoc IModularAccount
function accountId() external pure override returns (string memory) {
return "alchemy.sma-storage.1.0.0";
}
}
2 changes: 1 addition & 1 deletion src/modules/permissions/AllowlistModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ contract AllowlistModule is IExecutionHookModule, IValidationHookModule, ModuleB

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "alchemy.allowlist-module.0.0.1";
return "alchemy.allowlist-module.1.0.0";
}

/// @notice Update the token limit of a validation
Expand Down
2 changes: 1 addition & 1 deletion src/modules/permissions/PaymasterGuardModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ contract PaymasterGuardModule is ModuleBase, IValidationHookModule {

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "alchemy.paymaster-guard-module.0.0.1";
return "alchemy.paymaster-guard-module.1.0.0";
}

/// @inheritdoc ModuleBase
Expand Down
2 changes: 1 addition & 1 deletion src/modules/permissions/TimeRangeModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ contract TimeRangeModule is IValidationHookModule, ModuleBase {

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "alchemy.timerange-module.0.0.1";
return "alchemy.time-range-module.1.0.0";
}

/// @notice Sets the time range for the sending account (`msg.sender`) and a given entity id.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/validation/SingleSignerValidationModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ contract SingleSignerValidationModule is IValidationModule, ModuleBase {

/// @inheritdoc IModule
function moduleId() external pure returns (string memory) {
return "erc6900.ecdsa-validation-module.1.0.0";
return "alchemy.single-signer-validation-module.1.0.0";
}

function supportsInterface(bytes4 interfaceId)
Expand Down
2 changes: 1 addition & 1 deletion test/account/ModularAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ contract ModularAccountTest is AccountTestBase {

function test_accountId() public withSMATest {
string memory accountId = account1.accountId();
assertEq(accountId, _isSMATest ? "alchemy.semi-modular-account.0.0.1" : "alchemy.modular-account.0.0.1");
assertEq(accountId, _isSMATest ? "alchemy.sma-bytecode.1.0.0" : "alchemy.modular-account.2.0.0");
}

function test_contractInteraction() public withSMATest {
Expand Down
2 changes: 1 addition & 1 deletion test/modules/TimeRangeModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract TimeRangeModuleTest is CustomValidationTestBase {
}

function test_timeRangeModule_moduleId() public view {
assertEq(timeRangeModule.moduleId(), "alchemy.timerange-module.0.0.1");
assertEq(timeRangeModule.moduleId(), "alchemy.time-range-module.1.0.0");
}

function test_timeRangeModule_install() public withSMATest {
Expand Down

0 comments on commit dbfd294

Please sign in to comment.