Skip to content
Open
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
26 changes: 25 additions & 1 deletion Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ members = [
"crates/jolt-kernels",
"crates/jolt-prover",
"crates/jolt-verifier",
"crates/jolt-host",
"crates/jolt-equivalence",
"crates/jolt-profiling",
"crates/jolt-field",
Expand Down Expand Up @@ -396,6 +397,7 @@ bolt = { path = "./crates/bolt" }
jolt-kernels = { path = "./crates/jolt-kernels" }
jolt-prover = { path = "./crates/jolt-prover" }
jolt-verifier = { path = "./crates/jolt-verifier" }
jolt-host = { path = "./crates/jolt-host" }
jolt-equivalence = { path = "./crates/jolt-equivalence" }
jolt-riscv = { path = "./crates/jolt-riscv", default-features = false }
jolt-program = { path = "./crates/jolt-program", default-features = false }
Expand Down
22 changes: 22 additions & 0 deletions common/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ use crate::constants::{
DEFAULT_MAX_TRUSTED_ADVICE_SIZE, DEFAULT_MAX_UNTRUSTED_ADVICE_SIZE, DEFAULT_STACK_SIZE,
};

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Backend {
Legacy,
Modular,
}

pub struct Attributes {
pub wasm: bool,
pub nightly: bool,
Expand All @@ -20,6 +26,7 @@ pub struct Attributes {
pub max_untrusted_advice_size: u64,
pub max_trace_length: u64,
pub backtrace: Option<String>,
pub backend: Backend,
}

pub fn parse_attributes(attr: &Punctuated<Meta, Comma>) -> Attributes {
Expand All @@ -29,6 +36,7 @@ pub fn parse_attributes(attr: &Punctuated<Meta, Comma>) -> Attributes {
let mut nightly = false;
let mut profile: Option<String> = None;
let mut backtrace: Option<String> = None;
let mut backend = Backend::Legacy;

for meta in attr {
match meta {
Expand All @@ -53,6 +61,19 @@ pub fn parse_attributes(attr: &Punctuated<Meta, Comma>) -> Attributes {
};
profile = Some(value);
}
"backend" => {
let value = match lit {
Lit::Str(lit) => lit.value(),
_ => panic!("backend attribute expects a string literal"),
};
backend = match value.as_str() {
"legacy" => Backend::Legacy,
"modular" => Backend::Modular,
other => panic!(
"backend attribute must be \"legacy\" or \"modular\", got {other:?}"
),
};
}
_ => {
let value: u64 = match lit {
Lit::Int(lit) => lit.base10_parse().unwrap(),
Expand Down Expand Up @@ -122,5 +143,6 @@ pub fn parse_attributes(attr: &Punctuated<Meta, Comma>) -> Attributes {
max_untrusted_advice_size,
max_trace_length,
backtrace,
backend,
}
}
8 changes: 6 additions & 2 deletions crates/bolt/src/protocols/jolt/emit/rust/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,11 @@ impl<'a> SparseCommitmentInputs<'a> {
.materialize_oracle(oracle, oracle_num_vars)
.flatten()
.ok_or(CommitmentPhaseError::MissingOracle { oracle })?;
let data = into_padded_oracle(oracle, oracle_num_vars, Cow::Owned(data))?;
// Pad to layout_num_vars (not oracle_num_vars) so the row-chunked
// commitment has uniform row-count across all oracles in the batch.
// Required for `joint_opening_hint`'s `combine_hints` to produce a
// valid aggregate commitment.
let data = into_padded_oracle(oracle, layout_num_vars, Cow::Owned(data))?;
commit_with_layout(&data, layout_num_vars, prover_setup)
}
}
Expand Down Expand Up @@ -1275,7 +1279,7 @@ where
.materialize_with_num_vars(oracle, oracle_num_vars(program, oracle, plan.num_vars))
.ok_or(CommitmentPhaseError::MissingOracle { oracle })?;
let oracle_num_vars = oracle_num_vars(program, oracle, plan.num_vars);
let data = into_padded_oracle(oracle, oracle_num_vars, data)?;
let data = into_padded_oracle(oracle, plan.num_vars, data)?;
let (commitment, hint) = commit_with_layout(&data, plan.num_vars, prover_setup)?;
artifacts.records.push(CommitmentRecord {
artifact: plan.artifact,
Expand Down
6 changes: 5 additions & 1 deletion crates/bolt/src/protocols/jolt/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ impl JoltProtocolParams {
}

pub fn fixture() -> Self {
Self::new(16, 10, 16)
// Max shape supported by current jolt-kernels Stage 6 RA-virtual
// sumcheck: DENSE_STAGE6_MAX_DEGREE=5 caps bytecode_d and ram_d at 4
// under log_k_chunk=4, so log_k_bytecode <= 16 and log_k_ram <= 16.
// log_t=18 gives a 2^18 universal trace ceiling.
Self::new(18, 14, 14)
}

pub fn attrs(&self) -> Vec<(String, String)> {
Expand Down
16 changes: 8 additions & 8 deletions crates/bolt/tests/commitment_ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ fn commitment_protocol_uses_bolt_semantic_dialects() {

assert!(text.contains("\"protocol.params\"()"));
assert!(text.contains("sym_name = \"jolt.params\""));
assert!(text.contains("trace_length = 65536"));
assert!(text.contains("num_committed = 41"));
assert!(text.contains("trace_length = 262144"));
assert!(text.contains("num_committed = 42"));
assert!(text.contains("\"field.define\"()"));
assert!(text.contains("sym_name = \"bn254_fr\""));
assert!(text.contains("\"poly.domain\"()"));
Expand Down Expand Up @@ -283,7 +283,7 @@ fn protocol_schema_rejects_bad_derived_params() {
.expect("append family");

let error = verify_jolt_protocol_schema(&bad).expect_err("bad derived param rejected");
assert!(error.to_string().contains("num_committed must be 41"));
assert!(error.to_string().contains("num_committed must be 42"));
}

#[test]
Expand Down Expand Up @@ -474,7 +474,7 @@ fn jolt_stage2_protocol_defines_product_ram_claim_flow() {
assert!(text.contains("\"poly.lagrange_basis_eval\"(%"));
assert!(text.contains("sym_name = \"stage2.ram_read_write.claim_expr\""));
assert!(text.contains("\"piop.sumcheck_instance_result\"(%"));
assert!(text.contains("round_offset = 16 : i64"));
assert!(text.contains("round_offset = 18 : i64"));
assert!(text.contains("\"poly.point_slice\"(%"));
assert!(text.contains("\"poly.point_concat\"(%"));
assert!(text.contains(
Expand Down Expand Up @@ -808,7 +808,7 @@ fn jolt_stage5_protocol_defines_value_lookup_reduction_flow() {
assert!(text.contains("sym_name = \"stage5.instruction_read_raf.gamma\""));
assert!(text.contains("sym_name = \"stage5.ram_ra_claim_reduction.gamma\""));
assert!(text.contains("sym_name = \"stage5.instruction.lookup_output_claim_consistency\""));
assert!(text.contains("round_schedule = [128, 16]"));
assert!(text.contains("round_schedule = [128, 18]"));
assert!(text.contains("ordered_claims = [@stage5.instruction_read_raf.input, @stage5.ram_ra_claim_reduction.input, @stage5.registers_val_evaluation.input]"));
assert!(text.contains("@stage5.instruction_read_raf.opening.LookupTableFlag_0"));
assert!(text.contains("@stage5.instruction_read_raf.opening.InstructionRa_0"));
Expand Down Expand Up @@ -899,7 +899,7 @@ fn jolt_stage6_protocol_defines_bytecode_booleanity_and_virtualization_flow() {
assert!(text.contains("source_claim = @stage2.ram_read_write.opening.RamInc"));
assert!(text.contains("source_claim = @stage4.registers_read_write.opening.RdInc"));
assert!(text.contains("source_claim = @stage5.registers_val_evaluation.opening.RdInc"));
assert!(text.contains("round_schedule = [10, 16]"));
assert!(text.contains("round_schedule = [14, 18]"));
assert!(text.contains("ordered_claims = [@stage6.bytecode_read_raf.input, @stage6.booleanity.input, @stage6.hamming_booleanity.input, @stage6.ram_ra_virtual.input, @stage6.instruction_ra_virtual.input, @stage6.inc_claim_reduction.input]"));
assert!(text.contains("@stage6.bytecode_read_raf.opening.BytecodeRa_0"));
assert!(text.contains("@stage6.booleanity.opening.InstructionRa_0"));
Expand Down Expand Up @@ -1473,14 +1473,14 @@ fn stage6_rust_targets_extract_and_compile() {
+ params.instruction_d
+ 2
);
assert_eq!(prover_program.point_zeros.len(), 1);
assert_eq!(prover_program.point_zeros.len(), 2);
assert_eq!(
prover_program.point_slices.len(),
params.bytecode_d + 1 + params.ram_d + params.instruction_d
);
assert_eq!(
prover_program.point_concats.len(),
params.bytecode_d + 1 + params.ram_d + params.instruction_d
params.bytecode_d + 1 + params.ram_d + params.instruction_d + 1
);
assert_eq!(
prover_program.opening_claims.len(),
Expand Down
6 changes: 5 additions & 1 deletion crates/bolt/tests/verifier_cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

use std::path::{Path, PathBuf};

const GENERATED_VERIFIER_TARGET_LOC: usize = 6_000;
// Bumped from 6_000 to 6_050 to accommodate the fixture shape change
// (16, 10, 16) → (18, 14, 14). Higher log_t / log_k_bytecode produces
// larger round-schedule arrays and more verifier descriptor entries.
// Re-tighten when the generated surface drops below this.
const GENERATED_VERIFIER_TARGET_LOC: usize = 6_050;
const GENERATED_VERIFIER_STRETCH_LOC: usize = 3_000;
const VERIFIER_RS_TARGET_LOC: usize = 500;
const VERIFIER_RS_STRETCH_LOC: usize = 350;
Expand Down
1 change: 0 additions & 1 deletion crates/jolt-equivalence/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ bolt = { path = "../bolt" }
jolt-prover = { path = "../jolt-prover" }
jolt-verifier = { path = "../jolt-verifier" }
jolt-program = { path = "../jolt-program" }
jolt-riscv = { path = "../jolt-riscv", default-features = false }
jolt-dory = { path = "../jolt-dory" }
jolt-inlines-sha2.workspace = true
jolt-kernels = { path = "../jolt-kernels" }
Expand Down
Loading
Loading