@@ -154,8 +154,7 @@ contract PectraTest is Test {
154154 sources[0 ] = new bytes (pectra.VALIDATOR_PUBKEY_LENGTH () - 1 );
155155 bytes memory target = validPubkey ();
156156 vm.expectEmit (true , true , true , true );
157- uint8 reasonCode = pectra.INVALID_PUBKEY_LENGTH ();
158- emit Pectra.ConsolidationFailed (reasonCode, sources[0 ], target);
157+ emit Pectra.ConsolidationFailed (Pectra.FailureReason.INVALID_PUBKEY_LENGTH, sources[0 ], target);
159158 vm.prank (address (pectra));
160159 pectra.batchConsolidation {value: 1 }(sources, target);
161160 }
@@ -168,8 +167,7 @@ contract PectraTest is Test {
168167 sources[0 ] = validPubkey ();
169168 bytes memory target = validPubkey ();
170169 vm.expectEmit (true , true , true , true );
171- uint8 reasonCode = pectra.OPERATION_FAILED ();
172- emit Pectra.ConsolidationFailed (reasonCode, sources[0 ], target);
170+ emit Pectra.ConsolidationFailed (Pectra.FailureReason.OPERATION_FAILED, sources[0 ], target);
173171 vm.prank (address (pectra));
174172 pectra.batchConsolidation {value: 1 }(sources, target);
175173 // Restore successful code.
@@ -232,8 +230,7 @@ contract PectraTest is Test {
232230 bytes [] memory pubkeys = new bytes [](1 );
233231 pubkeys[0 ] = new bytes (pectra.VALIDATOR_PUBKEY_LENGTH () - 1 ); // one byte less than required
234232 vm.expectEmit (true , true , true , true );
235- uint8 reasonCode = pectra.INVALID_PUBKEY_LENGTH ();
236- emit Pectra.SwitchFailed (reasonCode, pubkeys[0 ]);
233+ emit Pectra.SwitchFailed (Pectra.FailureReason.INVALID_PUBKEY_LENGTH, pubkeys[0 ]);
237234 vm.prank (address (pectra));
238235 pectra.batchSwitch {value: 1 }(pubkeys);
239236 }
@@ -243,8 +240,7 @@ contract PectraTest is Test {
243240 bytes [] memory pubkeys = new bytes [](1 );
244241 pubkeys[0 ] = validPubkey ();
245242 vm.expectEmit (true , true , true , true );
246- uint8 reasonCode = pectra.OPERATION_FAILED ();
247- emit Pectra.SwitchFailed (reasonCode, pubkeys[0 ]);
243+ emit Pectra.SwitchFailed (Pectra.FailureReason.OPERATION_FAILED, pubkeys[0 ]);
248244 vm.prank (address (pectra));
249245 pectra.batchSwitch {value: 1 }(pubkeys);
250246 vm.etch (consolidationTarget, feeCode);
@@ -310,8 +306,7 @@ contract PectraTest is Test {
310306 data[0 ].amount = 0 ;
311307 data[0 ].isFullExit = true ;
312308 vm.expectEmit (true , true , true , true );
313- uint8 reasonCode = pectra.INVALID_PUBKEY_LENGTH ();
314- emit Pectra.ExecutionLayerExitFailed (reasonCode, data[0 ].pubkey, abi.encodePacked (data[0 ].amount));
309+ emit Pectra.ExecutionLayerExitFailed (Pectra.FailureReason.INVALID_PUBKEY_LENGTH, data[0 ].pubkey, data[0 ].amount);
315310 vm.prank (address (pectra));
316311 pectra.batchELExit {value: 1 }(data);
317312 }
@@ -322,8 +317,9 @@ contract PectraTest is Test {
322317 data[0 ].amount = 0 ; // Zero amount
323318 data[0 ].isFullExit = false ; // Flag set to false
324319 vm.expectEmit (true , true , true , true );
325- uint8 reasonCode = pectra.FULL_EXIT_NOT_CONFIRMED ();
326- emit Pectra.ExecutionLayerExitFailed (reasonCode, data[0 ].pubkey, abi.encodePacked (data[0 ].amount));
320+ emit Pectra.ExecutionLayerExitFailed (
321+ Pectra.FailureReason.FULL_EXIT_NOT_CONFIRMED, data[0 ].pubkey, data[0 ].amount
322+ );
327323 vm.prank (address (pectra));
328324 pectra.batchELExit {value: 1 }(data);
329325 }
@@ -336,8 +332,9 @@ contract PectraTest is Test {
336332 data[0 ].isFullExit = true ; // Not needed but included for consistency
337333
338334 vm.expectEmit (true , true , true , true );
339- uint8 reasonCode = pectra.AMOUNT_EXCEEDS_MAXIMUM ();
340- emit Pectra.ExecutionLayerExitFailed (reasonCode, data[0 ].pubkey, abi.encodePacked (data[0 ].amount));
335+ emit Pectra.ExecutionLayerExitFailed (
336+ Pectra.FailureReason.AMOUNT_EXCEEDS_MAXIMUM, data[0 ].pubkey, data[0 ].amount
337+ );
341338
342339 vm.prank (address (pectra));
343340 pectra.batchELExit {value: 1 }(data);
@@ -350,8 +347,7 @@ contract PectraTest is Test {
350347 data[0 ].amount = 1000000000 ; // 1 ether in gwei
351348 data[0 ].isFullExit = true ; // Not needed but included for consistency
352349 vm.expectEmit (true , true , true , true );
353- uint8 reasonCode = pectra.OPERATION_FAILED ();
354- emit Pectra.ExecutionLayerExitFailed (reasonCode, data[0 ].pubkey, abi.encodePacked (data[0 ].amount));
350+ emit Pectra.ExecutionLayerExitFailed (Pectra.FailureReason.OPERATION_FAILED, data[0 ].pubkey, data[0 ].amount);
355351 vm.prank (address (pectra));
356352 pectra.batchELExit {value: 1 }(data);
357353 vm.etch (exitTarget, feeCode);
0 commit comments