From 0a0b6c6962bf19c01ec2c3d657cdaaa47653b338 Mon Sep 17 00:00:00 2001 From: Jared Corduan Date: Tue, 27 Apr 2021 10:33:06 -0400 Subject: [PATCH] Replace totExunits check with redeemer check This was changed somewhat recently in the formal spec, and we are now making the correspending change in the implementation. --- alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs | 4 +++- alonzo/impl/src/Cardano/Ledger/Alonzo/TxWitness.hs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs b/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs index 5a50acef0c..64f0417d49 100644 --- a/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs +++ b/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs @@ -24,6 +24,7 @@ import Cardano.Ledger.Alonzo.Tx isTwoPhaseScriptAddress, minfee, txbody, + wits', ) import qualified Cardano.Ledger.Alonzo.Tx as Alonzo (ValidatedTx, txins) import Cardano.Ledger.Alonzo.TxBody @@ -32,6 +33,7 @@ import Cardano.Ledger.Alonzo.TxBody ) import qualified Cardano.Ledger.Alonzo.TxBody as Alonzo (TxBody, TxOut) import qualified Cardano.Ledger.Alonzo.TxSeq as Alonzo (TxSeq) +import Cardano.Ledger.Alonzo.TxWitness (TxWitness (txrdmrs'), nullRedeemers) import Cardano.Ledger.Coin import qualified Cardano.Ledger.Core as Core import Cardano.Ledger.Era (Crypto, Era, TxInBlock, ValidateScript (..)) @@ -262,7 +264,7 @@ feesOK pp tx (UTxO m) = do -- Part 1 (minimumFee <= theFee) ?! FeeTooSmallUTxO minimumFee theFee -- Part 2 - if (getField @"totExunits" tx) == (ExUnits 0 0) + if nullRedeemers . txrdmrs' . wits' $ tx then pure () else do -- Part 3 diff --git a/alonzo/impl/src/Cardano/Ledger/Alonzo/TxWitness.hs b/alonzo/impl/src/Cardano/Ledger/Alonzo/TxWitness.hs index 4c518b8278..d5067594b3 100644 --- a/alonzo/impl/src/Cardano/Ledger/Alonzo/TxWitness.hs +++ b/alonzo/impl/src/Cardano/Ledger/Alonzo/TxWitness.hs @@ -25,6 +25,7 @@ module Cardano.Ledger.Alonzo.TxWitness Redeemers' ), unRedeemers, + nullRedeemers, TxWitness ( TxWitness, txwitsVKey,