@@ -376,6 +376,43 @@ contract LCPClientZKDCAPTest is BasicTest {
376376 lc.zkDCAPRegisterEnclaveKey (clientId, msgData);
377377 }
378378
379+ function testRegisterEnclaveKeyInvalidRisc0Header () public {
380+ string memory clientId = "lcp-zkdcap " ;
381+ TestLCPClientZKDCAPExtended lc = new TestLCPClientZKDCAPExtended (
382+ address (this ), false , ZKDCAPTestHelper.dummyIntelRootCACert (), address (new NopRiscZeroVerifier ())
383+ );
384+ {
385+ IbcLightclientsLcpV1ClientState.Data memory clientState = defaultClientState ();
386+ clientState.zkdcap_verifier_infos[0 ][0 ] = 0x00 ;
387+ bytes memory clientStateBytes = LCPProtoMarshaler.marshal (clientState);
388+ bytes memory consensusStateBytes = LCPProtoMarshaler.marshal (defaultConsensusState ());
389+ vm.expectRevert (
390+ abi.encodeWithSelector (ILCPClientErrors.LCPClientZKDCAPInvalidVerifierInfoRisc0Header.selector )
391+ );
392+ lc.initializeClient (clientId, clientStateBytes, consensusStateBytes);
393+ }
394+ {
395+ IbcLightclientsLcpV1ClientState.Data memory clientState = defaultClientState ();
396+ clientState.zkdcap_verifier_infos[0 ][0 ] = 0x02 ;
397+ bytes memory clientStateBytes = LCPProtoMarshaler.marshal (clientState);
398+ bytes memory consensusStateBytes = LCPProtoMarshaler.marshal (defaultConsensusState ());
399+ vm.expectRevert (
400+ abi.encodeWithSelector (ILCPClientErrors.LCPClientZKDCAPInvalidVerifierInfoRisc0Header.selector )
401+ );
402+ lc.initializeClient (clientId, clientStateBytes, consensusStateBytes);
403+ }
404+ {
405+ IbcLightclientsLcpV1ClientState.Data memory clientState = defaultClientState ();
406+ clientState.zkdcap_verifier_infos[0 ][1 ] = 0x01 ;
407+ bytes memory clientStateBytes = LCPProtoMarshaler.marshal (clientState);
408+ bytes memory consensusStateBytes = LCPProtoMarshaler.marshal (defaultConsensusState ());
409+ vm.expectRevert (
410+ abi.encodeWithSelector (ILCPClientErrors.LCPClientZKDCAPInvalidVerifierInfoRisc0Header.selector )
411+ );
412+ lc.initializeClient (clientId, clientStateBytes, consensusStateBytes);
413+ }
414+ }
415+
379416 function testRegisterEnclaveKeyEnclaveDebugMismatch () public {
380417 string memory clientId = "lcp-zkdcap " ;
381418 // developmentMode=false but output.enclaveDebugEnabled is set to true
0 commit comments