From 700a64c2b4fe9a1281e8b7f776c250e397e2b929 Mon Sep 17 00:00:00 2001 From: Carlos Souza Date: Wed, 29 Oct 2025 16:31:11 -0400 Subject: [PATCH] Allow non-Alonzo era when missing total collateral This field is optional according to the CDDL. Remove unused import --- crates/cardano/src/roll/epochs.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/cardano/src/roll/epochs.rs b/crates/cardano/src/roll/epochs.rs index 37acef319..83446812c 100644 --- a/crates/cardano/src/roll/epochs.rs +++ b/crates/cardano/src/roll/epochs.rs @@ -10,7 +10,7 @@ use pallas::{ }, Epoch, }, - traverse::{fees::compute_byron_fee, Era, MultiEraBlock, MultiEraCert, MultiEraTx}, + traverse::{fees::compute_byron_fee, MultiEraBlock, MultiEraCert, MultiEraTx}, }, }; use serde::{Deserialize, Serialize}; @@ -123,11 +123,12 @@ impl dolos_core::EntityDelta for NoncesUpdate { // and Alonzo txs don't even have the total collateral field. This is why we // need to compute it by looking at collateral inputs and collateral return. // Pallas hides this from us by providing the "consumes" / "produces" facade. +// Note: This can be called for transactions from any era (Alonzo, Babbage, Conway) +// when total_collateral is not set. fn compute_collateral_value( tx: &MultiEraTx, utxos: &HashMap, ) -> Result { - debug_assert!(tx.era() == Era::Alonzo); debug_assert!(!tx.is_valid()); let mut total = 0;