@@ -31,6 +31,7 @@ contract OpenVmHalo2Verifier is Halo2Verifier, IOpenVmHalo2Verifier {
3131 bytes32 public constant LEAF_EXE_COMMIT =
3232 bytes32 (0x0071628bff0dcb64201f77ff5c7d869c7073b842e3dadf9e618e8673ef671bfd );
3333
34+ /// @dev The version of OpenVM that generated the proof.
3435 string public constant OPENVM_VERSION = "v1.0.0 " ;
3536
3637 /// @notice A wrapper that constructs the proof into the right format for
@@ -73,22 +74,25 @@ contract OpenVmHalo2Verifier is Halo2Verifier, IOpenVmHalo2Verifier {
7374 }
7475 }
7576
77+ /// @dev The assembly code should perform the same function as the following
78+ /// solidity code:
79+ //
80+ /// ```solidity
81+ /// bytes memory proof =
82+ /// abi.encodePacked(partialProof[0:0x180], appExeCommit, leafExeCommit, guestPvsPayload, partialProof[0x180:]);
83+ /// ```
84+ //
85+ /// where `guestPvsPayload` is a memory payload with each byte in
86+ /// `guestPvs` separated into its own `bytes32` word.
87+ ///
88+ /// This function does not clean the memory it allocates. Since it is the only
89+ /// memory allocation that occurs in the call frame, we know that the memory
90+ /// was not written to before.
7691 function _constructProof (bytes calldata guestPvs , bytes calldata partialProof , bytes32 appExeCommit )
7792 internal
7893 pure
7994 returns (MemoryPointer proofPtr )
8095 {
81- // The assembly code should perform the same function as the following
82- // solidity code:
83- //
84- // ```solidity
85- // bytes memory proof =
86- // abi.encodePacked(partialProof[0:0x180], appExeCommit, leafExeCommit, guestPvsPayload, partialProof[0x180:]);
87- // ```
88- //
89- // where `guestPvsPayload` is a memory payload with each byte in
90- // `guestPvs` separated into its own `bytes32` word.
91-
9296 uint256 fullProofLength = FULL_PROOF_LENGTH;
9397 bytes32 leafExeCommit = LEAF_EXE_COMMIT;
9498
@@ -103,9 +107,7 @@ contract OpenVmHalo2Verifier is Halo2Verifier, IOpenVmHalo2Verifier {
103107 /// @solidity memory-safe-assembly
104108 assembly {
105109 proofPtr := mload (0x40 )
106- // Allocate the memory as a safety measure. We know that this is the
107- // only memory allocation that occurs in the call frame, so we don't
108- // need to clean the allocated memory.
110+ // Allocate the memory as a safety measure.
109111 mstore (0x40 , add (proofPtr, fullProofLength))
110112
111113 // Copy the KZG accumulators (length 0x180) into the beginning of
0 commit comments