Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vicsn committed May 18, 2023
1 parent c739bbe commit df58d23
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
13 changes: 1 addition & 12 deletions synthesizer/src/process/stack/inclusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,7 @@ mod fee;

#[cfg(debug_assertions)]
use crate::Stack;
use crate::{
BlockStorage,
Execution,
Fee,
Input,
Output,
ProvingKey,
Query,
Transaction,
Transition,
VerifyingKey,
};
use crate::{BlockStorage, Execution, Fee, Input, Output, Query, Transaction, Transition, VerifyingKey};
use console::{
network::prelude::*,
program::{Identifier, InputID, ProgramID, StatePath, TransactionLeaf, TransitionLeaf, TRANSACTION_DEPTH},
Expand Down
15 changes: 13 additions & 2 deletions synthesizer/src/process/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1550,12 +1550,23 @@ finalize compute:
assert_eq!(authorization.len(), 1);

// Execute the request.
let (response, execution, _inclusion, _metrics) = process.execute::<CurrentAleo, _>(authorization, rng).unwrap();
let (_response, mut execution, _inclusion, _metrics, mut function_assignments) =
process.prepare_function::<CurrentAleo>(authorization).unwrap();
assert_eq!(function_assignments.len(), execution.transitions().len());
let mut transition_assignments = BTreeMap::<_, Vec<_>>::new();
for transition in execution.transitions() {
let pk_id = ProvingKeyId { program_id: *transition.program_id(), function_name: *transition.function_name() };
transition_assignments
.entry(pk_id)
.and_modify(|assignments| assignments.push(function_assignments.pop_front().unwrap()))
.or_insert(vec![function_assignments.pop_front().unwrap()]);
}
process.execute::<CurrentAleo, _>(&mut execution, transition_assignments, None, rng).unwrap();
let candidate = response.outputs();
assert_eq!(0, candidate.len());

// Verify the execution.
process.verify_execution::<true>(&execution).unwrap();
process.verify_execution(&execution).unwrap();

// Now, finalize the execution.
process.finalize_execution(&store, &execution).unwrap();
Expand Down
16 changes: 8 additions & 8 deletions synthesizer/src/vm/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ mod tests {

// Assert the size of the transaction.
let transaction_size_in_bytes = transaction.to_bytes_le().unwrap().len();
assert_eq!(1389, transaction_size_in_bytes, "Update me if serialization has changed");
assert_eq!(1388, transaction_size_in_bytes, "Update me if serialization has changed");

// Assert the size of the execution.
assert!(matches!(transaction, Transaction::Execute(_, _, _)));
if let Transaction::Execute(_, execution, _) = &transaction {
let execution_size_in_bytes = execution.to_bytes_le().unwrap().len();
assert_eq!(1354, execution_size_in_bytes, "Update me if serialization has changed");
assert_eq!(1353, execution_size_in_bytes, "Update me if serialization has changed");
}
}

Expand Down Expand Up @@ -292,13 +292,13 @@ mod tests {

// Assert the size of the transaction.
let transaction_size_in_bytes = transaction.to_bytes_le().unwrap().len();
assert_eq!(2216, transaction_size_in_bytes, "Update me if serialization has changed");
assert_eq!(2215, transaction_size_in_bytes, "Update me if serialization has changed");

// Assert the size of the execution.
assert!(matches!(transaction, Transaction::Execute(_, _, _)));
if let Transaction::Execute(_, execution, _) = &transaction {
let execution_size_in_bytes = execution.to_bytes_le().unwrap().len();
assert_eq!(2181, execution_size_in_bytes, "Update me if serialization has changed");
assert_eq!(2180, execution_size_in_bytes, "Update me if serialization has changed");
}
}

Expand Down Expand Up @@ -327,13 +327,13 @@ mod tests {

// Assert the size of the transaction.
let transaction_size_in_bytes = transaction.to_bytes_le().unwrap().len();
assert_eq!(2101, transaction_size_in_bytes, "Update me if serialization has changed");
assert_eq!(2100, transaction_size_in_bytes, "Update me if serialization has changed");

// Assert the size of the execution.
assert!(matches!(transaction, Transaction::Execute(_, _, _)));
if let Transaction::Execute(_, execution, _) = &transaction {
let execution_size_in_bytes = execution.to_bytes_le().unwrap().len();
assert_eq!(2066, execution_size_in_bytes, "Update me if serialization has changed");
assert_eq!(2065, execution_size_in_bytes, "Update me if serialization has changed");
}
}

Expand Down Expand Up @@ -361,13 +361,13 @@ mod tests {

// Assert the size of the transaction.
let transaction_size_in_bytes = transaction.to_bytes_le().unwrap().len();
assert_eq!(2113, transaction_size_in_bytes, "Update me if serialization has changed");
assert_eq!(2112, transaction_size_in_bytes, "Update me if serialization has changed");

// Assert the size of the execution.
assert!(matches!(transaction, Transaction::Execute(_, _, _)));
if let Transaction::Execute(_, execution, _) = &transaction {
let execution_size_in_bytes = execution.to_bytes_le().unwrap().len();
assert_eq!(2078, execution_size_in_bytes, "Update me if serialization has changed");
assert_eq!(2077, execution_size_in_bytes, "Update me if serialization has changed");
}
}

Expand Down

0 comments on commit df58d23

Please sign in to comment.