@@ -12,6 +12,7 @@ contract SessionKeyRegistryTest is Test {
1212 bytes32 private constant PERMISSION1 = 0x1111111111111111111111111111111111111111111111111111111111111111 ;
1313 bytes32 private constant PERMISSION2 = 0x2222222222222222222222222222222222222222222222222222222222222222 ;
1414 bytes32 private constant PERMISSION3 = 0x3333333333333333333333333333333333333333333333333333333333333333 ;
15+ string constant ORIGIN = "SessionKeyRegistryTest " ;
1516
1617 uint256 private constant DAY_SECONDS = 1 days ;
1718
@@ -27,14 +28,18 @@ contract SessionKeyRegistryTest is Test {
2728 assertEq (registry.authorizationExpiry (address (this ), SIGNER_ONE, PERMISSION3), 0 );
2829
2930 uint256 expiry = block .timestamp + DAY_SECONDS;
30- registry.loginAndFund {value: 1 ether }(SIGNER_ONE, expiry, permissions);
31+ vm.expectEmit (true , false , false , true , address (registry));
32+ emit SessionKeyRegistry.AuthorizationsUpdated (address (this ), SIGNER_ONE, expiry, permissions, ORIGIN);
33+ registry.loginAndFund {value: 1 ether }(SIGNER_ONE, expiry, permissions, ORIGIN);
3134
3235 assertEq (SIGNER_ONE.balance, 1 ether);
3336 assertEq (registry.authorizationExpiry (address (this ), SIGNER_ONE, PERMISSION1), expiry);
3437 assertEq (registry.authorizationExpiry (address (this ), SIGNER_ONE, PERMISSION2), expiry);
3538 assertEq (registry.authorizationExpiry (address (this ), SIGNER_ONE, PERMISSION3), expiry);
3639
37- registry.revoke (SIGNER_ONE, permissions);
40+ vm.expectEmit (true , false , false , true , address (registry));
41+ emit SessionKeyRegistry.AuthorizationsUpdated (address (this ), SIGNER_ONE, 0 , permissions, ORIGIN);
42+ registry.revoke (SIGNER_ONE, permissions, ORIGIN);
3843 assertEq (registry.authorizationExpiry (address (this ), SIGNER_ONE, PERMISSION1), 0 );
3944 assertEq (registry.authorizationExpiry (address (this ), SIGNER_ONE, PERMISSION2), 0 );
4045 assertEq (registry.authorizationExpiry (address (this ), SIGNER_ONE, PERMISSION3), 0 );
@@ -51,13 +56,17 @@ contract SessionKeyRegistryTest is Test {
5156
5257 uint256 expiry = block .timestamp + 4 * DAY_SECONDS;
5358
54- registry.login (SIGNER_TWO, expiry, permissions);
59+ vm.expectEmit (true , false , false , true , address (registry));
60+ emit SessionKeyRegistry.AuthorizationsUpdated (address (this ), SIGNER_TWO, expiry, permissions, ORIGIN);
61+ registry.login (SIGNER_TWO, expiry, permissions, ORIGIN);
5562
5663 assertEq (registry.authorizationExpiry (address (this ), SIGNER_TWO, PERMISSION1), expiry);
5764 assertEq (registry.authorizationExpiry (address (this ), SIGNER_TWO, PERMISSION2), 0 );
5865 assertEq (registry.authorizationExpiry (address (this ), SIGNER_TWO, PERMISSION3), expiry);
5966
60- registry.revoke (SIGNER_TWO, permissions);
67+ vm.expectEmit (true , false , false , true , address (registry));
68+ emit SessionKeyRegistry.AuthorizationsUpdated (address (this ), SIGNER_TWO, 0 , permissions, ORIGIN);
69+ registry.revoke (SIGNER_TWO, permissions, ORIGIN);
6170 assertEq (registry.authorizationExpiry (address (this ), SIGNER_TWO, PERMISSION1), 0 );
6271 assertEq (registry.authorizationExpiry (address (this ), SIGNER_TWO, PERMISSION2), 0 );
6372 assertEq (registry.authorizationExpiry (address (this ), SIGNER_TWO, PERMISSION3), 0 );
0 commit comments