From cde1094fdd598d89c155a942c445cc819590634f Mon Sep 17 00:00:00 2001 From: Nikolaos Dymitriadis Date: Mon, 9 Dec 2024 15:13:40 +0100 Subject: [PATCH] fix: fix order of ExUnits in insert-d-parameter transaction (#306) --- toolkit/offchain/src/csl.rs | 2 +- toolkit/offchain/src/d_param/mod.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/toolkit/offchain/src/csl.rs b/toolkit/offchain/src/csl.rs index 09985717d..7d0d42ce5 100644 --- a/toolkit/offchain/src/csl.rs +++ b/toolkit/offchain/src/csl.rs @@ -187,7 +187,7 @@ impl ScriptExUnits { pub(crate) fn get_validator_budgets( mut responses: Vec, ) -> Result { - responses.sort_unstable_by_key(|r| r.validator.index); + responses.sort_by_key(|r| r.validator.index); let (mint_ex_units, spend_ex_units) = responses .into_iter() .partition::, _>(|response| response.validator.purpose == "mint"); diff --git a/toolkit/offchain/src/d_param/mod.rs b/toolkit/offchain/src/d_param/mod.rs index eff19e947..039f8c02f 100644 --- a/toolkit/offchain/src/d_param/mod.rs +++ b/toolkit/offchain/src/d_param/mod.rs @@ -125,7 +125,8 @@ where hex::encode(tx.to_bytes()) ) })?; - let mint_witness_ex_units = get_validator_budgets(evaluate_response)?; + let mut mint_witness_ex_units = get_validator_budgets(evaluate_response)?; + mint_witness_ex_units.mint_ex_units.reverse(); let tx = mint_d_param_token_tx( validator, policy,