-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15c9dbe
commit 9260858
Showing
12 changed files
with
10,387 additions
and
892 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.