Skip to content

Commit

Permalink
fix: migrate to new prover sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Sep 7, 2024
1 parent de8095d commit d1e83cc
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 57 deletions.
113 changes: 69 additions & 44 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pretty_assertions = "1.2.1"
rand = "0.8.5"
rayon = "1.8.0"
regex = "1.10.3"
reqwest = { version = "0.12", features = [ "blocking", "json", "rustls-tls" ], default-features = false }
reqwest = { version = "0.12.7", features = [ "blocking", "json", "rustls-tls" ], default-features = false }
rpassword = "7.2.0"
rstest = "0.18.2"
rstest_reuse = "0.6.0"
Expand Down
3 changes: 1 addition & 2 deletions crates/dojo-world/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,7 @@ impl OverlayManifest {

impl DeploymentManifest {
pub fn load_from_path(path: &Utf8PathBuf) -> Result<Self, AbstractManifestError> {
let manifest: Self = toml::from_str(&fs::read_to_string(path)?).unwrap();

let manifest: Self = toml::from_str(&fs::read_to_string(path)?)?;
Ok(manifest)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/saya/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ cairo-felt = "0.9.1"
num-bigint = "0.4.4"
num-traits = "0.2.18"

prover-sdk = { git = "https://github.com/cartridge-gg/http-prover", rev = "7d00b05" }
prover-sdk = { git = "https://github.com/cartridge-gg/http-prover", rev = "103597b" }
2 changes: 1 addition & 1 deletion crates/saya/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use katana_primitives::transaction::Tx;
use katana_rpc_types::trace::TxExecutionInfo;
use prover::persistent::{BatcherCall, BatcherInput, BatcherOutput};
use prover::{extract_execute_calls, HttpProverParams, ProveProgram, ProverIdentifier};
pub use prover_sdk::ProverAccessKey;
pub use prover_sdk::access_key::ProverAccessKey;
use saya_provider::rpc::JsonRpcProvider;
use saya_provider::Provider as SayaProvider;
use serde::{Deserialize, Serialize};
Expand Down
9 changes: 5 additions & 4 deletions crates/saya/core/src/prover/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use std::sync::Arc;

use anyhow::Context;
use katana_primitives::FieldElement;
use prover_sdk::ProverSDK;
use prover_sdk::access_key::ProverAccessKey;
use prover_sdk::sdk::ProverSDK;
use url::Url;

use super::loader::prepare_input_cairo1;
Expand All @@ -12,7 +13,7 @@ use crate::prover::loader::prepare_input_cairo0;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct HttpProverParams {
pub prover_url: Url,
pub prover_key: prover_sdk::ProverAccessKey,
pub prover_key: ProverAccessKey,
}

pub async fn http_prove_felts(
Expand All @@ -32,12 +33,12 @@ pub async fn http_prove(
prove_program: ProveProgram,
) -> anyhow::Result<String> {
let prover =
ProverSDK::new(prover_params.prover_key.clone(), prover_params.prover_url.clone()).await;
ProverSDK::new(prover_params.prover_url.clone(), prover_params.prover_key.clone()).await;
let prover = prover.as_ref().map_err(|e| anyhow::anyhow!(e.to_string()))?;

if prove_program.cairo_version() == FieldElement::ONE {
let input = prepare_input_cairo1(input, prove_program).await?;
prover.prove_cairo1(input).await.context("Failed to prove using the http prover")
prover.prove_cairo(input).await.context("Failed to prove using the http prover")
} else {
let input = prepare_input_cairo0(input, prove_program).await?;
prover.prove_cairo0(input).await.context("Failed to prove using the http prover")
Expand Down
Loading

0 comments on commit d1e83cc

Please sign in to comment.