@@ -7,8 +7,7 @@ import { Test, console2, safeconsole as console } from "forge-std/Test.sol";
77contract OpenVmHalo2VerifierTest is Test , OpenVmHalo2Verifier {
88 bytes partialProof;
99 bytes32 appExeCommit = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ;
10- bytes32 leafExeCommit = 0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE ;
11- bytes32 guestPvsHash = 0xDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD ;
10+ bytes32 guestPvsHash = 0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE ;
1211
1312 uint256 private constant FULL_PROOF_WORDS = (12 + 2 + 32 + 43 );
1413
@@ -24,22 +23,16 @@ contract OpenVmHalo2VerifierTest is Test, OpenVmHalo2Verifier {
2423 }
2524
2625 function test_verifyProof () public view {
27- this .verifyProof (abi.encodePacked (guestPvsHash), partialProof, appExeCommit, leafExeCommit );
26+ this .verify (abi.encodePacked (guestPvsHash), partialProof, appExeCommit);
2827 }
2928
3029 function test_proofFormat () public view {
31- this .constructAndCheckProof (abi.encodePacked (guestPvsHash), partialProof, appExeCommit, leafExeCommit );
30+ this .constructAndCheckProof (abi.encodePacked (guestPvsHash), partialProof, appExeCommit);
3231 }
3332
34- function testFuzz_proofFormat (
35- uint256 partialProofSeed ,
36- bytes32 _guestPvsHash ,
37- bytes32 _appExeCommit ,
38- bytes32 _leafExeCommit
39- ) public {
33+ function testFuzz_proofFormat (uint256 partialProofSeed , bytes32 _guestPvsHash , bytes32 _appExeCommit ) public {
4034 vm.assume (_guestPvsHash != bytes32 (0 ));
4135 vm.assume (_appExeCommit != bytes32 (0 ));
42- vm.assume (_leafExeCommit != bytes32 (0 ));
4336
4437 bytes memory _partialProof = new bytes (55 * 32 );
4538 for (uint256 i = 0 ; i < 55 * 32 ; ++ i) {
@@ -50,18 +43,15 @@ contract OpenVmHalo2VerifierTest is Test, OpenVmHalo2Verifier {
5043 partialProof = _partialProof;
5144 guestPvsHash = _guestPvsHash;
5245 appExeCommit = _appExeCommit;
53- leafExeCommit = _leafExeCommit;
5446
5547 test_proofFormat ();
5648 }
5749
58- function constructAndCheckProof (
59- bytes calldata _guestPvs ,
60- bytes calldata _partialProof ,
61- bytes32 _appExeCommit ,
62- bytes32 _leafExeCommit
63- ) external view {
64- MemoryPointer proofPtr = _constructProof (_guestPvs, _partialProof, _appExeCommit, _leafExeCommit);
50+ function constructAndCheckProof (bytes calldata _guestPvs , bytes calldata _partialProof , bytes32 _appExeCommit )
51+ external
52+ view
53+ {
54+ MemoryPointer proofPtr = _constructProof (_guestPvs, _partialProof, _appExeCommit);
6555
6656 // _constructProof will return a pointer to memory that will hold the
6757 // proof data in a block of size FULL_PROOF_LENGTH. However, this won't
@@ -112,7 +102,7 @@ contract OpenVmHalo2VerifierTest is Test, OpenVmHalo2Verifier {
112102 bytes memory _leafExeCommit = proof[0x1a0 :0x1c0 ];
113103
114104 require (bytes32 (_appExeCommit) == appExeCommit, "App exe commit mismatch " );
115- require (bytes32 (_leafExeCommit) == leafExeCommit , "Leaf exe commit mismatch " );
105+ require (bytes32 (_leafExeCommit) == LEAF_EXE_COMMIT , "Leaf exe commit mismatch " );
116106
117107 bytes32 guestPvsHashExpected = guestPvsHash;
118108 bytes calldata _guestPvsHash = proof[0x1c0 :0x5c0 ];
@@ -125,11 +115,11 @@ contract OpenVmHalo2VerifierTest is Test, OpenVmHalo2Verifier {
125115
126116 function test_RevertWhen_InvalidPartialProofLength () public {
127117 vm.expectRevert (abi.encodeWithSelector (OpenVmHalo2Verifier.InvalidPartialProofLength.selector ));
128- this .verifyProof (abi.encodePacked (guestPvsHash), hex "aa " , appExeCommit, leafExeCommit );
118+ this .verify (abi.encodePacked (guestPvsHash), hex "aa " , appExeCommit);
129119 }
130120
131121 function test_RevertWhen_InvalidGuestPvsLength () public {
132122 vm.expectRevert (abi.encodeWithSelector (OpenVmHalo2Verifier.InvalidGuestPvsLength.selector ));
133- this .verifyProof (partialProof, hex "aa " , appExeCommit, leafExeCommit );
123+ this .verify (partialProof, hex "aa " , appExeCommit);
134124 }
135125}
0 commit comments