mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-09 08:33:09 +00:00
update ledger to use risc0_images
This commit is contained in:
parent
b89ebd4e50
commit
38795ceaf3
@ -6,10 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
cl = { path = "../cl" }
|
||||
ledger_proof_statements = { path = "../ledger_proof_statements" }
|
||||
nomos_mantle_risc0_proofs = { path = "../risc0_proofs" }
|
||||
nomos_mantle_bundle_risc0_proof = { path = "../bundle_risc0_proof" }
|
||||
nomos_mantle_tx_risc0_proof = { path = "../tx_risc0_proof" }
|
||||
ledger_validity_proof = { path = "../ledger_validity_proof" }
|
||||
risc0_images = { path = "../risc0_images" }
|
||||
risc0-zkvm = { version = "1.0", features = ["prove", "metal"] }
|
||||
risc0-groth16 = { version = "1.0" }
|
||||
rand = "0.8.5"
|
||||
|
||||
@ -23,7 +23,11 @@ impl ProvedBundle {
|
||||
|
||||
let opts = risc0_zkvm::ProverOpts::succinct();
|
||||
let prove_info = prover
|
||||
.prove_with_opts(env, nomos_mantle_bundle_risc0_proof::BUNDLE_ELF, &opts)
|
||||
.prove_with_opts(
|
||||
env,
|
||||
risc0_images::nomos_mantle_bundle_risc0_proof::BUNDLE_ELF,
|
||||
&opts,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
println!(
|
||||
@ -46,7 +50,7 @@ impl ProvedBundle {
|
||||
|
||||
pub fn verify(&self) -> bool {
|
||||
self.risc0_receipt
|
||||
.verify(nomos_mantle_bundle_risc0_proof::BUNDLE_ID)
|
||||
.verify(risc0_images::nomos_mantle_bundle_risc0_proof::BUNDLE_ID)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,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, ledger_validity_proof::LEDGER_ELF, &opts)
|
||||
.prove_with_opts(env, risc0_images::ledger_validity_proof::LEDGER_ELF, &opts)
|
||||
.unwrap();
|
||||
|
||||
println!(
|
||||
@ -99,7 +99,7 @@ impl ProvedLedgerTransition {
|
||||
|
||||
pub fn verify(&self) -> bool {
|
||||
self.risc0_receipt
|
||||
.verify(ledger_validity_proof::LEDGER_ID)
|
||||
.verify(risc0_images::ledger_validity_proof::LEDGER_ID)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ impl StfProof {
|
||||
}
|
||||
|
||||
pub fn nop_stf() -> [u8; 32] {
|
||||
risc0_stf(nomos_mantle_risc0_proofs::STF_NOP_ID)
|
||||
risc0_stf(risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ID)
|
||||
}
|
||||
|
||||
pub fn prove_nop(public: StfPublic) -> Self {
|
||||
@ -47,7 +47,11 @@ impl StfProof {
|
||||
|
||||
let opts = risc0_zkvm::ProverOpts::succinct();
|
||||
let prove_info = prover
|
||||
.prove_with_opts(env, nomos_mantle_risc0_proofs::STF_NOP_ELF, &opts)
|
||||
.prove_with_opts(
|
||||
env,
|
||||
risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ELF,
|
||||
&opts,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
println!(
|
||||
@ -60,7 +64,7 @@ impl StfProof {
|
||||
let receipt = prove_info.receipt;
|
||||
|
||||
Self {
|
||||
risc0_id: nomos_mantle_risc0_proofs::STF_NOP_ID,
|
||||
risc0_id: risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ID,
|
||||
public,
|
||||
risc0_receipt: receipt,
|
||||
}
|
||||
|
||||
@ -36,7 +36,11 @@ 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, nomos_mantle_tx_risc0_proof::TX_ELF, &opts)
|
||||
.prove_with_opts(
|
||||
env,
|
||||
risc0_images::nomos_mantle_tx_risc0_proof::TX_ELF,
|
||||
&opts,
|
||||
)
|
||||
.map_err(|_| Error::Risc0ProofFailed)?;
|
||||
|
||||
println!(
|
||||
@ -57,7 +61,7 @@ impl ProvedTx {
|
||||
|
||||
pub fn verify(&self) -> bool {
|
||||
self.risc0_receipt
|
||||
.verify(nomos_mantle_tx_risc0_proof::TX_ID)
|
||||
.verify(risc0_images::nomos_mantle_tx_risc0_proof::TX_ID)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ impl ProvedBatchUpdate {
|
||||
let mut actual_zones = HashMap::new();
|
||||
for proof in &self.ledger_proofs {
|
||||
if !proof.verify() {
|
||||
panic!();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -45,13 +46,17 @@ impl ProvedBatchUpdate {
|
||||
.zip(self.stf_proofs.iter())
|
||||
.zip(self.ledger_proofs.iter())
|
||||
{
|
||||
assert_eq!(ledger_proof.public().old_ledger, update.old.ledger);
|
||||
assert_eq!(ledger_proof.public().ledger, update.new.ledger);
|
||||
if ledger_proof.public().old_ledger != update.old.ledger
|
||||
|| ledger_proof.public().ledger != update.new.ledger
|
||||
{
|
||||
panic!();
|
||||
return false;
|
||||
}
|
||||
|
||||
if stf_proof.public.old != update.old || stf_proof.public.new != update.new {
|
||||
panic!();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user