Skip to content

BM-1469: Support ClaimDigestMatch predicate and integrate Bltvm2 compatible blake3 compression type #1002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 34 commits into
base: ec2/claim-digest
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
28cf40e
point bonsai sdk to shrink-bitvm2 branch
ec2 Aug 1, 2025
78e786b
implement shrink methods on Prover trait
ec2 Aug 1, 2025
f344330
selector
ec2 Aug 1, 2025
00572d1
Merge branch 'main' into ec2/bitvm
ec2 Aug 4, 2025
7dd797c
Add flag in Filfillment solidity struct to indicate is imageId is cla…
ec2 Aug 4, 2025
85e5d25
Merge branch 'angelo/claim-digest' into ec2/bitvm
ec2 Aug 4, 2025
131f7ea
add to deploy
ec2 Aug 4, 2025
82074f8
with_shrink_bitvm2_proof
ec2 Aug 5, 2025
5b1da5c
debug logging
ec2 Aug 5, 2025
553e17f
i think it works?
ec2 Aug 6, 2025
608021f
add test, but it fails
ec2 Aug 6, 2025
5ee26d8
work-ish
ec2 Aug 6, 2025
1eac4b3
Ok things work. But how do we enforce guests to hash journal?
ec2 Aug 6, 2025
edc3a8b
fulfil test
ec2 Aug 6, 2025
5ef81c4
move shrink bitvm2 in separate crate
ec2 Aug 6, 2025
0acf554
complete some todos in boundless cli
ec2 Aug 6, 2025
3f8701e
enforce 32byte journal if shrink bitvm2
ec2 Aug 6, 2025
232028e
bitvm2 contract deploy test-utils
ec2 Aug 6, 2025
9e91f85
fix submit batch claim digest for shrink bvm2
ec2 Aug 7, 2025
8ac0398
test-utils deploy bvm2 verifier
ec2 Aug 7, 2025
0513cba
should work with example now
ec2 Aug 7, 2025
adc5aa6
example should work
ec2 Aug 7, 2025
495c51f
submitter: use claim digest provided in the predicate
ec2 Aug 7, 2025
3ff03e7
some comments
ec2 Aug 11, 2025
f5ffd54
Merge branch 'ec2/claim-digest' into ec2/bitvm
ec2 Aug 12, 2025
c3fa6f8
update bytecode
ec2 Aug 12, 2025
7d42ffe
Merge branch 'ec2/claim-digest' into ec2/bitvm
ec2 Aug 12, 2025
a1c45df
modify counter example because claim digest match doesnt support call…
ec2 Aug 12, 2025
fc2bcac
Merge branch 'ec2/claim-digest' into ec2/bitvm
ec2 Aug 13, 2025
f051834
skip finalizer predicate check
ec2 Aug 13, 2025
267b93d
Merge branch 'ec2/claim-digest' into ec2/bitvm
ec2 Aug 13, 2025
03aab22
Merge branch 'ec2/claim-digest' into ec2/bitvm
ec2 Aug 13, 2025
3dd55ef
fix boundless cli test
ec2 Aug 13, 2025
586162d
ShrinkReceiptClaim type
ec2 Aug 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 103 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ members = [
"crates/indexer",
"crates/ops-lambdas/indexer-monitor",
"crates/order-generator",
"crates/order-stream",
"crates/order-stream", "crates/shrink_bitvm2",
"crates/slasher",
"documentation/doc-test",
]
Expand All @@ -34,6 +34,7 @@ distributor = { path = "crates/distributor" }
guest-assessor = { path = "crates/guest/assessor" }
guest-util = { path = "crates/guest/util" }
order-stream = { path = "crates/order-stream" }
shrink_bitvm2 = { path = "crates/shrink_bitvm2" }

async-stream = "0.3"
alloy = { version = "1.0.24", default-features = false }
Expand All @@ -47,7 +48,7 @@ aws-sdk-s3 = "1.34" # used for minio for max compatibility
axum = "0.8"
axum-extra = { version = "0.10" }
bincode = "1.3"
bonsai-sdk = { version = "1.4", features = ["non_blocking"] }
bonsai-sdk = { git = "https://github.com/risc0/risc0", branch = "flaub/shrink-bitvm2", features = ["non_blocking", "shrink_bitvm2"] }
bs58 = "0.5"
bytemuck = "1.16"
clap = { version = "4.5", features = ["derive", "env"] }
Expand Down Expand Up @@ -97,3 +98,6 @@ lto = true
# [profile.release]
# lto = "fat"
# codegen-units = 1

[patch.crates-io]
risc0-ethereum-contracts = { path = "/home/etu/risc0-ethereum/contracts" }
11 changes: 11 additions & 0 deletions contracts/scripts/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import "forge-std/Test.sol";
import {IRiscZeroSelectable} from "risc0/IRiscZeroSelectable.sol";
import {IRiscZeroVerifier} from "risc0/IRiscZeroVerifier.sol";
import {ControlID, RiscZeroGroth16Verifier} from "risc0/groth16/RiscZeroGroth16Verifier.sol";
import {RiscZeroBitvm2Groth16Verifier} from "risc0/bitvm/RiscZeroBitvm2Groth16Verifier.sol";
import {RiscZeroSetVerifier} from "risc0/RiscZeroSetVerifier.sol";
import {RiscZeroVerifierRouter} from "risc0/RiscZeroVerifierRouter.sol";
import {RiscZeroCheats} from "risc0/test/RiscZeroCheats.sol";
Expand Down Expand Up @@ -66,6 +67,16 @@ contract Deploy is Script, RiscZeroCheats {
IRiscZeroSelectable selectable = IRiscZeroSelectable(address(_verifier));
bytes4 selector = selectable.SELECTOR();
verifierRouter.addVerifier(selector, _verifier);
console2.log("Added Groth16 verifier to router with selector");
console2.logBytes4(selector);


IRiscZeroVerifier _bitvm2_verifier = deployRiscZeroBitvm2Verifier();
IRiscZeroSelectable bitvm2_selectable = IRiscZeroSelectable(address(_bitvm2_verifier));
bytes4 bitvm_selector = bitvm2_selectable.SELECTOR();
verifierRouter.addVerifier(bitvm_selector, _bitvm2_verifier);
console2.log("Added BitVM2 verifier to router with selector");
console2.logBytes4(bitvm_selector);

// TODO: Create a more robust way of getting a URI for guests, and ensure that it is
// in-sync with the configured image ID.
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/BoundlessMarket.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
ReceiptClaimLib,
VerificationFailed
} from "risc0/IRiscZeroVerifier.sol";
import {TestReceipt} from "risc0/../test/TestReceipt.sol";
import {TestReceipt} from "risc0/../test/TestReceiptV2_1.sol";
import {RiscZeroMockVerifier} from "risc0/test/RiscZeroMockVerifier.sol";
import {TestUtils} from "./TestUtils.sol";
import {Client} from "./clients/Client.sol";
Expand Down
6 changes: 5 additions & 1 deletion crates/boundless-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ serde = { workspace = true }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
shadow-rs = { version = "1.1", default-features = false }
shrink_bitvm2 = { workspace = true }
sqlx = { workspace = true, features = ["postgres", "runtime-tokio", "tls-rustls", "chrono"] }
tempfile = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
Expand All @@ -53,9 +55,11 @@ order-stream = { workspace = true }
sqlx = { workspace = true, features = ["postgres", "runtime-tokio", "tls-rustls", "chrono"] }
tempfile = { workspace = true }
tracing-test = { workspace = true }
test-log = { workspace = true }
shrink_bitvm2 = { workspace = true }

[features]
# Enables the prove feature on risc0-zkvm to build the prover directly into this CLI.
prove = ["risc0-zkvm/prove"]
# Enables the cuda feature on risc0-zkvm to build the prover directly into this CLI, with CUDA support.
cuda = ["prove", "risc0-zkvm/cuda"]
cuda = ["prove", "risc0-zkvm/cuda"]
11 changes: 10 additions & 1 deletion crates/boundless-cli/src/bin/boundless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ use boundless_market::{
},
input::GuestEnv,
request_builder::{OfferParams, RequirementParams},
selector::ProofType,
selector::{is_shrink_bitvm2_selector, ProofType},
storage::{fetch_url, StorageProvider, StorageProviderConfig},
Client, Deployment, StandardClient,
};
Expand Down Expand Up @@ -1103,6 +1103,7 @@ async fn submit_offer(client: StandardClient, args: &SubmitOfferArgs) -> Result<
ProofType::Inclusion => requirements.selector(Selector::SetVerifierV0_7 as u32),
ProofType::Groth16 => requirements.selector(Selector::Groth16V2_2 as u32),
ProofType::Any => &mut requirements,
ProofType::ShrinkBitvm2 => requirements.selector(Selector::ShrinkBitvm2V0_1 as u32),
ty => bail!("unsupported proof type provided in proof-type flag: {:?}", ty),
};
let request = request.with_requirements(requirements);
Expand Down Expand Up @@ -1211,6 +1212,14 @@ where
// hex::encode(&request.requirements.predicate.data)
// );

// TODO(ec2): fixme
// if is_shrink_bitvm2_selector(request.requirements.selector) && journal.len() != 32 {
// bail!(
// "Preflight failed: Journal must be exactly 32 bytes for Shrink Bitvm2, got {} bytes",
// journal.len()
// );
// }

tracing::info!("Preflight check passed");
} else {
tracing::warn!("Skipping preflight check");
Expand Down
Loading