Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- Use `IndexVec::try_from` instead of pushing elements one by one in `DebugInfo::empty_for_nodes` ([#2559](https://github.com/0xMiden/miden-vm/pull/2559)).
- [BREAKING] Remove `NodeExecutionState` in favor of `Continuation` ([#2587](https://github.com/0xMiden/miden-vm/pull/2587)).

- Made `StackInputs` and `StackOutputs` implement `Copy` trait ([#2581](https://github.com/0xMiden/miden-vm/pull/2581)).
## 0.20.2 (TBD)
- Fix issue where decorator access was not bypassed properly in release mode ([#2529](https://github.com/0xMiden/miden-vm/pull/2529)).

Expand Down
4 changes: 2 additions & 2 deletions air/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ impl PublicInputs {
}

pub fn stack_inputs(&self) -> StackInputs {
self.stack_inputs.clone()
self.stack_inputs
}

pub fn stack_outputs(&self) -> StackOutputs {
self.stack_outputs.clone()
self.stack_outputs
}

pub fn program_info(&self) -> ProgramInfo {
Expand Down
2 changes: 1 addition & 1 deletion core/src/stack/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
/// Defines the initial state of the VM's operand stack.
///
/// The first element is at position 0 (top of stack).
#[derive(Clone, Debug, Default)]
#[derive(Clone, Copy, Debug, Default)]
pub struct StackInputs {
elements: [Felt; MIN_STACK_DEPTH],
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/stack/outputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::utils::{ByteReader, Deserializable, DeserializationError};
/// `stack` is expected to be ordered as if the elements were popped off the stack one by one.
/// Thus, the value at the top of the stack is expected to be in the first position, and the order
/// of the rest of the output elements will also match the order on the stack.
#[derive(Debug, Clone, Default, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct StackOutputs {
elements: [Felt; MIN_STACK_DEPTH],
}
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/core/tests/crypto/falcon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ fn falcon_prove_verify() {

let options = ProvingOptions::with_96_bit_security(miden_air::HashFunction::Blake3_256);
let (stack_outputs, proof) =
prove_sync(&program, stack_inputs.clone(), advice_inputs, &mut host, options)
prove_sync(&program, stack_inputs, advice_inputs, &mut host, options)
.expect("failed to generate proof");

let program_info = ProgramInfo::from(program);
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/core/tests/stark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn generate_recursive_verifier_data(
ProvingOptions::new(27, 8, 0, FieldExtension::Quadratic, 4, 127, HashFunction::Rpo256);

let (stack_outputs, proof) =
prove(&program, stack_inputs.clone(), advice_inputs, &mut host, options).unwrap();
prove(&program, stack_inputs, advice_inputs, &mut host, options).unwrap();

let program_info = ProgramInfo::from(program);

Expand Down
11 changes: 3 additions & 8 deletions crates/lib/core/tests/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,9 @@ fn log_precompile_request_procedure() {
.expect("failed to register dummy handler");

let options = ProvingOptions::with_96_bit_security(miden_air::HashFunction::Blake3_256);
let (stack_outputs, proof) = miden_utils_testing::prove_sync(
&program,
stack_inputs.clone(),
advice_inputs,
&mut host,
options,
)
.expect("failed to generate proof for log_precompile helper");
let (stack_outputs, proof) =
miden_utils_testing::prove_sync(&program, stack_inputs, advice_inputs, &mut host, options)
.expect("failed to generate proof for log_precompile helper");

// Proof should include the single deferred request that we expect.
assert_eq!(proof.precompile_requests().len(), 1);
Expand Down
14 changes: 7 additions & 7 deletions crates/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl Test {
let mut host = host.with_source_manager(self.source_manager.clone());

// execute the test
let stack_inputs: Vec<Felt> = self.stack_inputs.clone().into_iter().collect();
let stack_inputs: Vec<Felt> = self.stack_inputs.into_iter().collect();
let processor = if self.in_debug_mode {
FastProcessor::new_debug(&stack_inputs, self.advice_inputs.clone())
} else {
Expand Down Expand Up @@ -386,7 +386,7 @@ impl Test {
let mut host = host.with_source_manager(self.source_manager.clone());

let fast_stack_result = {
let stack_inputs: Vec<Felt> = self.stack_inputs.clone().into_iter().collect();
let stack_inputs: Vec<Felt> = self.stack_inputs.into_iter().collect();
let advice_inputs: AdviceInputs = self.advice_inputs.clone();
let fast_processor = FastProcessor::new_with_options(
&stack_inputs,
Expand Down Expand Up @@ -424,7 +424,7 @@ impl Test {
let mut host = host.with_source_manager(self.source_manager.clone());

let processor = FastProcessor::new_debug(
&self.stack_inputs.clone().into_iter().collect::<Vec<Felt>>(),
&self.stack_inputs.into_iter().collect::<Vec<Felt>>(),
self.advice_inputs.clone(),
);

Expand All @@ -445,7 +445,7 @@ impl Test {
.with_debug_handler(debug_handler);

let processor = FastProcessor::new_debug(
&self.stack_inputs.clone().into_iter().collect::<Vec<Felt>>(),
&self.stack_inputs.into_iter().collect::<Vec<Felt>>(),
self.advice_inputs.clone(),
);

Expand Down Expand Up @@ -473,7 +473,7 @@ impl Test {
let stack_inputs = StackInputs::try_from_ints(pub_inputs).unwrap();
let (mut stack_outputs, proof) = miden_prover::prove_sync(
&program,
stack_inputs.clone(),
stack_inputs,
self.advice_inputs.clone(),
&mut host,
ProvingOptions::default(),
Expand Down Expand Up @@ -579,7 +579,7 @@ impl Test {
let mut host = host.with_source_manager(self.source_manager.clone());

let fast_result_by_step = {
let stack_inputs: Vec<Felt> = self.stack_inputs.clone().into_iter().collect();
let stack_inputs: Vec<Felt> = self.stack_inputs.into_iter().collect();
let advice_inputs: AdviceInputs = self.advice_inputs.clone();
let fast_process = if self.in_debug_mode {
FastProcessor::new_debug(&stack_inputs, advice_inputs)
Expand All @@ -590,7 +590,7 @@ impl Test {
};

compare_results(
fast_result.as_ref().map(|(output, _)| output.stack.clone()),
fast_result.as_ref().map(|(output, _)| output.stack),
&fast_result_by_step,
"fast processor",
"fast processor by step",
Expand Down
2 changes: 1 addition & 1 deletion miden-vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let mut host = DefaultHost::default();
let exec_options = ExecutionOptions::default();

// execute the program with no inputs
let trace = execute_sync(&program, stack_inputs.clone(), advice_inputs.clone(), &mut host, exec_options).unwrap();
let trace = execute_sync(&program, stack_inputs, advice_inputs.clone(), &mut host, exec_options).unwrap();
```

### Proving program execution
Expand Down
1 change: 0 additions & 1 deletion miden-vm/benches/build_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ fn build_trace(c: &mut Criterion) {
let host = DefaultHost::default()
.with_library(&CoreLibrary::default())
.unwrap();
let stack_inputs = stack_inputs.clone();
let advice_inputs = advice_inputs.clone();

(host, stack_inputs, advice_inputs, program.clone())
Expand Down
14 changes: 7 additions & 7 deletions miden-vm/tests/integration/prove_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn test_blake3_256_prove_verify() {

println!("Proving with Blake3_256...");
let (stack_outputs, proof) =
prove_sync(&program, stack_inputs.clone(), advice_inputs, &mut host, options)
prove_sync(&program, stack_inputs, advice_inputs, &mut host, options)
.expect("Proving failed");

println!("Proof generated successfully!");
Expand Down Expand Up @@ -67,7 +67,7 @@ fn test_keccak_prove_verify() {
// Prove the program
println!("Proving with Keccak...");
let (stack_outputs, proof) =
prove_sync(&program, stack_inputs.clone(), advice_inputs, &mut host, options)
prove_sync(&program, stack_inputs, advice_inputs, &mut host, options)
.expect("Proving failed");

println!("Proof generated successfully!");
Expand Down Expand Up @@ -107,7 +107,7 @@ fn test_rpo_prove_verify() {
// Prove the program
println!("Proving with RPO...");
let (stack_outputs, proof) =
prove_sync(&program, stack_inputs.clone(), advice_inputs, &mut host, options)
prove_sync(&program, stack_inputs, advice_inputs, &mut host, options)
.expect("Proving failed");

println!("Proof generated successfully!");
Expand Down Expand Up @@ -143,7 +143,7 @@ fn test_poseidon2_prove_verify() {

println!("Proving with Poseidon2...");
let (stack_outputs, proof) =
prove_sync(&program, stack_inputs.clone(), advice_inputs, &mut host, options)
prove_sync(&program, stack_inputs, advice_inputs, &mut host, options)
.expect("Proving failed");

println!("Proof generated successfully!");
Expand Down Expand Up @@ -179,7 +179,7 @@ fn test_rpx_prove_verify() {

println!("Proving with RPX...");
let (stack_outputs, proof) =
prove_sync(&program, stack_inputs.clone(), advice_inputs, &mut host, options)
prove_sync(&program, stack_inputs, advice_inputs, &mut host, options)
.expect("Proving failed");

println!("Proof generated successfully!");
Expand Down Expand Up @@ -236,7 +236,7 @@ mod fast_parallel {
let mut host =
DefaultHost::default().with_source_manager(Arc::new(DefaultSourceManager::default()));

let stack_inputs_vec: Vec<Felt> = stack_inputs.clone().into_iter().collect();
let stack_inputs_vec: Vec<Felt> = stack_inputs.into_iter().collect();

let options = ExecutionOptions::default()
.with_core_trace_fragment_size(FRAGMENT_SIZE)
Expand All @@ -247,7 +247,7 @@ mod fast_parallel {
.execute_for_trace_sync(&program, &mut host)
.expect("Fast processor execution failed");

let fast_stack_outputs = execution_output.stack.clone();
let fast_stack_outputs = execution_output.stack;

// Build trace using parallel trace generation
let trace =
Expand Down
2 changes: 1 addition & 1 deletion processor/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl ExecutionTrace {
let public_inputs = PublicInputs::new(
self.program_info.clone(),
self.init_stack_state(),
self.stack_outputs.clone(),
self.stack_outputs,
self.final_pc_transcript.state(),
);
public_inputs.to_elements()
Expand Down
2 changes: 1 addition & 1 deletion prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub async fn prove(
trace.trace_len_summary().main_trace_len()
);

let stack_outputs = trace.stack_outputs().clone();
let stack_outputs = *trace.stack_outputs();
let precompile_requests = trace.precompile_requests().to_vec();
let hash_fn = options.hash_fn();

Expand Down