Skip to content
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

WEB3-254: Remove dependencies of set-builder-guest to allow publishing to crates.io #354

Merged
merged 6 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ jobs:
env:
RISC0_SKIP_BUILD: true,
RISC0_SKIP_BUILD_KERNEL: true,
- run: forge doc
# TODO(#355) Re-enable this check.
#- run: forge doc

# Run as a separate job because we need to install a different set of tools.
# In particular, it uses nightly Rust and _does not_ install Forge or cargo risczero.
Expand Down
7 changes: 5 additions & 2 deletions aggregation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[package]
name = "risc0-aggregation"
description = "Proof aggregation for RISC Zero"
resolver = "2"
version = "0.1.0-alpha.1"
edition = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }

Expand All @@ -13,7 +15,8 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
alloy-primitives = { workspace = true }
alloy-sol-types = { workspace = true }
guest-set-builder = { path = "./guest", optional = true }
# TODO(#353) Determine if it is possible to publish risc0-aggregation with set builder image ID and ELF
#guest-set-builder = { version = "0.1.0", path = "./guest", optional = true }
hex = { workspace = true }
risc0-binfmt = { workspace = true }
risc0-zkp = { workspace = true }
Expand All @@ -27,4 +30,4 @@ tokio = { workspace = true, features = ["rt-multi-thread"] }

[features]
default = ["verify"]
verify = ["dep:guest-set-builder"]
verify = []
4 changes: 2 additions & 2 deletions aggregation/guest/set-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "set-builder"
version = "0.1.0"
version = "0.1.0-alpha.1"
edition = "2021"

[workspace]

[dependencies]
risc0-aggregation = { path = "../..", default-features = false }
risc0-aggregation = { version = "0.1.0-alpha.1", path = "../..", default-features = false }
risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false, features = ["std"] }
7 changes: 5 additions & 2 deletions aggregation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ mod receipt;
#[cfg(feature = "verify")]
pub use receipt::{
EncodingError, RecursionVerifierParamters, SetInclusionReceipt,
SetInclusionReceiptVerifierParameters, VerificationError, SET_BUILDER_ELF, SET_BUILDER_ID,
SET_BUILDER_PATH,
SetInclusionReceiptVerifierParameters,
VerificationError,
/* TODO(#353)
SET_BUILDER_ELF, SET_BUILDER_ID, SET_BUILDER_PATH,
*/
};

alloy_sol_types::sol! {
Expand Down
26 changes: 22 additions & 4 deletions aggregation/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ use serde::{Deserialize, Serialize};

use crate::{merkle_path_root, GuestOutput, Seal};

pub use guest_set_builder::{SET_BUILDER_ELF, SET_BUILDER_ID, SET_BUILDER_PATH};
// TODO(#353)
//pub use guest_set_builder::{SET_BUILDER_ELF, SET_BUILDER_ID, SET_BUILDER_PATH};

/// A receipt for a claim that is part of a set of verified claims (i.e. an aggregation).
#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down Expand Up @@ -97,18 +98,31 @@ impl<Claim> SetInclusionReceipt<Claim>
where
Claim: Digestible + Clone + Serialize,
{
/* TODO(#353)
/// Construct a [SetInclusionReceipt] with the given Merkle inclusion path and claim.
///
/// Path should contain all sibling nodes in the tree from the leaf to the root. Note that the
/// path does not include the leaf or the root itself. Resulting receipt will have default
/// verifier parameters and no root receipt.
pub fn from_path(claim: impl Into<MaybePruned<Claim>>, merkle_path: Vec<Digest>) -> Self {
pub fn from_path(claim: impl Into<MaybePruned<Claim>>, merkle_path: Vec<Digest>);
}
*/

/// Construct a [SetInclusionReceipt] with the given Merkle inclusion path and claim.
///
/// Path should contain all sibling nodes in the tree from the leaf to the root. Note that the
/// path does not include the leaf or the root itself. Resulting receipt will have the given
/// verifier parameter digest and no root receipt.
pub fn from_path_with_verifier_params(
claim: impl Into<MaybePruned<Claim>>,
merkle_path: Vec<Digest>,
verifier_parameters: impl Into<Digest>,
) -> Self {
Self {
claim: claim.into(),
root: None,
merkle_path,
verifier_parameters: SetInclusionReceiptVerifierParameters::default()
.digest::<sha::Impl>(),
verifier_parameters: verifier_parameters.into(),
}
}

Expand All @@ -131,6 +145,7 @@ where
Self { root: None, ..self }
}

/* TODO(#353)
/// Verify the integrity of this receipt, ensuring the claim is attested to by the seal.
pub fn verify_integrity(&self) -> Result<(), VerificationError> {
self.verify_integrity_with_context(
Expand All @@ -139,6 +154,7 @@ where
Some(RecursionVerifierParamters::default()),
)
}
*/

/// Verify the integrity of this receipt, ensuring the claim is attested to by the seal.
// TODO: Use a different error type (e.g. the one from risc0-zkvm).
Expand Down Expand Up @@ -250,6 +266,7 @@ impl Digestible for SetInclusionReceiptVerifierParameters {
}
}

/* TODO(#353)
impl Default for SetInclusionReceiptVerifierParameters {
/// Default set of parameters used to verify a
/// [SetInclusionReceipt][super::SetInclusionReceipt].
Expand All @@ -259,6 +276,7 @@ impl Default for SetInclusionReceiptVerifierParameters {
}
}
}
*/

// TODO(victor): Move this into risc0-zkvm?
/// Verifier parameters used for recursive verification (e.g. via env::verify) of receipts.
Expand Down
Loading