Add files via upload

This commit is contained in:
jonesmarvin8 2025-07-01 21:37:25 -04:00 committed by GitHub
parent e204db5cd9
commit f44492b237
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 6926 additions and 0 deletions

3444
temp_pedersen-tests/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
[workspace]
resolver = "2"
members = [ "host", "methods"]
# Always optimize; building and running the guest takes much longer without optimization.
[profile.dev]
opt-level = 3
[profile.release]
debug = 1
lto = true
[patch.crates-io.crypto-bigint]
git = "https://github.com/risc0/RustCrypto-crypto-bigint"
tag = "v0.5.5-risczero.0"

View File

@ -0,0 +1,13 @@
[package]
name = "host"
version = "0.1.0"
edition = "2021"
[dependencies]
shared = { path = "../../shared" }
methods = { path = "../methods" }
risc0-zkvm = "2.0.0"
pasta_curves = "0.5.1"
[features]
default = [ ]

View File

@ -0,0 +1,62 @@
//use std::time::Instant;
use methods::NEBRA0_GUEST_ELF;
// These constants represent the RISC-V ELF and the image ID generated by risc0-build.
// The ELF is used for proving and the ID is used for verification
use risc0_zkvm::{default_prover, ExecutorEnv};
use pasta_curves::group::Group;
fn main() {
// Initialize tracing. In order to view logs, run `RUST_LOG=info cargo run`
//tracing_subscriber::fmt()
// .with_env_filter(tracing_subscriber::filter::EnvFilter::from_default_env())
// .init();
// An executor environment describes the configurations for the zkVM
// including program inputs.
// An default ExecutorEnv can be created like so:
// `let env = ExecutorEnv::builder().build().unwrap();`
// However, this `env` does not have any inputs.
//
// To add add guest input to the executor environment, use
// ExecutorEnvBuilder::write().
// To access this method, you'll need to use ExecutorEnv::builder(), which
// creates an ExecutorEnvBuilder. When you're done adding input, call
// ExecutorEnvBuilder::build().
let g1 = pasta_curves::pallas::Point::generator();
let g2 = g1 + g1;
let g3 = g1 + g2;
let g4 = g1 + g3;
let g5 = g1 + g4;
//should be public inputs...eventually
// let elapsed = now.elapsed();
// let inputs: Inputs = (
// g1, g2, g3, g4, g5,
//a1.to_repr(),
//a2.to_repr(),
//b1.to_repr(),
//b2.to_repr(),
//x2_minus_x1_inv.to_repr(),
// );
//let now = Instant::now();
let env = ExecutorEnv::builder()
//.write(&inputs)
//.unwrap()
.build()
.unwrap();
// Obtain the default prover.
let prover = default_prover();
// Produce a receipt by proving the specified ELF binary.
//let now = Instant::now();
let receipt = prover.prove(env, NEBRA0_GUEST_ELF).unwrap();
//println!("proving time: {:?}", now.elapsed());
}

View File

@ -0,0 +1,11 @@
[package]
name = "methods"
version = "0.1.0"
edition = "2021"
[build-dependencies]
risc0-build = "2.0.0"
pasta_curves = "0.5.1"
[package.metadata.risc0]
methods = ["guest"]

View File

@ -0,0 +1,3 @@
fn main() {
risc0_build::embed_methods();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
[package]
name = "nebra0_guest"
version = "0.1.0"
edition = "2021"
[workspace]
[profile.dev]
opt-level = 3
[profile.test]
opt-level = 3
[profile.release]
opt-level = 3
[profile.bench]
opt-level = 3
[dependencies]
# If you want to try (experimental) std support, add `features = [ "std" ]` to risc0-zkvm
risc0-zkvm = "2.0.0"
pasta_curves= "0.5.1"
[patch.crates-io.crypto-bigint]
git = "https://github.com/risc0/RustCrypto-crypto-bigint"
tag = "v0.5.5-risczero.0"

View File

@ -0,0 +1,22 @@
use std::{
env,
fs::File,
io::{BufWriter, Write},
};
fn main() {
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target_arch != "x86_64" {
let mut w = BufWriter::new(File::create("platform_config").unwrap());
for (key, value) in env::vars() {
if key.starts_with("CARGO_CFG_") {
println!("{}: {:?}", key, value);
w.write_fmt(format_args!("{}: {:?}\n", key, value)).unwrap();
}
}
}
// // CARGO_CFG_TARGET_ARCH: "x86_64"
// panic!("stop and dump stdout");
}

View File

@ -0,0 +1,17 @@
CARGO_CFG_FEATURE: ""
CARGO_CFG_GETRANDOM_BACKEND: "custom"
CARGO_CFG_OVERFLOW_CHECKS: ""
CARGO_CFG_PANIC: "abort"
CARGO_CFG_RELOCATION_MODEL: "static"
CARGO_CFG_TARGET_ABI: ""
CARGO_CFG_TARGET_ARCH: "riscv32"
CARGO_CFG_TARGET_ENDIAN: "little"
CARGO_CFG_TARGET_ENV: ""
CARGO_CFG_TARGET_FEATURE: "m"
CARGO_CFG_TARGET_HAS_ATOMIC: "16,32,64,8,ptr"
CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT: "16,32,64,8,ptr"
CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE: "16,32,64,8,ptr"
CARGO_CFG_TARGET_OS: "zkvm"
CARGO_CFG_TARGET_POINTER_WIDTH: "32"
CARGO_CFG_TARGET_VENDOR: "risc0"
CARGO_CFG_UB_CHECKS: ""

View File

@ -0,0 +1,33 @@
#![no_main]
// If you want to try std support, also update the guest Cargo.toml file
// #![no_std] // std support is experimental
use pasta_curves::group::Group;
#[cfg(all(target_os = "zkvm", target_arch = "riscv32"))]
risc0_zkvm::guest::entry!(main);
fn main() {
// TODO: Implement your guest code here
let g1 = pasta_curves::pallas::Point::generator();
let g2 = g1 + g1;
let g3 = g1 + g2;
let g4 = g1 + g3;
let g5 = g1 + g4;
let s1 = pasta_curves::pallas::Scalar::from(87329482u64);
let s2 = pasta_curves::pallas::Scalar::from(37264829u64);
let s3 = pasta_curves::pallas::Scalar::from(98098098u64);
let s4 = pasta_curves::pallas::Scalar::from(63980948u64);
let s5 = pasta_curves::pallas::Scalar::from(15098098u64);
let val = g1*s1 + g2*s2 + g3*s3 + g4*s4 + g5*s5;
//let now = Instant::now();
//risc0_zkvm::guest::env::commit();
}

View File

@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/methods.rs"));

View File

@ -0,0 +1,4 @@
[toolchain]
channel = "stable"
components = ["rustfmt", "rust-src"]
profile = "minimal"