Skip to content

Commit

Permalink
feat: fix IModularAccount to return address of the account for native…
Browse files Browse the repository at this point in the history
… functions (#208)

The reference implementation currently returns `address(this)` which is the address of the account for `ExecutionDataView`'s `module` field. However, the standard currently contradicts this by saying we should return `address(0)` for native functions.

The better design seems to be to return the address of the account since the zero address would also be returned for nonexistent selectors, and it would be difficult to differentiate in those cases.

The client should have the address of the account handy so it'd be easy to compare it against what is returned to check if it's a native function or not.

Thanks @0xrubes for bringing this up!
  • Loading branch information
jaypaik authored Nov 27, 2024
1 parent fc91fa5 commit bfe5d75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/IModularAccountView.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {HookConfig, ModuleEntity, ValidationFlags} from "../interfaces/IModularA
/// @dev Represents data associated with a specific function selector.
struct ExecutionDataView {
// The module that implements this execution function.
// If this is a native function, the address must remain address(0).
// If this is a native function, the address must be the address of the account.
address module;
// Whether or not the function needs runtime validation, or can be called by anyone. The function can still be
// state changing if this flag is set to true.
Expand Down
2 changes: 1 addition & 1 deletion standard/ERCs/erc-6900.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Module inspection interface. Modular accounts MAY implement this interface to su
/// @dev Represents data associated with a specific function selector.
struct ExecutionDataView {
// The module that implements this execution function.
// If this is a native function, the address must remain address(0).
// If this is a native function, the address must be the address of the account.
address module;
// Whether or not the function needs runtime validation, or can be called by anyone. The function can still be
// state changing if this flag is set to true.
Expand Down

0 comments on commit bfe5d75

Please sign in to comment.