Skip to content

Commit

Permalink
fix: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Jun 18, 2024
1 parent 4259c43 commit 3dc5c1f
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 162 deletions.
364 changes: 215 additions & 149 deletions operator/Cargo.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ name = "genesis"
path = "bin/genesis.rs"

[dependencies]
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.5-testnet", features = [
"plonk",
] }
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", branch = "dev" }
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", features = ["full"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
Expand Down
3 changes: 1 addition & 2 deletions operator/bin/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ async fn main() -> anyhow::Result<()> {
target_height,
vkey: tendermint_prover.vkey.bytes32(),
public_values: proof_data.public_values.bytes(),
proof: proof_data.bytes(),
proof: proof_data.proof.try_as_plonk().unwrap().encoded_proof,
};

// Save the proof data to the file path.
let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(args.fixture_path);

// TODO: Change to prover.id
let sp1_prover_type = env::var("SP1_PROVER");
if sp1_prover_type.as_deref() == Ok("mock") {
std::fs::write(
Expand Down
3 changes: 2 additions & 1 deletion operator/bin/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ async fn main() -> anyhow::Result<()> {
prover.generate_tendermint_proof(&trusted_light_block, &target_light_block);

// Construct the on-chain call and relay the proof to the contract.
let proof_as_bytes = hex::decode(&proof_data.proof.encoded_proof).unwrap();
let proof_as_bytes =
hex::decode(&proof_data.proof.try_as_plonk().unwrap().encoded_proof).unwrap();
let verify_tendermint_proof_call_data = SP1Tendermint::verifyTendermintProofCall {
publicValues: proof_data.public_values.to_vec().into(),
proof: proof_as_bytes.into(),
Expand Down
10 changes: 6 additions & 4 deletions operator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sp1_sdk::{ProverClient, SP1PlonkBn254Proof, SP1ProvingKey, SP1Stdin, SP1VerifyingKey};
use sp1_sdk::{ProverClient, SP1ProofWithPublicValues, SP1ProvingKey, SP1Stdin, SP1VerifyingKey};
use tendermint_light_client_verifier::types::LightBlock;

pub mod contract;
Expand Down Expand Up @@ -39,7 +39,7 @@ impl TendermintProver {
&self,
trusted_light_block: &LightBlock,
target_light_block: &LightBlock,
) -> SP1PlonkBn254Proof {
) -> SP1ProofWithPublicValues {
// Encode the light blocks to be input into our program.
let encoded_1 = serde_cbor::to_vec(&trusted_light_block).unwrap();
let encoded_2 = serde_cbor::to_vec(&target_light_block).unwrap();
Expand All @@ -52,12 +52,14 @@ impl TendermintProver {
// Generate the proof. Depending on SP1_PROVER env variable, this may be a mock, local or network proof.
let proof = self
.prover_client
.prove_plonk(&self.pkey, stdin)
.prove(&self.pkey, stdin)
.plonk()
.run()
.expect("proving failed");

// Verify proof.
self.prover_client
.verify_plonk(&proof, &self.vkey)
.verify(&proof, &self.vkey)
.expect("Verification failed");

// Return the proof.
Expand Down
5 changes: 3 additions & 2 deletions program/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "tendermint-program"
edition = "2021"

[dependencies]
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.5-testnet" }
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", branch = "dev" }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
tendermint-light-client-verifier = { version = "0.35.0", default-features = false, features = [
Expand Down
Binary file modified program/elf/riscv32im-succinct-zkvm-elf
Binary file not shown.

0 comments on commit 3dc5c1f

Please sign in to comment.