From 25aaa855143a29d9b1d2c36f43d54991945f2864 Mon Sep 17 00:00:00 2001 From: Tal Derei Date: Fri, 22 Mar 2024 14:17:40 -0700 Subject: [PATCH] pass unit test --- crates/core/transaction/src/plan.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/core/transaction/src/plan.rs b/crates/core/transaction/src/plan.rs index 53147032a7..bfeafec1cc 100644 --- a/crates/core/transaction/src/plan.rs +++ b/crates/core/transaction/src/plan.rs @@ -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 @@ -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![ @@ -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();