Skip to content

Commit 50fd9e3

Browse files
nuke-web3nategraf
andauthored
BM-136: Rename "aggregation set" guest to "set builder" (github#21)
Fixes https://linear.app/risczero/issue/BM-136/rename-aggregation-set-guest-to-set-builder Co-authored-by: Victor Graf <[email protected]>
1 parent 6fef8f0 commit 50fd9e3

File tree

32 files changed

+258
-203
lines changed

32 files changed

+258
-203
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ target/
1919
.idea
2020

2121
# Ignore generated files
22-
contracts/src/AggregationSetImageID.sol
22+
contracts/src/SetBuilderImageID.sol
2323
contracts/src/AssessorImageID.sol
2424
contracts/src/EchoImageID.sol
2525
contracts/src/ResolveImageID.sol
2626
contracts/src/UtilImageID.sol
27-
contracts/test/AggregationSetElf.sol
27+
contracts/test/SetBuilderElf.sol
2828
contracts/test/AssessorElf.sol
2929
contracts/test/EchoElf.sol
3030
contracts/test/ResolveElf.sol

Cargo.lock

Lines changed: 25 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ members = [
77
"crates/bento-client",
88
"crates/boundless-market",
99
"crates/broker",
10-
"crates/guest/aggregation-set",
1110
"crates/guest/assessor",
11+
"crates/guest/set-builder",
1212
"crates/guest/util",
1313
"crates/taskdb",
1414
"crates/workflow",
@@ -20,7 +20,7 @@ aggregation-set = { path = "crates/aggregation-set" }
2020
assessor = { path = "crates/assessor" }
2121
bento-client = { path = "crates/bento-client" }
2222
boundless-market = { path = "crates/boundless-market" }
23-
guest-aggregation-set = { path = "crates/guest/aggregation-set" }
23+
guest-set-builder = { path = "crates/guest/set-builder" }
2424
guest-assessor = { path = "crates/guest/assessor" }
2525
guest-util = { path = "crates/guest/util" }
2626
taskdb = { path = "crates/taskdb" }

broker.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ max_file_size = 50_000_000
1313
status_poll_ms = 1000
1414
bonsai_r0_zkvm_ver = "1.1.1"
1515
req_retry_count = 3
16-
agg_set_guest_path = "./target/riscv-guest/riscv32im-risc0-zkvm-elf/release/aggregation-set-guest"
16+
set_builder_guest_path = "./target/riscv-guest/riscv32im-risc0-zkvm-elf/release/set-builder-guest"
1717
assessor_set_guest_path = "./target/riscv-guest/riscv32im-risc0-zkvm-elf/release/assessor-guest"
1818

1919
[batcher]

contracts/scripts/Deploy.s.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {RiscZeroSetVerifier} from "../src/RiscZeroSetVerifier.sol";
1414

1515
// For local testing:
1616
import {ImageID as AssesorImgId} from "../src/AssessorImageID.sol";
17-
import {ImageID as AggImgId} from "../src/AggregationSetImageID.sol";
17+
import {ImageID as SetBuidlerId} from "../src/SetBuilderImageID.sol";
1818

1919
contract Deploy is Script, RiscZeroCheats {
2020
function run() external {
@@ -33,7 +33,7 @@ contract Deploy is Script, RiscZeroCheats {
3333
setBuilderGuestUrl = string.concat(
3434
"file://",
3535
cwd,
36-
"/target/riscv-guest/riscv32im-risc0-zkvm-elf/release/aggregation-set-guest"
36+
"/target/riscv-guest/riscv32im-risc0-zkvm-elf/release/set-builder-guest"
3737
);
3838
console2.log("Set builder URI", setBuilderGuestUrl);
3939
assessorGuestUrl = string.concat(
@@ -44,7 +44,7 @@ contract Deploy is Script, RiscZeroCheats {
4444
console2.log("Assessor URI", assessorGuestUrl);
4545
}
4646

47-
RiscZeroSetVerifier setVerifier = new RiscZeroSetVerifier(verifier, AggImgId.AGGREGATION_SET_GUEST_ID, setBuilderGuestUrl);
47+
RiscZeroSetVerifier setVerifier = new RiscZeroSetVerifier(verifier, SetBuidlerId.SET_BUILDER_GUEST_ID, setBuilderGuestUrl);
4848
console2.log("Deployed SetVerifier to,", address(setVerifier));
4949

5050
ProofMarket market = new ProofMarket(setVerifier, AssesorImgId.ASSESSOR_GUEST_ID, assessorGuestUrl);

contracts/src/IRiscZeroSetVerifier.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ interface IRiscZeroSetVerifier is IRiscZeroVerifier {
2626
/// Returns whether `root` has been submitted.
2727
function containsRoot(bytes32 root) external view returns (bool);
2828

29-
/// Returns the aggregator imageId and its url.
29+
/// Returns the set builder imageId and its url.
3030
function imageInfo() external view returns (bytes32, string memory);
3131
}

crates/aggregation-set/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
alloy-primitives = { workspace = true }
88
alloy-sol-types = { workspace = true }
99
anyhow = { workspace = true }
10-
guest-aggregation-set = { workspace = true, optional = true }
10+
guest-set-builder = { workspace = true, optional = true }
1111
hex = { workspace = true }
1212
risc0-binfmt = { workspace = true }
1313
risc0-zkvm = { workspace = true }
@@ -19,4 +19,4 @@ tokio = { workspace = true, features = ["rt-multi-thread"] }
1919

2020
[features]
2121
default = ["verify"]
22-
verify = ["dep:guest-aggregation-set"]
22+
verify = ["dep:guest-set-builder"]

crates/aggregation-set/src/lib.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ where
132132
if root_receipt.claim()?.digest::<sha::Impl>()
133133
!= expected_root_claim.digest::<sha::Impl>()
134134
{
135-
bail!("root receipt claim does not match expected aggregation set builder claim: {:#?} != {:#?}", root_receipt.claim()?, expected_root_claim);
135+
bail!(
136+
"root receipt claim does not match expected set builder claim: {:#?} != {:#?}",
137+
root_receipt.claim()?,
138+
expected_root_claim
139+
);
136140
}
137141
return Ok(());
138142
}
@@ -211,14 +215,15 @@ impl Digestible for SetInclusionReceiptVerifierParameters {
211215
#[cfg(feature = "verify")]
212216
mod verify {
213217
use super::SetInclusionReceiptVerifierParameters;
214-
pub use guest_aggregation_set::{
215-
AGGREGATION_SET_GUEST_ELF, AGGREGATION_SET_GUEST_ID, AGGREGATION_SET_GUEST_PATH,
218+
pub use guest_set_builder::{
219+
SET_BUILDER_GUEST_ELF, SET_BUILDER_GUEST_ID, SET_BUILDER_GUEST_PATH,
216220
};
217221

218222
impl Default for SetInclusionReceiptVerifierParameters {
219-
/// Default set of parameters used to verify a [SetInclusionReceipt][super::SetInclusionReceipt].
223+
/// Default set of parameters used to verify a
224+
/// [SetInclusionReceipt][super::SetInclusionReceipt].
220225
fn default() -> Self {
221-
Self { image_id: AGGREGATION_SET_GUEST_ID.into() }
226+
Self { image_id: SET_BUILDER_GUEST_ID.into() }
222227
}
223228
}
224229
}
@@ -236,7 +241,7 @@ pub struct RecursionVerifierParamters {
236241
pub control_root: Option<Digest>,
237242
}
238243

239-
/// Input of the aggregation set guest.
244+
/// Input of the aggregation set builder guest.
240245
#[derive(Clone, Debug, Deserialize, Serialize)]
241246
pub enum GuestInput {
242247
/// Input is a leaf of the Merkle tree.
@@ -348,7 +353,7 @@ fn commutative_keccak256(a: &Digest, b: &Digest) -> Digest {
348353
}
349354

350355
alloy_sol_types::sol! {
351-
/// Journal output of aggregation set guest.
356+
/// Journal output of aggregation set builder guest.
352357
#[sol(all_derives)]
353358
struct GuestOutput {
354359
/// Image ID used to verify the assumptions.

crates/assessor/src/lib.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use risc0_zkvm::{sha::Digest, ReceiptClaim};
1010
use serde::{Deserialize, Serialize};
1111

1212
/// Fulfillment contains a signed request, including offer and requirements,
13-
/// that the prover has completed, and the journal
14-
/// committed (via ReceiptClaim) into the Merkle tree of the aggregation set builder.
13+
/// that the prover has completed, and the journal committed
14+
/// into the Merkle tree of the aggregated set of proofs.
1515
#[derive(Clone, Debug, Deserialize, Serialize)]
1616
pub struct Fulfillment {
1717
pub request: ProvingRequest,
@@ -70,9 +70,7 @@ impl AssessorInput {
7070
#[cfg(test)]
7171
mod tests {
7272
use super::*;
73-
use aggregation_set::{
74-
GuestInput, GuestOutput, AGGREGATION_SET_GUEST_ELF, AGGREGATION_SET_GUEST_ID,
75-
};
73+
use aggregation_set::{GuestInput, GuestOutput, SET_BUILDER_GUEST_ELF, SET_BUILDER_GUEST_ID};
7674
use alloy::{
7775
primitives::{aliases::U96, Address, B256},
7876
signers::local::PrivateKeySigner,
@@ -179,7 +177,7 @@ mod tests {
179177
fn singleton(assumption: Receipt) -> Receipt {
180178
let claim = assumption.claim().unwrap().value().unwrap();
181179
let guest_input = GuestInput::Singleton {
182-
self_image_id: Digest::from(AGGREGATION_SET_GUEST_ID),
180+
self_image_id: Digest::from(SET_BUILDER_GUEST_ID),
183181
claim: claim.clone(),
184182
};
185183
let env = ExecutorEnv::builder()
@@ -188,15 +186,15 @@ mod tests {
188186
.add_assumption(assumption)
189187
.build()
190188
.unwrap();
191-
let session = default_executor().execute(env, AGGREGATION_SET_GUEST_ELF).unwrap();
189+
let session = default_executor().execute(env, SET_BUILDER_GUEST_ELF).unwrap();
192190
assert_eq!(session.exit_code, ExitCode::Halted(0));
193191
let journal = &session.journal.bytes;
194192
let guest_output = GuestOutput::abi_decode(journal, true).unwrap();
195-
assert_eq!(guest_output.image_id(), Digest::from(AGGREGATION_SET_GUEST_ID));
193+
assert_eq!(guest_output.image_id(), Digest::from(SET_BUILDER_GUEST_ID));
196194
assert_eq!(guest_output.root(), claim.digest());
197195
Receipt::new(
198196
InnerReceipt::Fake(FakeReceipt::new(ReceiptClaim::ok(
199-
AGGREGATION_SET_GUEST_ID,
197+
SET_BUILDER_GUEST_ID,
200198
MaybePruned::Pruned(journal.digest()),
201199
))),
202200
journal.clone(),
@@ -210,7 +208,7 @@ mod tests {
210208
let guest_output_right = GuestOutput::abi_decode(&journal_right, true).unwrap();
211209

212210
let guest_input = GuestInput::Join {
213-
self_image_id: Digest::from(AGGREGATION_SET_GUEST_ID),
211+
self_image_id: Digest::from(SET_BUILDER_GUEST_ID),
214212
left_set_root: guest_output_left.root(),
215213
right_set_root: guest_output_right.root(),
216214
};
@@ -221,15 +219,15 @@ mod tests {
221219
.add_assumption(right)
222220
.build()
223221
.unwrap();
224-
let session = default_executor().execute(env, AGGREGATION_SET_GUEST_ELF).unwrap();
222+
let session = default_executor().execute(env, SET_BUILDER_GUEST_ELF).unwrap();
225223
assert_eq!(session.exit_code, ExitCode::Halted(0));
226224
let journal = &session.journal.bytes;
227225

228226
let guest_output = GuestOutput::abi_decode(journal, true).unwrap();
229-
assert_eq!(guest_output.image_id(), Digest::from(AGGREGATION_SET_GUEST_ID));
227+
assert_eq!(guest_output.image_id(), Digest::from(SET_BUILDER_GUEST_ID));
230228
Receipt::new(
231229
InnerReceipt::Fake(FakeReceipt::new(ReceiptClaim::ok(
232-
AGGREGATION_SET_GUEST_ID,
230+
SET_BUILDER_GUEST_ID,
233231
MaybePruned::Pruned(journal.digest()),
234232
))),
235233
journal.clone(),

crates/boundless-market/src/contracts/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ pub fn encode_seal(receipt: &risc0_zkvm::Receipt) -> anyhow::Result<Vec<u8>> {
436436

437437
#[cfg(feature = "test-utils")]
438438
pub mod test_utils {
439-
use aggregation_set::AGGREGATION_SET_GUEST_ID;
439+
use aggregation_set::SET_BUILDER_GUEST_ID;
440440
use alloy::{
441441
network::{Ethereum, EthereumWallet},
442442
node_bindings::AnvilInstance,
@@ -519,7 +519,7 @@ pub mod test_utils {
519519
let set_verifier = SetVerifier::deploy(
520520
&deployer_provider,
521521
*verifier.address(),
522-
<[u8; 32]>::from(Digest::from(AGGREGATION_SET_GUEST_ID)).into(),
522+
<[u8; 32]>::from(Digest::from(SET_BUILDER_GUEST_ID)).into(),
523523
String::new(),
524524
)
525525
.await

0 commit comments

Comments
 (0)