Skip to content

Commit

Permalink
pass unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
TalDerei committed Mar 22, 2024
1 parent f7de3ab commit 25aaa85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/core/transaction/src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ mod tests {
use crate::{
memo::MemoPlaintext,
plan::{CluePlan, DetectionDataPlan, MemoPlan, TransactionPlan},
TransactionParameters, WitnessData,
ActionPlan, TransactionParameters, WitnessData,
};

/// This isn't an exhaustive test, but we don't currently have a
Expand Down Expand Up @@ -505,7 +505,7 @@ mod tests {
let mut rng = OsRng;

let memo_plaintext = MemoPlaintext::new(Address::dummy(&mut rng), "".to_string()).unwrap();
let plan = TransactionPlan {
let mut plan: TransactionPlan = TransactionPlan {
// Put outputs first to check that the auth hash
// computation is not affected by plan ordering.
actions: vec![
Expand Down Expand Up @@ -533,6 +533,10 @@ mod tests {
memo: Some(MemoPlan::new(&mut OsRng, memo_plaintext.clone()).unwrap()),
};

// Implement canonical ordering to the action plans to reduce client distinguishability.
plan.actions
.sort_by_key(|action: &ActionPlan| action.variant_index());

println!("{}", serde_json::to_string_pretty(&plan).unwrap());

let plan_effect_hash = plan.effect_hash(fvk).unwrap();
Expand Down

0 comments on commit 25aaa85

Please sign in to comment.