Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(raiko): removed panic stabilization #232

Merged
merged 31 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5542dff
chore(install): source env if sp1 bin not in path
35359595 May 17, 2024
b8a726b
chore: actual new line instead of `\n` symbols
35359595 May 17, 2024
cd05248
chore(log): tracing logs instead println; levels;
35359595 May 17, 2024
5ab3275
Merge branch 'main' of github.com:taikoxyz/raiko
35359595 May 17, 2024
a1ee3ae
Merge branch 'main'
35359595 May 17, 2024
902c56b
chore: debug assertinos print inline
35359595 May 17, 2024
48bc58f
chore: removed unnecesary re-init; prints in db;
35359595 May 17, 2024
65a6a8c
Merge branch 'main' of github.com:taikoxyz/raiko
35359595 May 17, 2024
91ca30d
Merge branch 'main'
35359595 May 17, 2024
d1a7929
chore: warnings and cfg fixes
35359595 May 17, 2024
ad5df3a
Merge branch 'main' of github.com:taikoxyz/raiko
35359595 May 21, 2024
b733aca
Merge branch 'main'
35359595 May 21, 2024
635e619
fix: check_eq instead of assert_eq
35359595 May 22, 2024
ecb1318
Merge branch 'chore/auto_logging' into fix/removed_panic_stabilization
35359595 May 22, 2024
549ddc3
console only progress tracking
Brechtpd May 24, 2024
6b3b701
fix
Brechtpd May 24, 2024
e24d7fc
feat: disable inplace print in container env
johntaiko May 24, 2024
eeb22e9
chore: error propagation; warning cleanups
35359595 May 27, 2024
7678116
Merge branch 'fix/removed_panic_stabilization' of github.com:taikoxyz…
35359595 May 27, 2024
57f556a
chore: error formatting
35359595 May 27, 2024
6847dc3
Merge branch 'main'
35359595 May 28, 2024
891f6fe
fix; merge conflict fixes
35359595 May 28, 2024
feeb210
chore: B256 instead of trait init; cleanup
35359595 May 28, 2024
1e9987c
Merge branch 'main' into chore/auto_logging
35359595 May 28, 2024
1716891
Merge branch 'chore/auto_logging' into fix/removed_panic_stabilization
35359595 May 28, 2024
44d60f5
chore: psto-merge fixes
35359595 May 28, 2024
cf5e32f
chore: error debug formatting added
35359595 May 28, 2024
cdc3d5c
fix: require_eq error printing; reduced clonning;
35359595 May 30, 2024
3b01ad1
fix: removed extra empty line; reverted home path;
35359595 May 30, 2024
84a86f3
chore: error propagation; warning cleanups
35359595 Jun 3, 2024
6d6e01d
chore: imports fixes
35359595 Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions harness/core/src/assert.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{fmt::Debug, sync::Mutex};
use std::fmt::Debug;

pub trait DynAssertion: Send + Sync {
fn display(&self);
Expand Down Expand Up @@ -99,9 +99,7 @@ pub fn eval_assert_eq<T: PartialEq + std::fmt::Debug>(a: T, b: T, file: &str, li
macro_rules! assert {
($cond:expr) => {
let result = eval_assert(false, file!(), line!());
let log = $crate::ASSERTION_LOG.get_or_init(
|| std::sync::Mutex::new(AssertionLog::new())
);
let log = $crate::ASSERTION_LOG.get_or_init(|| std::sync::Mutex::new(AssertionLog::new()));
log.lock()
.unwrap()
.insert(Box::new(Assertion::<bool>::Cond(Assert { result })));
Expand All @@ -111,9 +109,7 @@ macro_rules! assert {
macro_rules! assert_eq {
($a:expr, $b:expr) => {
let result = eval_assert_eq($a, $b, file!(), line!());
let log = $crate::ASSERTION_LOG.get_or_init(
|| std::sync::Mutex::new(AssertionLog::new())
);
let log = $crate::ASSERTION_LOG.get_or_init(|| std::sync::Mutex::new(AssertionLog::new()));
log.lock()
.unwrap()
.insert(Box::new(Assertion::<i32>::Eq(AssertEQ {
Expand Down
16 changes: 10 additions & 6 deletions host/src/interfaces/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,22 @@ impl ProofType {
#[cfg(feature = "sp1")]
return Ok(sp1_driver::Sp1Prover::instance_hash(pi));

Err(HostError::FeatureNotSupportedError(self.clone()))
#[cfg(not(feature = "sp1"))]
return Err(HostError::FeatureNotSupportedError(self.clone()));
}
ProofType::Risc0 => {
#[cfg(feature = "risc0")]
return Ok(risc0_driver::Risc0Prover::instance_hash(pi));

Err(HostError::FeatureNotSupportedError(self.clone()))
#[cfg(not(feature = "risc0"))]
return Err(HostError::FeatureNotSupportedError(self.clone()));
}
ProofType::Sgx => {
#[cfg(feature = "sgx")]
return Ok(sgx_prover::SgxProver::instance_hash(pi));

Err(HostError::FeatureNotSupportedError(self.clone()))
#[cfg(not(feature = "sgx"))]
return Err(HostError::FeatureNotSupportedError(self.clone()));
}
}
}
Expand All @@ -111,23 +114,24 @@ impl ProofType {
.await
.map_err(|e| e.into());
#[cfg(not(feature = "sp1"))]
Err(HostError::FeatureNotSupportedError(self.clone()))
return Err(HostError::FeatureNotSupportedError(self.clone()));
}
ProofType::Risc0 => {
#[cfg(feature = "risc0")]
return risc0_driver::Risc0Prover::run(input, output, config)
.await
.map_err(|e| e.into());
#[cfg(not(feature = "risc0"))]
Err(HostError::FeatureNotSupportedError(self.clone()))
return Err(HostError::FeatureNotSupportedError(self.clone()));
}
ProofType::Sgx => {
#[cfg(feature = "sgx")]
return sgx_prover::SgxProver::run(input, output, config)
.await
.map_err(|e| e.into());

#[cfg(not(feature = "sgx"))]
Err(HostError::FeatureNotSupportedError(self.clone()))
return Err(HostError::FeatureNotSupportedError(self.clone()));
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions host/src/raiko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ impl Raiko {
);

// Make sure the blockhash from the node matches the one from the builder
check_eq(
&Into::<FixedBytes<32>>::into(header.hash().0),
&input.block_hash_reference,
"block hash unexpected",
);
if &Into::<FixedBytes<32>>::into(header.hash().0) != &input.block_hash_reference {
35359595 marked this conversation as resolved.
Show resolved Hide resolved
return Err(anyhow::Error::msg("block hash unexpected").into());
}
let output = GuestOutput::Success { header, hash: pi };

Ok(output)
Expand Down
1 change: 0 additions & 1 deletion provers/risc0/driver/src/bonsai.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use log::{debug, error, info, warn};
use raiko_lib::prover::Prover;
use raiko_primitives::keccak::keccak;
use risc0_zkvm::{
compute_image_id, is_dev_mode, serde::to_vec, sha::Digest, Assumption, ExecutorEnv,
Expand Down
1 change: 0 additions & 1 deletion provers/risc0/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub mod bonsai;
pub mod methods;
pub mod snarks;
use crate::snarks::verify_groth16_snark;
use bonsai::maybe_prove;
pub use bonsai::*;
use methods::risc0_guest::{RISC0_GUEST_ELF, RISC0_GUEST_ID};

Expand Down
5 changes: 2 additions & 3 deletions provers/risc0/driver/src/methods/risc0_guest.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub const RISC0_GUEST_ELF: &[u8] =
include_bytes!("../../../guest/target/riscv32im-risc0-zkvm-elf/release/risc0-guest");
pub const RISC0_GUEST_ID: [u32; 8] = [
2669471478, 2370976086, 1239099654, 3456690507, 387711042, 2480181200, 3781663788, 2654654325,
2913493253, 3394948572, 1016455208, 2248481430, 1003343387, 1683995099, 2606924676, 3573161770,
];
pub const RISC0_GUEST_PATH: &str =
r#"/home/ubuntu/raiko/provers/risc0/guest/target/riscv32im-risc0-zkvm-elf/release/risc0-guest"#;
pub const RISC0_GUEST_PATH: &str = r#"/home/jony/projects/rust/taiko/raiko/provers/risc0/guest/target/riscv32im-risc0-zkvm-elf/release/risc0-guest"#;
35359595 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions provers/risc0/guest/Cargo.lock

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

1 change: 1 addition & 0 deletions provers/sp1/guest/Cargo.lock

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

Binary file modified provers/sp1/guest/elf/sp1-guest
Binary file not shown.
3 changes: 1 addition & 2 deletions provers/sp1/guest/src/zk_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl ZkvmOperator for Sp1Operator {
.map(|chunk| u32::from_le_bytes(chunk.try_into().unwrap()))
.collect::<Vec<u32>>()
.try_into()
.map_err(|e| Error::ZkvmOperation("Input point processing failed".to_string()))?;
.map_err(|_| Error::ZkvmOperation("Input point processing failed: {}".to_string()))?;
35359595 marked this conversation as resolved.
Show resolved Hide resolved

p.mul_assign(&k);
Ok(point_to_be_bytes(p))
Expand Down Expand Up @@ -98,7 +98,6 @@ fn point_to_be_bytes(p: AffinePoint<Bn254, 16>) -> [u8; 64] {
([x, y]).concat().try_into().unwrap()
}


harness::zk_suits!(
pub mod tests {
use revm_precompile::bn128;
Expand Down
Loading