mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-02-01 03:33:07 +00:00
* update cl * move zoneid into NoteWitness * Update emmarin/cl/ledger_proof_statements/src/ledger.rs Co-authored-by: davidrusu <davidrusu.me@gmail.com> * update * update note cm order * remove NoteWitness * mv indexed and merkle into /ds/; rework padded_leaves interface * ledger cross zone update test is now passing * clippy * pad nullifiers in cross zone update test * print user and total cycles for each proof * only publish sync logs for cross zone bundles --------- Co-authored-by: davidrusu <davidrusu.me@gmail.com>
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
use ledger_proof_statements::covenant::{SpendingCovenantPublic, SupplyCovenantPublic};
|
|
|
|
use crate::error::Result;
|
|
|
|
macro_rules! impl_covenant_proof {
|
|
($name:ident, $public:ident) => {
|
|
#[derive(Debug, Clone)]
|
|
pub struct $name {
|
|
pub risc0_id: [u32; 8],
|
|
pub risc0_receipt: risc0_zkvm::Receipt,
|
|
}
|
|
|
|
impl $name {
|
|
pub fn from_risc0(risc0_id: [u32; 8], risc0_receipt: risc0_zkvm::Receipt) -> Self {
|
|
Self {
|
|
risc0_id,
|
|
risc0_receipt,
|
|
}
|
|
}
|
|
|
|
pub fn public(&self) -> Result<$public> {
|
|
Ok(self.risc0_receipt.journal.decode()?)
|
|
}
|
|
|
|
pub fn verify(&self, expected_public: $public) -> bool {
|
|
let Ok(public) = self.public() else {
|
|
return false;
|
|
};
|
|
|
|
expected_public == public && self.risc0_receipt.verify(self.risc0_id).is_ok()
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
impl_covenant_proof!(SupplyCovenantProof, SupplyCovenantPublic);
|
|
impl_covenant_proof!(SpendingCovenantProof, SpendingCovenantPublic);
|