Skip to content

Commit

Permalink
chore: Add VERIFIER_HASH value to the output of sphinx-proof program (#6
Browse files Browse the repository at this point in the history
)
  • Loading branch information
storojs72 authored Oct 16, 2024
1 parent f972956 commit 207d1dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This repository contains smart contracts required for on-chain verification of [
To install Solidity contracts in your Foundry project:

```
forge install argumentcomputer/sphinx-contracts --no-commit
forge install argumentcomputer/sphinx-contracts@main --no-commit
```

To install Move contracts, add following dependency to your Move.toml file:
Expand Down Expand Up @@ -36,6 +36,12 @@ RUST_LOG=info cargo run --package sphinx-proof --release

then copy-paste output to the relevant places in Move / Solidity tests.

You also need to update manually the version tag in `VERSION()` function and the value of the hash in the `VERIFIER_HASH()` function
from `solidity/src/SphinxVerifier.sol`. In Move contracts the verifier hash is stored in `VERSION_1082_TESTNET` constant from `move/sources/utilities.move` source file.

The first value can be taken directly from [Sphinx](https://github.com/argumentcomputer/sphinx/blob/dev/core/src/lib.rs#L33),
while the second is printed while running `sphinx-proof` program.

Finally, to test updated Solidity contracts:

```
Expand Down
10 changes: 10 additions & 0 deletions sphinx-proof/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ fn main() {
let proof = prover.prove(&pk, stdin).plonk().run().unwrap();
prover.verify(&proof, &vk).unwrap();

match &proof.proof {
sphinx_sdk::SphinxProof::Plonk(pr) => {
println!("To update hash from VERIFIER_HASH() function in SphinxVerifier.sol");
println!();
println!("0x{};", hex::encode(&pr.plonk_vkey_hash));
println!();
}
_ => unreachable!(),
};

print_solidity(&vk, &proof);
print_move(&vk, &proof);
}

0 comments on commit 207d1dd

Please sign in to comment.