@@ -70,60 +70,53 @@ contract CrossModuleTest is Test {
7070 mod = new TestableCrossModule (IIBCHandler (address (handler)));
7171 }
7272
73- function test_Constructor_GrantsIbcRoleToHandler () public {
73+ function test_constructor_GrantsIbcRoleToHandler () public {
7474 assertTrue (mod.hasRole (mod.IBC_ROLE (), address (handler)));
7575 }
7676
77- function test_SupportsInterface_IIBC_IAccessControl_And_Unsupported () public view {
77+ function test_supportsInterface_ReturnsTrueForIIBCAndIAccessControlAndFalseForUnsupported () public view {
7878 assertTrue (mod.supportsInterface (type (IIBCModule).interfaceId));
7979 assertTrue (mod.supportsInterface (type (IIBCModuleInitializer).interfaceId));
8080 assertTrue (mod.supportsInterface (type (IAccessControl).interfaceId));
8181 assertFalse (mod.supportsInterface (0xDEADBEEF ));
8282 }
8383
84- function test_onRecvPacket_Reverts_WithoutIbcRole () public {
85- vm.expectRevert ();
86- mod.onRecvPacket (_emptyPacket, address (0 ));
87- }
88-
89- function test_onRecvPacket_CallsHandlerAndReturnsAck_WhenCallerHasRole () public {
84+ function test_onRecvPacket_CallsHandlerAndReturnsAckWhenCallerHasRole () public {
9085 vm.prank (address (handler));
9186 bytes memory ack = mod.onRecvPacket (_emptyPacket, address (0 ));
9287 assertEq (ack, bytes ("ack-ok " ));
9388 assertEq (mod.recvCount (), 1 );
9489 }
9590
96- function test_onAcknowledgementPacket_Reverts_WithoutIbcRole () public {
91+ function test_onRecvPacket_RevertWhen_CallerLacksIbcRole () public {
9792 vm.expectRevert ();
98- mod.onAcknowledgementPacket (_emptyPacket, bytes ( " ack " ) , address (0 ));
93+ mod.onRecvPacket (_emptyPacket, address (0 ));
9994 }
10095
101- function test_onAcknowledgementPacket_CallsHandler_WhenCallerHasRole () public {
96+ function test_onAcknowledgementPacket_CallsHandlerWhenCallerHasRole () public {
10297 vm.prank (address (handler));
10398 mod.onAcknowledgementPacket (_emptyPacket, bytes ("ack123 " ), address (0 ));
10499 assertEq (mod.ackCount (), 1 );
105100 assertEq (mod.lastAckArg (), bytes ("ack123 " ));
106101 }
107102
108- function test_onTimeoutPacket_Reverts_WithoutIbcRole () public {
103+ function test_onAcknowledgementPacket_RevertWhen_CallerLacksIbcRole () public {
109104 vm.expectRevert ();
110- mod.onTimeoutPacket (_emptyPacket, address (0 ));
105+ mod.onAcknowledgementPacket (_emptyPacket, bytes ( " ack " ) , address (0 ));
111106 }
112107
113- function test_onTimeoutPacket_CallsHandler_WhenCallerHasRole () public {
108+ function test_onTimeoutPacket_CallsHandlerWhenCallerHasRole () public {
114109 vm.prank (address (handler));
115110 mod.onTimeoutPacket (_emptyPacket, address (0 ));
116111 assertEq (mod.timeoutCount (), 1 );
117112 }
118113
119- function test_onChanOpenInit_Reverts_WithoutIbcRole () public {
120- IIBCModuleInitializer.MsgOnChanOpenInit memory m;
121- m.version = "v1 " ;
114+ function test_onTimeoutPacket_RevertWhen_CallerLacksIbcRole () public {
122115 vm.expectRevert ();
123- mod.onChanOpenInit (m );
116+ mod.onTimeoutPacket (_emptyPacket, address ( 0 ) );
124117 }
125118
126- function test_onChanOpenInit_ReturnsSelfAndVersion_WhenCallerHasRole () public {
119+ function test_onChanOpenInit_ReturnsSelfAndVersionWhenCallerHasRole () public {
127120 IIBCModuleInitializer.MsgOnChanOpenInit memory m;
128121 m.version = "v1 " ;
129122 vm.prank (address (handler));
@@ -132,14 +125,14 @@ contract CrossModuleTest is Test {
132125 assertEq (version, "v1 " );
133126 }
134127
135- function test_onChanOpenTry_Reverts_WithoutIbcRole () public {
136- IIBCModuleInitializer.MsgOnChanOpenTry memory m;
137- m.counterpartyVersion = "cp- v1 " ;
128+ function test_onChanOpenInit_RevertWhen_CallerLacksIbcRole () public {
129+ IIBCModuleInitializer.MsgOnChanOpenInit memory m;
130+ m.version = "v1 " ;
138131 vm.expectRevert ();
139- mod.onChanOpenTry (m);
132+ mod.onChanOpenInit (m);
140133 }
141134
142- function test_onChanOpenTry_ReturnsSelfAndCounterpartyVersion_WhenCallerHasRole () public {
135+ function test_onChanOpenTry_ReturnsSelfAndCounterpartyVersionWhenCallerHasRole () public {
143136 IIBCModuleInitializer.MsgOnChanOpenTry memory m;
144137 m.counterpartyVersion = "cp-v1 " ;
145138 vm.prank (address (handler));
@@ -148,51 +141,58 @@ contract CrossModuleTest is Test {
148141 assertEq (version, "cp-v1 " );
149142 }
150143
151- function test_onChanOpenAck_Reverts_WithoutIbcRole () public {
152- IIBCModule.MsgOnChanOpenAck memory m;
144+ function test_onChanOpenTry_RevertWhen_CallerLacksIbcRole () public {
145+ IIBCModuleInitializer.MsgOnChanOpenTry memory m;
146+ m.counterpartyVersion = "cp-v1 " ;
153147 vm.expectRevert ();
154- mod.onChanOpenAck (m);
148+ mod.onChanOpenTry (m);
155149 }
156150
157- function test_onChanOpenAck_Succeeds_WhenCallerHasRole () public {
151+ function test_onChanOpenAck_SucceedsWhenCallerHasRole () public {
158152 IIBCModule.MsgOnChanOpenAck memory m;
159153 vm.prank (address (handler));
160154 mod.onChanOpenAck (m); // no revert
161155 }
162156
163- function test_onChanOpenConfirm_Reverts_WithoutIbcRole () public {
164- IIBCModule.MsgOnChanOpenConfirm memory m;
157+ function test_onChanOpenAck_RevertWhen_CallerLacksIbcRole () public {
158+ IIBCModule.MsgOnChanOpenAck memory m;
165159 vm.expectRevert ();
166- mod.onChanOpenConfirm (m);
160+ mod.onChanOpenAck (m);
167161 }
168162
169- function test_onChanOpenConfirm_Succeeds_WhenCallerHasRole () public {
163+ function test_onChanOpenConfirm_SucceedsWhenCallerHasRole () public {
170164 IIBCModule.MsgOnChanOpenConfirm memory m;
171165 vm.prank (address (handler));
172166 mod.onChanOpenConfirm (m); // no revert
173167 }
174168
175- function test_onChanCloseInit_Reverts_WithoutIbcRole () public {
176- IIBCModule.MsgOnChanCloseInit memory m;
169+ function test_onChanOpenConfirm_RevertWhen_CallerLacksIbcRole () public {
170+ IIBCModule.MsgOnChanOpenConfirm memory m;
177171 vm.expectRevert ();
178- mod.onChanCloseInit (m);
172+ mod.onChanOpenConfirm (m);
179173 }
180174
181- function test_onChanCloseInit_Succeeds_WhenCallerHasRole () public {
175+ function test_onChanCloseInit_SucceedsWhenCallerHasRole () public {
182176 IIBCModule.MsgOnChanCloseInit memory m;
183177 vm.prank (address (handler));
184178 mod.onChanCloseInit (m); // no revert
185179 }
186180
187- function test_onChanCloseConfirm_Reverts_WithoutIbcRole () public {
188- IIBCModule.MsgOnChanCloseConfirm memory m;
181+ function test_onChanCloseInit_RevertWhen_CallerLacksIbcRole () public {
182+ IIBCModule.MsgOnChanCloseInit memory m;
189183 vm.expectRevert ();
190- mod.onChanCloseConfirm (m);
184+ mod.onChanCloseInit (m);
191185 }
192186
193- function test_onChanCloseConfirm_Succeeds_WhenCallerHasRole () public {
187+ function test_onChanCloseConfirm_SucceedsWhenCallerHasRole () public {
194188 IIBCModule.MsgOnChanCloseConfirm memory m;
195189 vm.prank (address (handler));
196190 mod.onChanCloseConfirm (m); // no revert
197191 }
192+
193+ function test_onChanCloseConfirm_RevertWhen_CallerLacksIbcRole () public {
194+ IIBCModule.MsgOnChanCloseConfirm memory m;
195+ vm.expectRevert ();
196+ mod.onChanCloseConfirm (m);
197+ }
198198}
0 commit comments