Skip to content

Commit 94baff3

Browse files
authored
feat(SingleSignerValidation): index additional event fields and mark anonymous [1/2] (#140)
1 parent 1193876 commit 94baff3

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/modules/validation/ISingleSignerValidationModule.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ interface ISingleSignerValidationModule is IValidationModule {
77
/// @notice This event is emitted when Signer of the account's validation changes.
88
/// @param account The account whose validation Signer changed.
99
/// @param entityId The entityId for the account and the signer.
10-
/// @param previousSigner The address of the previous signer.
1110
/// @param newSigner The address of the new signer.
11+
/// @param previousSigner The address of the previous signer.
1212
event SignerTransferred(
13-
address indexed account, uint32 indexed entityId, address previousSigner, address newSigner
14-
);
13+
address indexed account, uint32 indexed entityId, address indexed newSigner, address previousSigner
14+
) anonymous;
1515

1616
error NotAuthorized();
1717

src/modules/validation/SingleSignerValidationModule.sol

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ contract SingleSignerValidationModule is ISingleSignerValidationModule, BaseModu
9494
/// @inheritdoc IValidationModule
9595
/// @dev The signature is valid if it is signed by the owner's private key
9696
/// (if the owner is an EOA) or if it is a valid ERC-1271 signature from the
97-
/// owner (if the owner is a contract). Note that unlike the signature
98-
/// validation used in `validateUserOp`, this does///*not** wrap the digest in
99-
/// an "Ethereum Signed Message" envelope before checking the signature in
100-
/// the EOA-owner case.
97+
/// owner (if the owner is a contract). Note that the signature is wrapped in an EIP-191 message
10198
function validateSignature(address account, uint32 entityId, address, bytes32 digest, bytes calldata signature)
10299
external
103100
view
@@ -130,6 +127,6 @@ contract SingleSignerValidationModule is ISingleSignerValidationModule, BaseModu
130127
function _transferSigner(uint32 entityId, address newSigner) internal {
131128
address previousSigner = signers[entityId][msg.sender];
132129
signers[entityId][msg.sender] = newSigner;
133-
emit SignerTransferred(msg.sender, entityId, previousSigner, newSigner);
130+
emit SignerTransferred(msg.sender, entityId, newSigner, previousSigner);
134131
}
135132
}

test/module/SingleSignerValidationModule.t.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ contract SingleSignerValidationModuleTest is AccountTestBase {
2626

2727
event ValidationInstalled(address indexed module, uint32 indexed entityId);
2828

29+
event SignerTransferred(
30+
address indexed account, uint32 indexed entityId, address indexed newSigner, address previousSigner
31+
) anonymous;
32+
2933
function setUp() public {
3034
ethRecipient = makeAddr("ethRecipient");
3135
(owner2, owner2Key) = makeAddrAndKey("owner2");
@@ -82,6 +86,8 @@ contract SingleSignerValidationModuleTest is AccountTestBase {
8286
uint32 newEntityId = TEST_DEFAULT_VALIDATION_ENTITY_ID + 1;
8387
vm.prank(address(entryPoint));
8488

89+
vm.expectEmit(address(singleSignerValidationModule));
90+
emit SignerTransferred(address(account), newEntityId, owner2, address(0));
8591
vm.expectEmit(true, true, true, true);
8692
emit ValidationInstalled(address(singleSignerValidationModule), newEntityId);
8793
account.installValidation(

0 commit comments

Comments
 (0)