Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added utxowDebug #613

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/Ledger/Conway/Foreign/HSLedger/Utxo.agda
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ open import Ledger.Conway.Foreign.HSLedger.Transaction

open import Foreign.Haskell.Coerce

open import Ledger.Conway.Foreign.HSLedger.BaseTypes
open import Ledger.Conway.Foreign.HSLedger.BaseTypes hiding (TxWitnesses)
open import Ledger.Conway.Conformance.Utxo DummyTransactionStructure DummyAbstractFunctions
open import Ledger.Conway.Conformance.Utxow DummyTransactionStructure DummyAbstractFunctions

instance
HsTy-UTxOEnv = autoHsType UTxOEnv ⊣ withConstructor "MkUTxOEnv"
Expand Down Expand Up @@ -66,3 +67,21 @@ module _ (ext : ExternalFunctions) where
[]

{-# COMPILE GHC utxo-debug as utxoDebug #-}

utxow-debug : HsType (UTxOEnv → UTxOState → Tx → String)
utxow-debug env st tx =
let open Tx (from tx)
open TxBody body
open UTxOState (from st)
open UTxOEnv (from env)
open TxWitnesses (coerce ⦃ TrustMe ⦄ wits)
in unlines
$ "witsVKeyNeeded utxo txb = "
∷ show (witsVKeyNeeded utxo body)
∷ "\nwitsKeyHashes = "
∷ show (mapˢ hash (dom vkSigs))
--∷ "\ncredsNeeded = "
--∷ show (credsNeeded utxo body)
∷ []

{-# COMPILE GHC utxow-debug as utxowDebug #-}
1 change: 1 addition & 0 deletions src/Ledger/ScriptValidation.agda
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module Ledger.ScriptValidation
where

open import Ledger.Certs govStructure
open import Tactic.Derive.Show

instance
_ = DecEq-Slot
Expand Down
3 changes: 2 additions & 1 deletion src/Ledger/hs-src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.NewEpoch as X
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.Ratify as X
(StakeDistrs(..), RatifyEnv(..), RatifyState(..), ratifyStep, ratifyDebug)
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.Utxo as X
(UTxOEnv(..), UTxOState(..), UTxO, utxoStep, utxowStep, Redeemer, utxoDebug)
( UTxOEnv(..), UTxOState(..), UTxO, utxoStep, utxowStep, Redeemer
, utxoDebug, utxowDebug)
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.BaseTypes as X
(Coin, ExUnits, Epoch)
import MAlonzo.Code.Ledger.Conway.Foreign.ExternalFunctions as X
Expand Down
Loading