Skip to content

Commit

Permalink
refactor: update workspace structure and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aoengin committed Feb 28, 2025
1 parent 95ea1e9 commit ed6aadd
Show file tree
Hide file tree
Showing 11 changed files with 1,354 additions and 73 deletions.
1,400 changes: 1,340 additions & 60 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
resolver = "2"
members = [
"core",
"circuits-lib",
"risc0-circuits/bridge-circuit",
"risc0-circuits/work-only",
] # Add "risc0-circuits/operator", "risc0-circuits/watchtower" later

[workspace.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion bridge-circuit-host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const UTXOS_STORAGE_INDEX: [u8; 32] =
const DEPOSIT_MAPPING_STORAGE_INDEX: [u8; 32] =
hex_literal::hex!("0000000000000000000000000000000000000000000000000000000000000027");
const TX_ID: [u8; 32] =
hex_literal::hex!("9D49DF2E8207286DBBBD8644FC9A07DD5E1033608AAC31F797DCECCA0F74FB8F");
hex_literal::hex!("BB25103468A467382ED9F585129AD40331B54425155D6F0FAE8C799391EE2E7F");

const LIGHT_CLIENT_PROVER_URL: &str = "https://light-client-prover.testnet.citrea.xyz/";
const CITREA_TESTNET_RPC: &str = "https://rpc.testnet.citrea.xyz/";
Expand Down
4 changes: 2 additions & 2 deletions bridge-circuit-host/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async fn main() {
let pub_key: Vec<[u8; 20]> = generate_public_key(&params, &secret_key);
let signature = sign_digits(&params, &secret_key, &compressed_proof_and_total_work);

let l1_hegith = 71610;
let l1_hegith = 72041;
let (light_client_proof, lcp_receipt) = fetch_light_client_proof(l1_hegith).await.unwrap();

let storage_proof = fetch_storage_proof(&"latest".to_string()).await;
Expand All @@ -103,7 +103,7 @@ async fn main() {
.iter()
.map(|tx| tx.compute_txid().as_raw_hash().to_byte_array())
.collect();
let mmr_inclusion_proof = mmr_native.generate_proof(47029);
let mmr_inclusion_proof = mmr_native.generate_proof(72041);
let block_47029_mt = BitcoinMerkleTree::new(block_47029_txids);
let payout_tx_proof = block_47029_mt.generate_proof(15); // 16th tx

Expand Down
5 changes: 3 additions & 2 deletions build-files/bridge_circuit_build.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ COPY risc0-circuits/bridge-circuit risc0-circuits/bridge-circuit
# Might be heavy in the future, but for now it's fine
COPY circuits-lib circuits-lib

COPY Cargo.toml Cargo.toml

# Set compile-time environment variables
ENV CARGO_MANIFEST_PATH="risc0-circuits/bridge-circuit/guest/Cargo.toml"
ENV CARGO_MANIFEST_PATH="/src/risc0-circuits/bridge-circuit/guest/Cargo.toml"
ENV RUSTFLAGS="-C passes=loweratomic -C link-arg=-Ttext=0x00200800 -C link-arg=--fatal-warnings"
ENV CARGO_TARGET_DIR="risc0-circuits/bridge-circuit/guest/target"
ENV CARGO_TARGET_DIR="/src/risc0-circuits/bridge-circuit/guest/target"
ENV CC_riscv32im_risc0_zkvm_elf="/root/.local/share/cargo-risczero/cpp/bin/riscv32-unknown-elf-gcc"
ENV CFLAGS_riscv32im_risc0_zkvm_elf="-march=rv32im -nostdlib"

Expand Down
2 changes: 2 additions & 0 deletions build-files/work_only_build.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ COPY risc0-circuits/work-only risc0-circuits/work-only
# Might be heavy in the future, but for now it's fine
COPY circuits-lib circuits-lib

COPY Cargo.toml Cargo.toml

# Set compile-time environment variables
ENV CARGO_MANIFEST_PATH="risc0-circuits/work-only/guest/Cargo.toml"
ENV RUSTFLAGS="-C passes=loweratomic -C link-arg=-Ttext=0x00200800 -C link-arg=--fatal-warnings"
Expand Down
2 changes: 0 additions & 2 deletions circuits-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "circuits-lib"
version = "0.1.0"
edition = "2021"

[workspace]

[dependencies]
sha2 = { version = "=0.10.8", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }
Expand Down
5 changes: 3 additions & 2 deletions circuits-lib/src/bridge_circuit/lc_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::bridge_circuit_core::structs::LightClientProof;
use risc0_zkvm::guest::env;

const LC_IMAGE_ID: [u8; 32] =
hex_literal::hex!("f9b82dad0590a31c4d58345a8d9f3865857d00b50ada1cd0234ff9bb781e36b0");
hex_literal::hex!("f0cca5b444bd9980d81bd8726c6b34e6f5da613174b5794957b1870288bdd595");

pub fn lc_proof_verifier(light_client_proof: LightClientProof) -> [u8; 32] {
env::verify(LC_IMAGE_ID, &light_client_proof.lc_journal).unwrap();
Expand All @@ -13,5 +13,6 @@ pub fn lc_proof_verifier(light_client_proof: LightClientProof) -> [u8; 32] {
panic!("Invalid light client journal");
}

light_client_proof.lc_journal[0..32].try_into().unwrap() // state root
println!("Light client journal: {:?}", light_client_proof.lc_journal);
light_client_proof.lc_journal[0..32].try_into().unwrap()
}
2 changes: 0 additions & 2 deletions risc0-circuits/bridge-circuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "bridge-circuit"
version = "0.1.0"
edition = "2021"

[workspace]

[build-dependencies]
risc0-build = { version = "1.2.3" }

Expand Down
Binary file modified risc0-circuits/elfs/testnet4-bridge-circuit-guest
Binary file not shown.
2 changes: 0 additions & 2 deletions risc0-circuits/work-only/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name = "work-only"
version = "0.1.0"
edition = "2021"

[workspace]

[build-dependencies]
risc0-build = { version = "1.2.3" }

Expand Down

0 comments on commit ed6aadd

Please sign in to comment.