cardano-ledger icon indicating copy to clipboard operation
cardano-ledger copied to clipboard

Add `TxIx` and `TxId` to the predicate failure for `LEDGERS` rule.

Open lehins opened this issue 5 months ago • 1 comments

Whenever failures are reported upon block validation, it would be useful to learn which transaction in the block is the offender. It would be very easy to add, however we can only do it for the new Dijkstra era, since we would need to redefine the LEDGERS rule and serialization for the new predicate failure would be different. If we were to do it for Conway, it would likely break the Node2Node protocol.

This would be the new definition of the predicate failure:

data DijkstraLedgersPredFailure era
  = LedgerFailure 
      -- | Index of the transaction in the block that caused the @LEDGER@ predicate failure
      TxIx 
      -- | Hash of the transaction that caused the @LEDGER@ predicate failure
      TxId
      -- | Transaction validation failure
      (PredicateFailure (EraRule "LEDGER" era)) -- Subtransition Failures
  deriving (Generic)

lehins avatar Jul 31 '25 16:07 lehins

In the small-steps package, the Embed class handles the wrapping of predicate failures with the help of its wrapFailed method, and since we need to have the information of TxId and TxIx available in that context, this issue is not addressable without changes to the small-steps package. We shall postpone this issue until we address the background work necessary in that package.

cc. @lehins

aniketd avatar Aug 07 '25 14:08 aniketd