Skip to content

Commit

Permalink
feat(ssv): index additional event fields and mark anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
adamegyed committed Aug 14, 2024
1 parent ed9258e commit 1413909
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/modules/validation/ISingleSignerValidation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ interface ISingleSignerValidation is IValidation {
/// @notice This event is emitted when Signer of the account's validation changes.
/// @param account The account whose validation Signer changed.
/// @param entityId The entityId for the account and the signer.
/// @param previousSigner The address of the previous signer.
/// @param newSigner The address of the new signer.
/// @param previousSigner The address of the previous signer.
event SignerTransferred(
address indexed account, uint32 indexed entityId, address previousSigner, address newSigner
);
address indexed account, uint32 indexed entityId, address indexed newSigner, address indexed previousSigner
) anonymous;

error NotAuthorized();

Expand Down
7 changes: 2 additions & 5 deletions src/modules/validation/SingleSignerValidation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ contract SingleSignerValidation is ISingleSignerValidation, BaseModule {
/// @inheritdoc IValidation
/// @dev The signature is valid if it is signed by the owner's private key
/// (if the owner is an EOA) or if it is a valid ERC-1271 signature from the
/// owner (if the owner is a contract). Note that unlike the signature
/// validation used in `validateUserOp`, this does///*not** wrap the digest in
/// an "Ethereum Signed Message" envelope before checking the signature in
/// the EOA-owner case.
/// owner (if the owner is a contract). Note that the signature is wrapped in an EIP-191 message
function validateSignature(address account, uint32 entityId, address, bytes32 digest, bytes calldata signature)
external
view
Expand Down Expand Up @@ -130,6 +127,6 @@ contract SingleSignerValidation is ISingleSignerValidation, BaseModule {
function _transferSigner(uint32 entityId, address newSigner) internal {
address previousSigner = signers[entityId][msg.sender];
signers[entityId][msg.sender] = newSigner;
emit SignerTransferred(msg.sender, entityId, previousSigner, newSigner);
emit SignerTransferred(msg.sender, entityId, newSigner, previousSigner);
}
}
6 changes: 6 additions & 0 deletions test/module/SingleSignerValidation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ contract SingleSignerValidationTest is AccountTestBase {

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

event SignerTransferred(
address indexed account, uint32 indexed entityId, address indexed newSigner, address indexed previousSigner
) anonymous;

function setUp() public {
ethRecipient = makeAddr("ethRecipient");
(owner2, owner2Key) = makeAddrAndKey("owner2");
Expand Down Expand Up @@ -82,6 +86,8 @@ contract SingleSignerValidationTest is AccountTestBase {
uint32 newEntityId = TEST_DEFAULT_VALIDATION_ENTITY_ID + 1;
vm.prank(address(entryPoint));

vm.expectEmit(address(singleSignerValidation));
emit SignerTransferred(address(account), newEntityId, owner2, address(0));
vm.expectEmit(true, true, true, true);
emit ValidationInstalled(address(singleSignerValidation), newEntityId);
account.installValidation(
Expand Down

0 comments on commit 1413909

Please sign in to comment.