Skip to content

Commit

Permalink
put events in the interface
Browse files Browse the repository at this point in the history
  • Loading branch information
girazoki committed Jan 23, 2025
1 parent b30eb75 commit afd9679
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 0 additions & 3 deletions overridden_contracts/src/Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ contract Gateway is IOGateway, IInitializable, IUpgradable {
using Address for address;
using SafeNativeTransfer for address payable;

event UnableToProcessIndividualSlash(IOGateway.Slash slash);
event UnableToProcessSlashMessage();

address public immutable AGENT_EXECUTOR;

// Verification state
Expand Down
6 changes: 6 additions & 0 deletions overridden_contracts/src/interfaces/IOGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ interface IOGateway is IGateway {
// Emitted when the middleware contract address is changed by the owner.
event MiddlewareChanged(address indexed previousMiddleware, address indexed newMiddleware);

// Emitted when the middleware fails to apply an individual slash
event UnableToProcessIndividualSlash(IOGateway.Slash slash);

// Emitted when the middleware fails to apply the slash message
event UnableToProcessSlashMessage();

// Slash struct, used to decode slashes, which are identified by
// operatorKey to be slashed
// slashFraction to be applied as parts per billion
Expand Down
6 changes: 3 additions & 3 deletions overridden_contracts/test/Gateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ contract GatewayTest is Test {
(Command command, bytes memory params) = makeReportSlashesCommand();

vm.expectEmit(true, true, true, true);
emit Gateway.UnableToProcessSlashMessage();
emit IOGateway.UnableToProcessSlashMessage();
// Expect the gateway to emit `InboundMessageDispatched`
vm.expectEmit(true, false, false, false);
emit IGateway.InboundMessageDispatched(assetHubParaID.into(), 1, messageID, true);
Expand All @@ -1050,7 +1050,7 @@ contract GatewayTest is Test {

// Expect the gateway to emit `InboundMessageDispatched`
vm.expectEmit(true, true, true, true);
emit Gateway.UnableToProcessSlashMessage();
emit IOGateway.UnableToProcessSlashMessage();
vm.expectEmit(true, false, false, false);
emit IGateway.InboundMessageDispatched(assetHubParaID.into(), 1, messageID, true);

Expand All @@ -1076,7 +1076,7 @@ contract GatewayTest is Test {
IOGateway.Slash({operatorKey: bytes32(uint256(1)), slashFraction: 500_000, timestamp: 1});

vm.expectEmit(true, true, true, true);
emit Gateway.UnableToProcessIndividualSlash(expectedSlash);
emit IOGateway.UnableToProcessIndividualSlash(expectedSlash);
vm.expectEmit(true, false, false, false);
emit IGateway.InboundMessageDispatched(assetHubParaID.into(), 1, messageID, true);

Expand Down

0 comments on commit afd9679

Please sign in to comment.