cleanup risc0_images module names

This commit is contained in:
David Rusu 2025-03-07 01:53:53 +04:00
parent 8e2da63b18
commit 2e66315315
7 changed files with 22 additions and 38 deletions

View File

@ -7,7 +7,7 @@ fn main() {
for tx in &bundle_private.txs {
env::verify(
<[u8; 32]>::from_hex(risc0_images::nomos_mantle_tx_risc0_proof::TX_ID).unwrap(),
<[u8; 32]>::from_hex(risc0_images::risc0_proofs::TX_ID).unwrap(),
&serde::to_vec(&tx).unwrap(),
)
.unwrap();

View File

@ -25,11 +25,7 @@ impl ProvedBundle {
let opts = risc0_zkvm::ProverOpts::succinct();
let prove_info = prover
.prove_with_opts(
env,
risc0_images::nomos_mantle_bundle_risc0_proof::BUNDLE_ELF,
&opts,
)
.prove_with_opts(env, risc0_images::bundle_risc0_proof::BUNDLE_ELF, &opts)
.unwrap();
println!(
@ -52,10 +48,7 @@ impl ProvedBundle {
pub fn verify(&self) -> bool {
self.risc0_receipt
.verify(
<[u8; 32]>::from_hex(risc0_images::nomos_mantle_bundle_risc0_proof::BUNDLE_ID)
.unwrap(),
)
.verify(<[u8; 32]>::from_hex(risc0_images::bundle_risc0_proof::BUNDLE_ID).unwrap())
.is_ok()
}
}

View File

@ -77,7 +77,7 @@ impl ProvedLedgerTransition {
// This struct contains the receipt along with statistics about execution of the guest
let opts = risc0_zkvm::ProverOpts::succinct();
let prove_info = prover
.prove_with_opts(env, risc0_images::ledger_validity_proof::LEDGER_ELF, &opts)
.prove_with_opts(env, risc0_images::ledger_risc0_proof::LEDGER_ELF, &opts)
.unwrap();
println!(
@ -101,7 +101,7 @@ impl ProvedLedgerTransition {
pub fn verify(&self) -> bool {
self.risc0_receipt
.verify(<[u8; 32]>::from_hex(risc0_images::ledger_validity_proof::LEDGER_ID).unwrap())
.verify(<[u8; 32]>::from_hex(risc0_images::ledger_risc0_proof::LEDGER_ID).unwrap())
.is_ok()
}
}

View File

@ -33,7 +33,7 @@ impl StfProof {
}
pub fn nop_stf() -> [u8; 32] {
FromHex::from_hex(risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ID).unwrap()
FromHex::from_hex(risc0_images::risc0_proofs::STF_NOP_ID).unwrap()
}
pub fn prove_nop(public: StfPublic) -> Self {
@ -49,11 +49,7 @@ impl StfProof {
let opts = risc0_zkvm::ProverOpts::succinct();
let prove_info = prover
.prove_with_opts(
env,
risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ELF,
&opts,
)
.prove_with_opts(env, risc0_images::risc0_proofs::STF_NOP_ELF, &opts)
.unwrap();
println!(
@ -66,8 +62,7 @@ impl StfProof {
let receipt = prove_info.receipt;
Self {
risc0_id: FromHex::from_hex(risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ID)
.unwrap(),
risc0_id: FromHex::from_hex(risc0_images::risc0_proofs::STF_NOP_ID).unwrap(),
public,
risc0_receipt: receipt,
}

View File

@ -37,11 +37,7 @@ impl ProvedTx {
// This struct contains the receipt along with statistics about execution of the guest
let opts = risc0_zkvm::ProverOpts::succinct();
let prove_info = prover
.prove_with_opts(
env,
risc0_images::nomos_mantle_tx_risc0_proof::TX_ELF,
&opts,
)
.prove_with_opts(env, risc0_images::risc0_proofs::TX_ELF, &opts)
.map_err(|_| Error::Risc0ProofFailed)?;
println!(
@ -62,7 +58,7 @@ impl ProvedTx {
pub fn verify(&self) -> bool {
self.risc0_receipt
.verify(<[u8; 32]>::from_hex(risc0_images::nomos_mantle_tx_risc0_proof::TX_ID).unwrap())
.verify(<[u8; 32]>::from_hex(risc0_images::risc0_proofs::TX_ID).unwrap())
.is_ok()
}
}

View File

@ -24,7 +24,7 @@ fn main() {
} in bundles
{
env::verify(
<[u8; 32]>::from_hex(risc0_images::nomos_mantle_bundle_risc0_proof::BUNDLE_ID).unwrap(),
<[u8; 32]>::from_hex(risc0_images::bundle_risc0_proof::BUNDLE_ID).unwrap(),
&serde::to_vec(&bundle).unwrap(),
)
.unwrap();
@ -42,8 +42,7 @@ fn main() {
if let Some(ledger_update) = bundle
.updates
.into_iter()
.filter(|update| update.zone_id == id)
.next()
.find(|update| update.zone_id == id)
{
for node in &ledger_update.frontier_nodes {
let past_cm_root_proof = cm_root_proofs

View File

@ -1,19 +1,20 @@
pub mod nomos_mantle_risc0_proofs {
pub mod risc0_proofs {
pub static STF_NOP_ID: &str = include_str!("STF_NOP_ID");
#[cfg(feature = "elf")]
pub static STF_NOP_ELF: &[u8] = include_bytes!("STF_NOP_ELF");
}
pub mod nomos_mantle_bundle_risc0_proof {
pub static BUNDLE_ID: &str = include_str!("BUNDLE_ID");
#[cfg(feature = "elf")]
pub static BUNDLE_ELF: &[u8] = include_bytes!("BUNDLE_ELF");
}
pub mod nomos_mantle_tx_risc0_proof {
pub static TX_ID: &str = include_str!("TX_ID");
#[cfg(feature = "elf")]
pub static TX_ELF: &[u8] = include_bytes!("TX_ELF");
}
pub mod ledger_validity_proof {
pub mod bundle_risc0_proof {
pub static BUNDLE_ID: &str = include_str!("BUNDLE_ID");
#[cfg(feature = "elf")]
pub static BUNDLE_ELF: &[u8] = include_bytes!("BUNDLE_ELF");
}
pub mod ledger_risc0_proof {
pub static LEDGER_ID: &str = include_str!("LEDGER_ID");
#[cfg(feature = "elf")]
pub static LEDGER_ELF: &[u8] = include_bytes!("LEDGER_ELF");