Skip to content

Commit

Permalink
update verifer
Browse files Browse the repository at this point in the history
  • Loading branch information
CeciliaZ030 committed Jul 13, 2024
1 parent 15c9dbe commit 9260858
Show file tree
Hide file tree
Showing 12 changed files with 10,387 additions and 892 deletions.
10,329 changes: 10,329 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ rand = "0.8.5"
rand_core = "0.6.4"
dirs = "5.0.1"
pathdiff = "0.2.1"
dotenv = "0.15.0"

[patch.crates-io]
revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko" }
Expand Down
Binary file added host/input-taiko_a7-123456.bin
Binary file not shown.
1 change: 1 addition & 0 deletions provers/risc0/guest/src/zk_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ harness::zk_suits!(
for v in test_ves.iter() {
let (input, expected) = *v;
let result: [u8; 32] = Sha256::digest(input.as_bytes()).into();
// Don't change, this `assert!` custom defimed in `harness` crate.
assert!(result == expected);
}
}
Expand Down
48 changes: 21 additions & 27 deletions provers/sp1/contracts/src/Raiko.sol
Original file line number Diff line number Diff line change
@@ -1,45 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {SP1Verifier} from "./SP1Verifier.sol";
import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol";

/// @title Raiko.
/// @author Succinct Labs
/// @author Taiko Labs
/// @notice This contract implements a simple example of verifying the proof of a computing a
/// raiko number.
contract Raiko is SP1Verifier {
contract Raiko {
/// @notice The address of the SP1 verifier contract.
/// @dev This can either be a specific SP1Verifier for a specific version, or the
/// SP1VerifierGateway which can be used to verify proofs for any version of SP1.
/// For the list of supported verifiers on each chain, see:
/// https://github.com/succinctlabs/sp1-contracts/tree/main/contracts/deployments
address public verifier;

/// @notice The verification key for the raiko program.
bytes32 public raikoProgramVkey;

struct Transition {
bytes32 parentHash;
bytes32 blockHash;
bytes32 stateRoot;
bytes32 graffiti;
}

constructor(bytes32 _raikoProgramVkey) {
constructor(address _verifier, bytes32 _raikoProgramVkey) {
verifier = _verifier;
raikoProgramVkey = _raikoProgramVkey;
}

/// @notice The entrypoint for verifying the proof of a raiko number.
/// @notice The entrypoint for verifying the proof of a Raiko number.
/// @param proof The encoded proof.
/// @param publicValues The encoded public values.
function verifyRaikoProof(
bytes memory proof,
bytes memory publicValues
) public view returns (uint64, address, Transition memory, address, address, bytes32) {

this.verifyProof(raikoProgramVkey, publicValues, proof);
(
uint64 chain_id,
address verifier_address,
Transition memory transition,
address sgx_instance,
address prover,
bytes32 meta_hash
) = abi.decode(publicValues, (uint64, address, Transition, address, address, bytes32));

return (chain_id, verifier_address, transition, sgx_instance, prover, meta_hash);
function verifyRaikoProof(bytes calldata proof, bytes calldata publicValues)
public
view
returns bytes32
{
ISP1Verifier(verifier).verifyProof(RaikoProgramVkey, publicValues, proof);
bytes32 pi_hash = abi.decode(publicValues, bytes32);
return pi_hash;
}
}
Loading

0 comments on commit 9260858

Please sign in to comment.