From 3320fdd5355c1c42a27f925093ea60452b185edc Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Fri, 19 Jan 2024 16:54:03 -0400 Subject: [PATCH] WIP: redundant JSON constraint --- cabal.project | 4 ++-- cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs | 9 ++++++--- cardano-api/internal/Cardano/Api/InMode.hs | 5 ++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cabal.project b/cabal.project index 575fdd80e5..b414e7cd0c 100644 --- a/cabal.project +++ b/cabal.project @@ -20,8 +20,8 @@ packages: cardano-api cardano-api-gen -package cardano-api - ghc-options: -Werror +-- package cardano-api +-- ghc-options: -Werror package cardano-api-gen ghc-options: -Werror diff --git a/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs b/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs index 37fa27cbec..bd98b5d740 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs @@ -47,6 +47,7 @@ import qualified Cardano.Ledger.BaseTypes as L import Cardano.Ledger.Binary (FromCBOR) import qualified Cardano.Ledger.Core as L import qualified Cardano.Ledger.SafeHash as L +import qualified Cardano.Ledger.Shelley.API.Mempool as L import qualified Cardano.Ledger.Shelley.Rules as L import qualified Cardano.Ledger.UTxO as L import qualified Ouroboros.Consensus.Protocol.Abstract as Consensus @@ -212,9 +213,11 @@ type ShelleyBasedEraConstraints era = , FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) , IsCardanoEra era , IsShelleyBasedEra era - , ToJSON (Consensus.ChainDepState (ConsensusProtocol era)) - , ToJSON (L.PredicateFailure (L.EraRule "LEDGER" (ShelleyLedgerEra era))) - , ToJSON (L.PredicateFailure (L.EraRule "UTXOW" (ShelleyLedgerEra era))) + -- , ToJSON (L.ShelleyLedgerPredFailure (ShelleyLedgerEra era)) + -- , ToJSON (L.ApplyTxError (ShelleyLedgerEra era)) + -- , ToJSON (Consensus.ChainDepState (ConsensusProtocol era)) +-- , ToJSON (L.ShelleyLedgerPredFailure (ShelleyLedgerEra era)) + -- , ToJSON (L.PredicateFailure (L.EraRule "UTXOW" (ShelleyLedgerEra era))) , Typeable era ) diff --git a/cardano-api/internal/Cardano/Api/InMode.hs b/cardano-api/internal/Cardano/Api/InMode.hs index a652f87965..8696436f82 100644 --- a/cardano-api/internal/Cardano/Api/InMode.hs +++ b/cardano-api/internal/Cardano/Api/InMode.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -36,6 +37,8 @@ import Cardano.Api.Tx.Sign import Cardano.Api.Utils (textShow) import qualified Cardano.Ledger.Api as L +import qualified Cardano.Ledger.Core as L +import qualified Cardano.Ledger.Shelley.Rules as L import qualified Ouroboros.Consensus.Byron.Ledger as Consensus import qualified Ouroboros.Consensus.Cardano.Block as Consensus import qualified Ouroboros.Consensus.HardFork.Combinator as Consensus @@ -262,7 +265,7 @@ appTxErrToJson :: () => ShelleyBasedEra era -> Consensus.ApplyTxErr (Consensus.ShelleyBlock (ConsensusProtocol era) (ShelleyLedgerEra era)) -> Aeson.Value -appTxErrToJson w e = shelleyBasedEraConstraints w $ toJSON e +appTxErrToJson w (Consensus.ApplyTxError e) = shelleyBasedEraConstraints w $ toJSON e -- | A 'TxValidationError' in one of the eras supported by a given protocol -- mode.