File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -383,6 +383,27 @@ contract ISMVerificationTest is Test {
383383 ismVerification.verifyISM (testMessages, ismData);
384384 }
385385
386+ function test_verifyISM_revertsWithInvalidSignatureOrder () public {
387+ bytes32 messageHash = keccak256 (abi.encode (testMessages));
388+
389+ // Create signatures in wrong order by deliberately choosing validators with descending addresses
390+ address higherValidator = validator1 > validator2 ? validator1 : validator2;
391+ address lowerValidator = validator1 > validator2 ? validator2 : validator1;
392+ uint256 higherKey = validator1 > validator2 ? VALIDATOR1_KEY : VALIDATOR2_KEY;
393+ uint256 lowerKey = validator1 > validator2 ? VALIDATOR2_KEY : VALIDATOR1_KEY;
394+
395+ // Create signatures with higher address first (descending order)
396+ bytes memory signatures = abi.encodePacked (
397+ _createSignature (messageHash, higherKey),
398+ _createSignature (messageHash, lowerKey)
399+ );
400+
401+ bytes memory ismData = abi.encode (signatures);
402+
403+ vm.expectRevert (ISMVerification.InvalidSignatureOrder.selector );
404+ ismVerification.verifyISM (testMessages, ismData);
405+ }
406+
386407 //////////////////////////////////////////////////////////////
387408 /// Helper Functions ///
388409 //////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments