Skip to content

Commit

Permalink
fix: guest program compilation (#1347)
Browse files Browse the repository at this point in the history
  • Loading branch information
dprats authored Feb 19, 2025
1 parent b0af9e3 commit 5831a38
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion clients/cli/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 clients/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nexus-network"
version = "0.5.1"
version = "0.5.2"
edition = "2021"
rust-version = "1.75"
build = "build.rs"
Expand Down
Binary file added clients/cli/assets/fib_input
Binary file not shown.
25 changes: 15 additions & 10 deletions clients/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ mod utils;

// Use high performance STWO
use nexus_sdk::{
compile::{cargo::CargoPackager, Compile, Compiler},
// compile::{cargo::CargoPackager, Compile, Compiler},
stwo::seq::Stwo,
ByGuestCompilation, Local, Prover, Viewable,
// ByGuestCompilation,
Local,
Prover,
Viewable,
};

// Update the import path to use the proto module
Expand Down Expand Up @@ -153,14 +156,14 @@ async fn authenticated_proving(

let public_input: u32 = proof_task.public_inputs[0] as u32;

//print inputs
println!("2. Compiling guest program...");
let mut prover_compiler = Compiler::<CargoPackager>::new("example");
let prover: Stwo<Local> =
Stwo::compile(&mut prover_compiler).expect("failed to compile guest program");
let elf_file_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets")
.join("fib_input");
let prover =
Stwo::<Local>::new_from_file(&elf_file_path).expect("failed to load guest program");

println!("3. Creating proof with inputs...");

let (view, proof) = prover
.prove_with_input::<(), u32>(&(), &public_input)
.expect("Failed to run prover");
Expand Down Expand Up @@ -189,9 +192,11 @@ fn anonymous_proving() -> Result<(), Box<dyn std::error::Error>> {

//2. Compile the guest program
println!("1. Compiling guest program...");
let mut prover_compiler = Compiler::<CargoPackager>::new("example");
let prover: Stwo<Local> =
Stwo::compile(&mut prover_compiler).expect("failed to compile guest program");
let elf_file_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets")
.join("fib_input");
let prover =
Stwo::<Local>::new_from_file(&elf_file_path).expect("failed to load guest program");

//3. Run the prover
println!("2. Creating proof...");
Expand Down
2 changes: 1 addition & 1 deletion clients/cli/src/utils/cli_branding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn print_banner() {
"{} {} {}\n",
"Welcome to the".bright_white(),
"Nexus Network CLI".bright_cyan().bold(),
"v0.5.1".bright_white()
"v0.5.2".bright_white()
);
println!(
"{}",
Expand Down

0 comments on commit 5831a38

Please sign in to comment.