Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ forge install openvm-org/openvm-solidity-sdk
If you are using a deployed instance of the verifier contract, then you can import the interfaces in your contract directly.

```solidity
import { IOpenVmHalo2Verifier } from "openvm-solidity-sdk/v1.1/interfaces/IOpenVmHalo2Verifier.sol";
import { IOpenVmHalo2Verifier } from "openvm-solidity-sdk/v1.2/interfaces/IOpenVmHalo2Verifier.sol";

contract MyContract {
function myFunction() public view {
Expand All @@ -34,7 +34,7 @@ contract MyContract {
If you want to deploy your own instance of the verifier contract, you can use `forge create`:

```bash
forge create src/v1.1/OpenVmHalo2Verifier.sol:OpenVmHalo2Verifier --rpc-url $RPC --private-key $PRIVATE_KEY --broadcast
forge create src/v1.2/OpenVmHalo2Verifier.sol:OpenVmHalo2Verifier --rpc-url $RPC --private-key $PRIVATE_KEY --broadcast
```

If you want to import the verifier contract into your own repository for testing purposes, note that it is locked to Solidity version `0.8.19`. If your project uses a different version, the import may not compile. As a workaround, you can compile the contract separately and use `vm.etch()` to inject the raw bytecode into your tests.
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ optimizer = true
optimizer_runs = 100000
evm_version = "paris"
show_progress = true
fs_permissions = [{ access = "read", path = "./test/v1.1/evm.proof"}]
fs_permissions = [{ access = "read", path = "./test/v1.2/evm.proof"}]

[profile.default.optimizer_details]
constantOptimizer = false
Expand Down
14 changes: 7 additions & 7 deletions src/v1.1/Halo2Verifier.sol → src/v1.2/Halo2Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract Halo2Verifier {
mstore(0x600, mod(calldataload(0x560), f_q))
mstore(0x620, mod(calldataload(0x580), f_q))
mstore(0x640, mod(calldataload(0x5a0), f_q))
mstore(0x80, 19438946737798499885558692066632745375001658993335175299244276035086184769592)
mstore(0x80, 9514323097321245931419041477139106601771148851610395955023397192525359125626)

{
let x := calldataload(0x5c0)
Expand Down Expand Up @@ -1864,8 +1864,8 @@ contract Halo2Verifier {
mstore(0x54e0, mload(0x5440))
mstore(0x5500, mload(0x5460))
success := and(eq(staticcall(gas(), 0x6, 0x54a0, 0x80, 0x54a0, 0x40), 1), success)
mstore(0x5520, 0x1701d83c9ad410f3d61886c39b7b8a618f42219a1404264208f838c1672b8e71)
mstore(0x5540, 0x0868e69339d5d3bbd747b6e7772a9760a7277c0993a420c2848808b15de0424c)
mstore(0x5520, 0x215365efc7b867c1204aab35fb060db538521b93b08872e3a9700c7ee4a285c2)
mstore(0x5540, 0x26da76077e618e9351d4e53058afcb50f9ecb808ef537ffed4c95f1e964a8c58)
mstore(0x5560, mload(0x4ee0))
success := and(eq(staticcall(gas(), 0x7, 0x5520, 0x60, 0x5520, 0x40), 1), success)
mstore(0x5580, mload(0x54a0))
Expand Down Expand Up @@ -1900,17 +1900,17 @@ contract Halo2Verifier {
mstore(0x5860, mload(0x57c0))
mstore(0x5880, mload(0x57e0))
success := and(eq(staticcall(gas(), 0x6, 0x5820, 0x80, 0x5820, 0x40), 1), success)
mstore(0x58a0, 0x26eaa658ef237183330c716cf9d5d978d8618788db2551142e1a9af837ecc810)
mstore(0x58c0, 0x1fa793c6b0f3df4a8a1017daa531a45fdfa8b5da433308f71716565f8b85aa7d)
mstore(0x58a0, 0x1e9efbe537998d8260c28c8e2ca8d83118f378f1e83daed033c2ae772806280a)
mstore(0x58c0, 0x15e04128b5f6b9bb6c758886eda92c27e8414c25809bd547e4987c332c38a430)
mstore(0x58e0, mload(0x4f60))
success := and(eq(staticcall(gas(), 0x7, 0x58a0, 0x60, 0x58a0, 0x40), 1), success)
mstore(0x5900, mload(0x5820))
mstore(0x5920, mload(0x5840))
mstore(0x5940, mload(0x58a0))
mstore(0x5960, mload(0x58c0))
success := and(eq(staticcall(gas(), 0x6, 0x5900, 0x80, 0x5900, 0x40), 1), success)
mstore(0x5980, 0x186694283d847cec7609ca9b642f46fc751a61e3ac330841cdf6a938a3439c02)
mstore(0x59a0, 0x16eb0141342ab5f9ca76fcaef38c222f51dd1afd5d45943e3676ba0c2ceb4f6d)
mstore(0x5980, 0x2db56ede49a6f38ee215d1fa9557ac54cb085bbb6170e9a2cda8db3c996c496e)
mstore(0x59a0, 0x017bd7af014917e84cda777f32c3b586cf6de90f0d649cbbce320ee837513cb8)
mstore(0x59c0, mload(0x4f80))
success := and(eq(staticcall(gas(), 0x7, 0x5980, 0x60, 0x5980, 0x40), 1), success)
mstore(0x59e0, mload(0x5900))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract OpenVmHalo2Verifier is Halo2Verifier, IOpenVmHalo2Verifier {
uint256 private constant FULL_PROOF_LENGTH = (12 + 2 + PUBLIC_VALUES_LENGTH + 43) * 32;

/// @dev The version of OpenVM that generated this verifier.
string public constant OPENVM_VERSION = "1.1";
string public constant OPENVM_VERSION = "1.2";

/// @notice A wrapper that constructs the proof into the right format for
/// use with the `snark-verifier` verification.
Expand Down
9 changes: 0 additions & 9 deletions test/v1.1/evm.proof

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import { OpenVmHalo2Verifier } from "../../src/v1.1/OpenVmHalo2Verifier.sol";
import { OpenVmHalo2Verifier } from "../../src/v1.2/OpenVmHalo2Verifier.sol";
import { LibString } from "../helpers/LibString.sol";
import { Test, console2, safeconsole as console } from "forge-std/Test.sol";

Expand All @@ -26,7 +26,7 @@ contract OpenVmHalo2VerifierTest is Test {
}

function test_ValidProofVerifies() public view {
string memory evmProofJson = vm.readFile("test/v1.1/evm.proof");
string memory evmProofJson = vm.readFile("test/v1.2/evm.proof");
bytes32 _appExeCommit = vm.parseJsonBytes32(evmProofJson, ".app_exe_commit");
bytes32 _appVmCommit = vm.parseJsonBytes32(evmProofJson, ".app_vm_commit");
bytes memory _guestPvs = vm.parseJsonBytes(evmProofJson, ".user_public_values");
Expand Down
1 change: 1 addition & 0 deletions test/v1.2/evm.proof
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"app_exe_commit":"00303f848c4546ece61a1ad1732770e1c911aec4bdaa779b4a9ad97de58486ba","app_vm_commit":"0094295cb5d90deb2b28cab4d658dab0fdc2922c4e9c10305bbf277c8d29d881","user_public_values":"0000000000000000000000000000000000000000000000000000000000000000","proof_data":{"accumulator":"000000000000000000000000000000000000000000bace448d15c3d57cfde38f000000000000000000000000000000000000000000e0e60db460628acceff898000000000000000000000000000000000000000000000fef15e56ea1ee4bffa90000000000000000000000000000000000000000003aee52481ab88ccaad52ff000000000000000000000000000000000000000000eea3b94f90da101abb0840000000000000000000000000000000000000000000000c38014bffd629d87be4000000000000000000000000000000000000000000f258d435d75354789c52fc00000000000000000000000000000000000000000006eb3be0e6835e307ce786000000000000000000000000000000000000000000001f17bf0331fb267100470000000000000000000000000000000000000000009fe040d775be0ee16489d50000000000000000000000000000000000000000008e92d6ebb9ab4de44f348b000000000000000000000000000000000000000000000ba7d28a04279118c715","proof":"08720ceceda3f128e4f36b532e8cd079d983b2187f799f59ae0f85310a166cca1e48ee4302b5dc467e5f45e53ea6b4a55ea49e31a48a6b1c35569136c647fc3a0560baae1a0ee7e22da623b2d59d60e771f979a7391d9ecd067038be494bee192e024aa8c6b7225ae82085631646dcdc2113d29f68faa9e60520e2c657d4c2e30aad07f8ff521251bf3c8f06c202a921677b159d67413e131b56153172dba78c02fb2273e1768d493dd1305ee99825c7bdeddd09de12fec017ef6f32e36ddfcc1433b2fb12476ed619835eb72e077a2269b83d67f63ad29cf74c10a8effaa149174381ee94dd7db972bb2f3a450d99254f66636341f88b5aec7bed766514b2fb03299b121ce5f18538abf996341cb2f7df67f3b32e10e37f8aa001d41aa7624824a46b1e3d0dab848c6a40bbdd9bc84ac2e46432239f3957d530154a784989bd273eff04ec82a0614c523b292de864614ad989f2ae367625136892347a275c7223f69716f69239a9bb557f7d293b7f5fee4a1947a7520dee06847bb47b352df81e1ee7051717e1dc8e7aacfe4fd375b10623c92e4e23fd661eb3810dda4c5f3607dfed58d34c5974ee275adce6f7f4f65a399793e5ad182edf35e012bfa6ebf027ad4b5d2d069be618a63d6ac6b06990e7001f9807d2e237d2abd53bde8087bc02e4c101abedb7d29aec59b7299e81a8be059c0de02147a7387ddb249d6152722a6237d5bd04b82339ce4ade9a822413ac26eecfa709f5a61afad9723ada1d3e14364726d0fb69acfdd058eb487603311c9caf07ea782936786bab5e80944c4f02064f0476a88a6b0a91d5567100b7302ffd621695c6b7a89013fa929dba576005d84ffe3d8fac002341b7068a985bd50cf16ac42fa8834778509e3ba922b45c093c118ca684b339d47100421719574f7176f8d5635f7eec99b78ef5fdfa67fb1446d962e5c1183ba0a72e3e6bd783601e1b88dcf568ee3e0830a32a89c0fb522126c734128bf25743c4895a7929c15b29e02d9c5f2ecb345c41ba473db61ac5214fbf9f9de01888a1925e4e3895036bce363a9a26878e67b57e488b2d3382a00b4d6e467c6ee4dd963c1f179ab77323fa8eb7696d51d1991f8ead501af505a41df94716a54ade54f918d8efd0b7ae0f22f996e9641f4c0f7762ca464591ed811e4e2b0d57f92e889755d6261809798a87de86e74184205949c7c333d6a7de5319acdc149019c11f9da0e00efd0bbdfc889f3440c65e56a0e49a3510d708b35e211b62fdad2a77807b18dc3d987d1649ef5741d94cec17bd72b19106d092637c141046b0012a026f0efabca1db9a1e68c47cc9c4df629fc5392329f196ae211c27dbc468121edd5f5abf09eec244492e0718fff030f706cab7b36abcf54f63a22f8910c67f2b2e99ee87dc5c91385a73898f73f791aa429ba7a0efc2d3e4d24727ccc35f51e57a5be03be2b473dce3acf851efd1f34c22f86c52d7f8879e1d100bdeacde026aa99e0972d3fd2cb8fec7c6c29ac7b4850d0d2affd800b76aa17e05ab42d72d8dcc719ade24e481cd5ed98ab5e7d3914db9d8a6bd6edf5edcaeb20687c332b58b1577c0a72baaa430cf436dcec2ac515247a6503983c1aab219581a8103d3ebd9f6de1400b5450d97325ac03653fdbed7c89d2906ba9d5f2cf57c2875397de3d9ca0205603044bf9e92cec4a1f1d8a71d6e30a3c03d654cef696224428bc64e46a73bc8aeaea2a58f170503b4754d686d1a2572ba4949cc66b5de2d667186e12a438df1ff2ae6aaa16b3abd5566fe9c252af8af9b6505b3066b7a100f0d3123e9fe7c23abb54b8aec856a857185b1c2eb4a0b1c7f48fd359a009c209a96d625d401ae8607a6ea3a172d6707432d544bfad528a79c49f3e9fdd086131e2e6da0aa3febf0d782f4ec410c889287a008ad0d4932f60199becb396db7"}}