mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-05-04 16:43:10 +00:00
drop risc0_images_police; simplify risc0_images features
This commit is contained in:
parent
efaff2b982
commit
436ee4a830
@ -6,7 +6,6 @@ members = [
|
||||
"ledger_proof_statements",
|
||||
"ledger_validity_proof",
|
||||
"risc0_images",
|
||||
# "risc0_images_police",
|
||||
]
|
||||
|
||||
# Always optimize; building and running the risc0_proofs takes much longer without optimization.
|
||||
|
||||
@ -8,7 +8,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
risc0-zkvm = { version = "1.0", default-features = false, features = ['std'] }
|
||||
cl = { path = "../../cl" }
|
||||
risc0_images = { path = "../../risc0_images", features=["nomos_mantle_tx_risc0_proof"] }
|
||||
risc0_images = { path = "../../risc0_images" }
|
||||
hex = "0.4"
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Order of these proofs is important, we sequence them topologically by composition order
|
||||
proofs=$(cat <<EOF
|
||||
tx_risc0_proof/tx
|
||||
risc0_proofs/stf_nop
|
||||
@ -26,25 +27,3 @@ for proof in $proofs; do
|
||||
fi
|
||||
done
|
||||
done
|
||||
exit
|
||||
|
||||
|
||||
cargo run --release --bin gen_risc0_images > risc0_images/src/lib.rs.new
|
||||
|
||||
while ! cmp -s risc0_images/src/lib.rs.new risc0_images/src/lib.rs
|
||||
do
|
||||
echo "FOLLOWING PROOF IDS HAVE CHANGED:"
|
||||
diff risc0_images/src/lib.rs.new risc0_images/src/lib.rs | rg '_ID' | grep "^<" | while read line; do id=$(echo "$line" | grep -o "[A-Z_]*_ID"); if [ -n "$id" ]; then hash=$(echo -n "$line" | sha256sum | cut -d" " -f1); echo " - $id ${hash:0:5}"; fi; done
|
||||
|
||||
echo "FOLLOWING PROOF ELFS HAVE CHANGED:"
|
||||
diff risc0_images/src/lib.rs.new risc0_images/src/lib.rs | rg '_ELF' | grep "^<" | while read line; do elf=$(echo "$line" | grep -o "[A-Z_]*_ELF"); if [ -n "$elf" ]; then hash=$(echo -n "$line" | sha256sum | cut -d" " -f1); echo " - $elf ${hash:0:5}"; fi; done
|
||||
|
||||
|
||||
mv risc0_images/src/lib.rs.new risc0_images/src/lib.rs
|
||||
cargo run --release --bin gen_risc0_images > risc0_images/src/lib.rs.new
|
||||
echo "-------- FINISHED UPDATE ITERATION --------"
|
||||
done
|
||||
|
||||
rm risc0_images/src/lib.rs.new
|
||||
|
||||
cargo test -p risc0_images_police
|
||||
|
||||
@ -6,7 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
cl = { path = "../cl" }
|
||||
ledger_proof_statements = { path = "../ledger_proof_statements" }
|
||||
risc0_images = { path = "../risc0_images", features = ["all"]}
|
||||
risc0_images = { path = "../risc0_images", features = ["elf"]}
|
||||
risc0-zkvm = { version = "1.0", features = ["prove", "metal"] }
|
||||
risc0-groth16 = { version = "1.0" }
|
||||
rand = "0.8.5"
|
||||
|
||||
@ -10,7 +10,7 @@ risc0-zkvm = { version = "1.0", default-features = false, features = ['std'] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
cl = { path = "../../cl" }
|
||||
ledger_proof_statements = { path = "../../ledger_proof_statements" }
|
||||
risc0_images = { path = "../../risc0_images", features = ["nomos_mantle_bundle_risc0_proof"] }
|
||||
risc0_images = { path = "../../risc0_images" }
|
||||
hex = "0.4"
|
||||
|
||||
[patch.crates-io]
|
||||
|
||||
@ -5,13 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
binary_macros = "1.0.0"
|
||||
hex = "0.4"
|
||||
lazy_static = "1.5.0"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
all = ["nomos_mantle_tx_risc0_proof", "nomos_mantle_risc0_proofs", "nomos_mantle_bundle_risc0_proof", "ledger_validity_proof", "elf"]
|
||||
nomos_mantle_tx_risc0_proof = []
|
||||
nomos_mantle_risc0_proofs = []
|
||||
nomos_mantle_bundle_risc0_proof = []
|
||||
ledger_validity_proof = []
|
||||
elf = []
|
||||
@ -1,24 +1,18 @@
|
||||
// TODO: remove hex and lazy_static dependencies
|
||||
|
||||
#[cfg(feature = "nomos_mantle_risc0_proofs")]
|
||||
pub mod nomos_mantle_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");
|
||||
}
|
||||
#[cfg(feature = "nomos_mantle_bundle_risc0_proof")]
|
||||
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");
|
||||
}
|
||||
#[cfg(feature = "nomos_mantle_tx_risc0_proof")]
|
||||
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");
|
||||
}
|
||||
#[cfg(feature = "ledger_validity_proof")]
|
||||
pub mod ledger_validity_proof {
|
||||
pub static LEDGER_ID: &str = include_str!("LEDGER_ID");
|
||||
#[cfg(feature = "elf")]
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
[package]
|
||||
name = "risc0_images_police"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
[dependencies]
|
||||
sha2 = "0.10"
|
||||
base64 = "0.22"
|
||||
risc0_images = { path = "../risc0_images" }
|
||||
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" }
|
||||
@ -1,28 +0,0 @@
|
||||
use base64::prelude::*;
|
||||
|
||||
macro_rules! gen_risc0_image {
|
||||
($module:ident, $id:ident, $elf:ident) => {
|
||||
println!("#[cfg(feature=\"{}\")]", stringify!($module));
|
||||
println!("pub mod {} {{", stringify!($module));
|
||||
println!(
|
||||
" pub const {}: [u32; 8] = {:?};",
|
||||
stringify!($id),
|
||||
$module::$id
|
||||
);
|
||||
|
||||
println!("#[cfg(feature=\"elf\")]");
|
||||
println!(
|
||||
" pub static {}: &[u8] = binary_macros::base64!({:?});",
|
||||
stringify!($elf),
|
||||
BASE64_STANDARD.encode(&$module::$elf)
|
||||
);
|
||||
println!("}}");
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
gen_risc0_image!(nomos_mantle_risc0_proofs, STF_NOP_ID, STF_NOP_ELF);
|
||||
gen_risc0_image!(nomos_mantle_bundle_risc0_proof, BUNDLE_ID, BUNDLE_ELF);
|
||||
gen_risc0_image!(nomos_mantle_tx_risc0_proof, TX_ID, TX_ELF);
|
||||
gen_risc0_image!(ledger_validity_proof, LEDGER_ID, LEDGER_ELF);
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
fn hash(x: impl AsRef<[u8]>) -> [u8; 32] {
|
||||
use sha2::{Digest, Sha256};
|
||||
Sha256::digest(x).into()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_images_are_correct() {
|
||||
assert_eq!(
|
||||
risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ID,
|
||||
nomos_mantle_risc0_proofs::STF_NOP_ID,
|
||||
"STF_NOP_ID"
|
||||
);
|
||||
assert_eq!(
|
||||
hash(risc0_images::nomos_mantle_risc0_proofs::STF_NOP_ELF),
|
||||
hash(nomos_mantle_risc0_proofs::STF_NOP_ELF),
|
||||
"STF_NOP_ELF"
|
||||
);
|
||||
assert_eq!(
|
||||
risc0_images::nomos_mantle_bundle_risc0_proof::BUNDLE_ID,
|
||||
nomos_mantle_bundle_risc0_proof::BUNDLE_ID,
|
||||
"BUNDLE_ID"
|
||||
);
|
||||
assert_eq!(
|
||||
hash(risc0_images::nomos_mantle_bundle_risc0_proof::BUNDLE_ELF),
|
||||
hash(nomos_mantle_bundle_risc0_proof::BUNDLE_ELF),
|
||||
"BUNDLE_ELF"
|
||||
);
|
||||
assert_eq!(
|
||||
risc0_images::nomos_mantle_tx_risc0_proof::TX_ID,
|
||||
nomos_mantle_tx_risc0_proof::TX_ID,
|
||||
"TX_ID"
|
||||
);
|
||||
assert_eq!(
|
||||
hash(risc0_images::nomos_mantle_tx_risc0_proof::TX_ELF),
|
||||
hash(nomos_mantle_tx_risc0_proof::TX_ELF),
|
||||
"TX_ELF"
|
||||
);
|
||||
assert_eq!(
|
||||
risc0_images::ledger_validity_proof::LEDGER_ID,
|
||||
ledger_validity_proof::LEDGER_ID,
|
||||
"LEDGER_ID"
|
||||
);
|
||||
assert_eq!(
|
||||
hash(risc0_images::ledger_validity_proof::LEDGER_ELF),
|
||||
hash(ledger_validity_proof::LEDGER_ELF),
|
||||
"LEDGER_ELF"
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user