diff --git a/cabal.project b/cabal.project index c6b8eb7369..155c06bbef 100644 --- a/cabal.project +++ b/cabal.project @@ -10,6 +10,73 @@ repository cardano-haskell-packages c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56 d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee +source-repository-package + type: git + location: https://github.com/IntersectMBO/ouroboros-consensus + tag: c982eb9ef4d2fb561f1c17fbefacb2bcaef0646d + --sha256: sha256-TRLbfeEtcPNyiorjHOSTkL+X4OCJSazc+PizWkTF5a0= + subdir: + ouroboros-consensus + ouroboros-consensus-cardano + ouroboros-consensus-diffusion + ouroboros-consensus-protocol + sop-extras + strict-sop-core + +source-repository-package + type: git + location: https://github.com/IntersectMBO/ouroboros-network + tag: 3e8d3b4b8c87ead794876c62d7fe25f32efb5142 + --sha256: sha256-uKrxpHhcNGzKUSeA4zIdkslfDFIJjkCsHUg+FUef1yE= + subdir: + ouroboros-network-api + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-ledger + tag: 651e1dd0a43422f01ca43e5ae0ead587e748ccf5 + --sha256: sha256-5cIcFcsvbMwpNQBrothZQC4j+rWjMK3vqPC4lntZ+4c= + subdir: + eras/allegra/impl + eras/alonzo/impl + eras/alonzo/test-suite + eras/babbage/impl + eras/babbage/test-suite + eras/byron/chain/executable-spec + eras/byron/crypto + eras/byron/ledger/executable-spec + eras/byron/ledger/impl + eras/conway/impl + eras/conway/test-suite + eras/dijkstra + eras/mary/impl + eras/shelley/impl + eras/shelley-ma/test-suite + eras/shelley/test-suite + libs/cardano-data + libs/cardano-ledger-api + libs/cardano-ledger-binary + libs/cardano-ledger-core + libs/cardano-ledger-test + libs/cardano-protocol-tpraos + libs/constrained-generators + libs/non-integral + libs/set-algebra + libs/small-steps + libs/vector-map + +source-repository-package + type: git + location: https://github.com/IntersectMBO/plutus + tag: 30b27c2dd952dced1671b296f87bcc07b1dee7d5 + --sha256: sha256-efB8UbgomaKYmrw95Yb53lsBKenDPby9Kkt72tbT6Io= + subdir: + plutus-core + plutus-metatheory + plutus-ledger-api + plutus-tx + plutus-tx-plugin + -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 97a13305d0..a7a6f388ae 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -124,7 +124,7 @@ library cardano-data >=1.0, cardano-ledger-allegra >=1.7, cardano-ledger-alonzo >=1.13, - cardano-ledger-api >=1.11, + cardano-ledger-api >=1.12, cardano-ledger-babbage >=1.11, cardano-ledger-binary >=1.6, cardano-ledger-byron >=1.1, @@ -167,7 +167,7 @@ library ouroboros-network-framework, ouroboros-network-protocols >=0.14, parsec, - plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>=1.45, + plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>=1.46, prettyprinter, prettyprinter-ansi-terminal, prettyprinter-configurable ^>=1.36, @@ -310,9 +310,9 @@ library gen cardano-crypto-class ^>=2.2.1, cardano-crypto-test ^>=1.6, cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib} >=1.8.1, - cardano-ledger-byron-test >=1.5, + cardano-ledger-byron:{testlib} >=1.1, cardano-ledger-conway:testlib, - cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14, + cardano-ledger-core:{cardano-ledger-core, testlib} >=1.17, cardano-ledger-shelley >=1.13, containers, directory, @@ -343,10 +343,10 @@ test-suite cardano-api-test cardano-crypto-test ^>=1.6, cardano-crypto-tests ^>=2.2, cardano-ledger-alonzo, - cardano-ledger-api >=1.9, + cardano-ledger-api >=1.12, cardano-ledger-binary, cardano-ledger-conway, - cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14, + cardano-ledger-core:{cardano-ledger-core, testlib} >=1.17, cardano-ledger-mary, cardano-protocol-tpraos, cardano-slotting, @@ -415,9 +415,9 @@ test-suite cardano-api-golden cardano-crypto-class ^>=2.2.1, cardano-data >=1.0, cardano-ledger-alonzo, - cardano-ledger-api >=1.9, + cardano-ledger-api >=1.12, cardano-ledger-binary, - cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14, + cardano-ledger-core:{cardano-ledger-core, testlib} >=1.17, cardano-ledger-shelley, cardano-ledger-shelley-test >=1.2.0.1, cardano-protocol-tpraos, @@ -427,7 +427,7 @@ test-suite cardano-api-golden hedgehog >=1.1, hedgehog-extras ^>=0.7, microlens, - plutus-core ^>=1.45, + plutus-core ^>=1.46, plutus-ledger-api, tasty, tasty-hedgehog, diff --git a/cardano-api/src/Cardano/Api/Block.hs b/cardano-api/src/Cardano/Api/Block.hs index 8760593873..0314f0226e 100644 --- a/cardano-api/src/Cardano/Api/Block.hs +++ b/cardano-api/src/Cardano/Api/Block.hs @@ -72,7 +72,6 @@ import Ouroboros.Consensus.Byron.Ledger qualified as Consensus import Ouroboros.Consensus.Cardano.Block qualified as Consensus import Ouroboros.Consensus.HardFork.Combinator qualified as Consensus import Ouroboros.Consensus.Shelley.Ledger qualified as Consensus -import Ouroboros.Consensus.Shelley.Protocol.Abstract qualified as Consensus import Ouroboros.Network.Block qualified as Consensus import Data.Aeson (FromJSON (..), ToJSON (..), Value (..), object, withObject, (.:), (.=)) @@ -167,7 +166,6 @@ getShelleyBlockTxs :: forall era ledgerera blockheader . ShelleyLedgerEra era ~ ledgerera => Consensus.ShelleyCompatible (ConsensusProtocol era) ledgerera - => Consensus.ShelleyProtocolHeader (ConsensusProtocol era) ~ blockheader => ShelleyBasedEra era -> Ledger.Block blockheader ledgerera -> [Tx era] diff --git a/cardano-api/src/Cardano/Api/Certificate/Internal.hs b/cardano-api/src/Cardano/Api/Certificate/Internal.hs index 24d91fd65c..3c2a76e8cf 100644 --- a/cardano-api/src/Cardano/Api/Certificate/Internal.hs +++ b/cardano-api/src/Cardano/Api/Certificate/Internal.hs @@ -564,7 +564,8 @@ selectStakeCredentialWitness = \case getTxCertWitness (convert cEra) conwayCert filterUnRegCreds - :: Certificate era -> Maybe StakeCredential + :: forall era + . Certificate era -> Maybe StakeCredential filterUnRegCreds = fmap fromShelleyStakeCredential . \case ShelleyRelatedCertificate stbEra shelleyCert -> shelleyToBabbageEraConstraints stbEra $ @@ -576,6 +577,7 @@ filterUnRegCreds = Ledger.RetirePoolTxCert _ _ -> Nothing Ledger.MirTxCert _ -> Nothing Ledger.GenesisDelegTxCert{} -> Nothing + _ -> error "Impossible" ConwayCertificate cEra conwayCert -> conwayEraOnwardsConstraints cEra $ case conwayCert of Ledger.RegPoolTxCert _ -> Nothing @@ -593,6 +595,7 @@ filterUnRegCreds = Ledger.RegTxCert _ -> Nothing -- stake cred deregistration w/o deposit Ledger.UnRegTxCert cred -> Just cred + _ -> error "Impossible" filterUnRegDRepCreds :: Certificate era -> Maybe (Ledger.Credential Ledger.DRepRole) @@ -615,6 +618,7 @@ filterUnRegDRepCreds = \case Ledger.RegTxCert _ -> Nothing -- stake cred deregistration w/o deposit Ledger.UnRegTxCert _ -> Nothing + _ -> error "Impossible" -- ---------------------------------------------------------------------------- -- Internal conversion functions @@ -803,6 +807,7 @@ getAnchorDataFromCertificate c = Ledger.RetirePoolTxCert _ _ -> return Nothing Ledger.GenesisDelegTxCert{} -> return Nothing Ledger.MirTxCert _ -> return Nothing + _ -> error "Impossible" ConwayCertificate ceo ccert -> conwayEraOnwardsConstraints ceo $ case ccert of @@ -819,6 +824,7 @@ getAnchorDataFromCertificate c = Ledger.UpdateDRepTxCert _ mAnchor -> return $ Ledger.strictMaybeToMaybe mAnchor Ledger.AuthCommitteeHotKeyTxCert _ _ -> return Nothing Ledger.ResignCommitteeColdTxCert _ mAnchor -> return $ Ledger.strictMaybeToMaybe mAnchor + _ -> error "Impossible" where anchorDataFromPoolMetadata :: MonadError AnchorDataFromCertificateError m diff --git a/cardano-api/src/Cardano/Api/Era/Internal/Eon/ConwayEraOnwards.hs b/cardano-api/src/Cardano/Api/Era/Internal/Eon/ConwayEraOnwards.hs index cb698488ea..de009c4928 100644 --- a/cardano-api/src/Cardano/Api/Era/Internal/Eon/ConwayEraOnwards.hs +++ b/cardano-api/src/Cardano/Api/Era/Internal/Eon/ConwayEraOnwards.hs @@ -39,7 +39,7 @@ import Cardano.Ledger.Conway.Core qualified as L import Cardano.Ledger.Conway.Governance qualified as L import Cardano.Ledger.Conway.TxCert qualified as L import Cardano.Ledger.Mary.Value qualified as L -import Cardano.Ledger.State qualified as L +import Cardano.Ledger.Conway.State qualified as L import Cardano.Protocol.Crypto qualified as L import Ouroboros.Consensus.Protocol.Abstract qualified as Consensus import Ouroboros.Consensus.Protocol.Praos.Common qualified as Consensus @@ -101,6 +101,7 @@ type ConwayEraOnwardsConstraints era = , L.ConwayEraPParams (ShelleyLedgerEra era) , L.ConwayEraTxBody (ShelleyLedgerEra era) , L.ConwayEraTxCert (ShelleyLedgerEra era) + , L.ConwayEraCertState (ShelleyLedgerEra era) , L.Era (ShelleyLedgerEra era) , L.EraGov (ShelleyLedgerEra era) , L.EraPParams (ShelleyLedgerEra era) diff --git a/cardano-api/src/Cardano/Api/Experimental/Tx.hs b/cardano-api/src/Cardano/Api/Experimental/Tx.hs index 3e5bb324c3..bff73934d2 100644 --- a/cardano-api/src/Cardano/Api/Experimental/Tx.hs +++ b/cardano-api/src/Cardano/Api/Experimental/Tx.hs @@ -159,7 +159,6 @@ import Cardano.Crypto.Hash qualified as Hash import Cardano.Ledger.Alonzo.TxBody qualified as L import Cardano.Ledger.Api qualified as L import Cardano.Ledger.Conway qualified as Ledger -import Cardano.Ledger.Conway.TxBody qualified as L import Cardano.Ledger.Core qualified as Ledger import Cardano.Ledger.Hashes qualified as L hiding (Hash) diff --git a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs index 5ab827df31..14bdc6f6f7 100644 --- a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs +++ b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs @@ -3,6 +3,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeOperators #-} module Cardano.Api.Experimental.Tx.Internal.Certificate ( Certificate (..) @@ -28,8 +29,9 @@ import Cardano.Api.Plutus.Internal.Script qualified as Api import Cardano.Api.Tx.Internal.Body (TxCertificates (..)) import Cardano.Api.Tx.Internal.Body qualified as Api -import Cardano.Ledger.Allegra.Scripts qualified as L import Cardano.Ledger.Plutus.Language qualified as L +import Cardano.Ledger.Core qualified as L +import Cardano.Ledger.Allegra.Scripts qualified as L import Cardano.Ledger.Plutus.Language qualified as Plutus import GHC.IsList @@ -83,7 +85,9 @@ mkTxCertificates certs = ) newToOldSimpleScriptWitness - :: L.AllegraEraScript (LedgerEra era) + :: ( L.AllegraEraScript (LedgerEra era) + , L.NativeScript (LedgerEra era) ~ L.Timelock (LedgerEra era) + ) => Era era -> Exp.SimpleScriptOrReferenceInput (LedgerEra era) -> Api.ScriptWitness Api.WitCtxStake era newToOldSimpleScriptWitness era simple = case simple of diff --git a/cardano-api/src/Cardano/Api/Governance/Internal/Action/ProposalProcedure.hs b/cardano-api/src/Cardano/Api/Governance/Internal/Action/ProposalProcedure.hs index f1b6002bb4..6ca5b03cfb 100644 --- a/cardano-api/src/Cardano/Api/Governance/Internal/Action/ProposalProcedure.hs +++ b/cardano-api/src/Cardano/Api/Governance/Internal/Action/ProposalProcedure.hs @@ -44,13 +44,13 @@ data AnyGovernanceAction = forall era. AnyGovernanceAction (Gov.GovAction era) -- TODO: Conway - Transitiion to Ledger.GovAction data GovernanceAction era = MotionOfNoConfidence - (StrictMaybe (Ledger.GovPurposeId Ledger.CommitteePurpose (ShelleyLedgerEra era))) + (StrictMaybe (Ledger.GovPurposeId Ledger.CommitteePurpose)) | ProposeNewConstitution - (StrictMaybe (Ledger.GovPurposeId Ledger.ConstitutionPurpose (ShelleyLedgerEra era))) + (StrictMaybe (Ledger.GovPurposeId Ledger.ConstitutionPurpose)) Ledger.Anchor (StrictMaybe Shelley.ScriptHash) | ProposeNewCommittee - (StrictMaybe (Ledger.GovPurposeId Ledger.CommitteePurpose (ShelleyLedgerEra era))) + (StrictMaybe (Ledger.GovPurposeId Ledger.CommitteePurpose)) [L.Credential ColdCommitteeRole] -- ^ Old constitutional committee (Map (L.Credential ColdCommitteeRole) EpochNo) @@ -63,11 +63,11 @@ data GovernanceAction era [(Network, StakeCredential, L.Coin)] !(StrictMaybe Shelley.ScriptHash) | InitiateHardfork - (StrictMaybe (Ledger.GovPurposeId Ledger.HardForkPurpose (ShelleyLedgerEra era))) + (StrictMaybe (Ledger.GovPurposeId Ledger.HardForkPurpose)) ProtVer | -- | Governance policy UpdatePParams - (StrictMaybe (Ledger.GovPurposeId Ledger.PParamUpdatePurpose (ShelleyLedgerEra era))) + (StrictMaybe (Ledger.GovPurposeId Ledger.PParamUpdatePurpose)) (Ledger.PParamsUpdate (ShelleyLedgerEra era)) !(StrictMaybe Shelley.ScriptHash) diff --git a/cardano-api/src/Cardano/Api/Ledger/Internal/Reexport.hs b/cardano-api/src/Cardano/Api/Ledger/Internal/Reexport.hs index 2f9e04bbaf..e18abc6c70 100644 --- a/cardano-api/src/Cardano/Api/Ledger/Internal/Reexport.hs +++ b/cardano-api/src/Cardano/Api/Ledger/Internal/Reexport.hs @@ -112,7 +112,7 @@ module Cardano.Api.Ledger.Internal.Reexport , toPlainDecoder -- Shelley , secondsToNominalDiffTimeMicro - , AccountState (..) + , ChainAccountState (..) , NewEpochState (..) , ShelleyGenesisStaking (..) -- Babbage @@ -266,7 +266,6 @@ import Cardano.Ledger.Binary , toPlainDecoder ) import Cardano.Ledger.Binary.Plain (Decoder, serializeAsHexText) -import Cardano.Ledger.CertState (DRepState (..), csCommitteeCredsL) import Cardano.Ledger.Coin (Coin (..), addDeltaCoin, toDeltaCoin) import Cardano.Ledger.Conway.Core ( DRepVotingThresholds (..) @@ -293,6 +292,7 @@ import Cardano.Ledger.Conway.Governance ) import Cardano.Ledger.Conway.PParams (UpgradeConwayPParams (..)) import Cardano.Ledger.Conway.Scripts (ConwayPlutusPurpose (..)) +import Cardano.Ledger.Conway.State (DRepState (..), csCommitteeCredsL) import Cardano.Ledger.Conway.TxCert ( ConwayDelegCert (..) , ConwayEraTxCert (..) @@ -336,7 +336,7 @@ import Cardano.Ledger.Plutus.Data (Data (..), unData) import Cardano.Ledger.Plutus.Language (Language, Plutus, languageToText, plutusBinary) import Cardano.Ledger.PoolParams (PoolMetadata (..), PoolParams (..), StakePoolRelay (..)) import Cardano.Ledger.Shelley.API - ( AccountState (..) + ( ChainAccountState (..) , GenDelegPair (..) , NewEpochState (..) , StakeReference (..) diff --git a/cardano-api/src/Cardano/Api/Plutus/Internal/Script.hs b/cardano-api/src/Cardano/Api/Plutus/Internal/Script.hs index 34e236ca71..7cd066d80d 100644 --- a/cardano-api/src/Cardano/Api/Plutus/Internal/Script.hs +++ b/cardano-api/src/Cardano/Api/Plutus/Internal/Script.hs @@ -1324,7 +1324,10 @@ toAllegraTimelock = go -- | Conversion for the 'Timelock.Timelock' language that is shared between the -- Allegra and Mary eras. fromAllegraTimelock - :: Allegra.AllegraEraScript era + :: forall era + . ( Allegra.AllegraEraScript era + , Ledger.NativeScript era ~ Allegra.Timelock era + ) => Ledger.NativeScript era -> SimpleScript fromAllegraTimelock = go where @@ -1334,6 +1337,7 @@ fromAllegraTimelock = go go (Shelley.RequireAllOf s) = RequireAllOf (map go (toList s)) go (Shelley.RequireAnyOf s) = RequireAnyOf (map go (toList s)) go (Shelley.RequireMOf i s) = RequireMOf i (map go (toList s)) + go _ = error "Impossible" type family ToLedgerPlutusLanguage lang where ToLedgerPlutusLanguage PlutusScriptV1 = Plutus.PlutusV1 diff --git a/cardano-api/src/Cardano/Api/Query/Internal/Convenience.hs b/cardano-api/src/Cardano/Api/Query/Internal/Convenience.hs index 61519ae6ae..cc46afd676 100644 --- a/cardano-api/src/Cardano/Api/Query/Internal/Convenience.hs +++ b/cardano-api/src/Cardano/Api/Query/Internal/Convenience.hs @@ -35,11 +35,10 @@ import Cardano.Api.Query.Internal.Type.QueryInMode import Cardano.Api.Tx.Internal.Body import Cardano.Api.UTxO (UTxO (..)) -import Cardano.Ledger.CertState (DRepState (..)) import Cardano.Ledger.Coin qualified as L import Cardano.Ledger.Credential qualified as L import Cardano.Ledger.Keys qualified as L -import Cardano.Ledger.Shelley.LedgerState qualified as L +import Cardano.Ledger.State (ChainAccountState (..), DRepState (..)) import Ouroboros.Consensus.HardFork.Combinator.AcrossEras (EraMismatch (..)) import Ouroboros.Network.Protocol.LocalStateQuery.Type (Target (..)) @@ -164,11 +163,11 @@ queryStateForBalancedTx era allTxIns certs = runExceptT $ do caseShelleyToBabbageOrConwayEraOnwards (const $ pure Nothing) ( \cOnwards -> do - L.AccountState{L.asTreasury} <- + ChainAccountState{casTreasury} <- lift (queryAccountState cOnwards) & onLeft (left . QceUnsupportedNtcVersion) & onLeft (left . QueryEraMismatch) - let txCurrentTreasuryValue = TxCurrentTreasuryValue asTreasury + let txCurrentTreasuryValue = TxCurrentTreasuryValue casTreasury return $ Just $ Featured cOnwards txCurrentTreasuryValue ) sbe diff --git a/cardano-api/src/Cardano/Api/Query/Internal/Expr.hs b/cardano-api/src/Cardano/Api/Query/Internal/Expr.hs index 46f0b305dd..c7adbd5f61 100644 --- a/cardano-api/src/Cardano/Api/Query/Internal/Expr.hs +++ b/cardano-api/src/Cardano/Api/Query/Internal/Expr.hs @@ -59,12 +59,12 @@ import Cardano.Api.UTxO import Cardano.Ledger.Api qualified as L import Cardano.Ledger.Api.State.Query qualified as L -import Cardano.Ledger.CertState qualified as L import Cardano.Ledger.Coin qualified as L import Cardano.Ledger.Credential qualified as L import Cardano.Ledger.Hashes hiding (Hash) import Cardano.Ledger.Keys qualified as L import Cardano.Ledger.Shelley.LedgerState qualified as L +import Cardano.Ledger.State qualified as L import Cardano.Slotting.Slot import Ouroboros.Consensus.Cardano.Block qualified as Consensus import Ouroboros.Consensus.HardFork.Combinator.AcrossEras as Consensus @@ -484,7 +484,7 @@ queryAccountState QueryInMode r IO - (Either UnsupportedNtcVersionError (Either EraMismatch L.AccountState)) + (Either UnsupportedNtcVersionError (Either EraMismatch L.ChainAccountState)) queryAccountState eon = querySbe eon QueryAccountState queryProposals diff --git a/cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs b/cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs index e9b7913450..46b4c3a61e 100644 --- a/cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs +++ b/cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs @@ -93,12 +93,12 @@ import Cardano.Ledger.Api qualified as L import Cardano.Ledger.Api.State.Query qualified as L import Cardano.Ledger.Binary import Cardano.Ledger.Binary.Plain qualified as Plain -import Cardano.Ledger.CertState qualified as L import Cardano.Ledger.Coin qualified as L import Cardano.Ledger.Credential qualified as Shelley import Cardano.Ledger.Shelley.API qualified as Shelley import Cardano.Ledger.Shelley.Core qualified as Core import Cardano.Ledger.Shelley.LedgerState qualified as L +import Cardano.Ledger.State qualified as L import Cardano.Slotting.EpochInfo (hoistEpochInfo) import Cardano.Slotting.Slot (WithOrigin (..)) import Cardano.Slotting.Time (SystemStart (..)) @@ -116,7 +116,6 @@ import Ouroboros.Consensus.Ledger.Query qualified as Consensus import Ouroboros.Consensus.Protocol.Abstract qualified as Consensus import Ouroboros.Consensus.Shelley.Ledger qualified as Consensus import Ouroboros.Consensus.Shelley.Ledger.Query.Types qualified as Consensus -import Ouroboros.Consensus.Shelley.Protocol.Abstract (ProtoCrypto) import Ouroboros.Network.Block (Serialised (..)) import Ouroboros.Network.PeerSelection.LedgerPeers.Type (LedgerPeerSnapshot) import Ouroboros.Network.Protocol.LocalStateQuery.Client (Some (..)) @@ -138,7 +137,7 @@ import Data.Singletons qualified as Singletons import Data.Text (Text) import Data.Text qualified as Text import Data.Word (Word64) -import GHC.Exts (IsList (..)) +import GHC.Exts (IsList (..), coerce) import GHC.Stack -- ---------------------------------------------------------------------------- @@ -286,7 +285,7 @@ data QueryInShelleyBasedEra era result where :: Set StakeCredential -> QueryInShelleyBasedEra era (Map StakeCredential L.Coin) QueryAccountState - :: QueryInShelleyBasedEra era L.AccountState + :: QueryInShelleyBasedEra era L.ChainAccountState QueryConstitution :: QueryInShelleyBasedEra era (L.Constitution (ShelleyLedgerEra era)) QueryGovState @@ -476,8 +475,19 @@ fromLedgerUTxO sbe (Shelley.UTxO utxo) = . toList $ utxo +-- FIXME: the following constructor is deprecated: +-- +-- GetStakeDistribution :: +-- BlockQuery (ShelleyBlock proto era) QFNoTables (PoolDistr (ProtoCrypto proto)) +-- +-- It is replaced by: +-- +-- GetStakeDistribution2 :: +-- BlockQuery (ShelleyBlock proto era) QFNoTables SL.PoolDistr +-- +-- The changes in 'fromShelleyPoolDistr' might not be correct, double-check before merging! fromShelleyPoolDistr - :: Consensus.PoolDistr StandardCrypto + :: L.PoolDistr -> Map (Hash StakePoolKey) Rational fromShelleyPoolDistr = -- TODO: write an appropriate property to show it is safe to use @@ -486,6 +496,7 @@ fromShelleyPoolDistr = . map (bimap StakePoolKeyHash Consensus.individualPoolStake) . toList . Consensus.unPoolDistr + . Consensus.fromLedgerPoolDistr fromShelleyDelegations :: Map @@ -564,7 +575,7 @@ toConsensusQueryShelleyBased sbe = \case QueryProtocolParameters -> Some (consensusQueryInEraInMode era Consensus.GetCurrentPParams) QueryStakeDistribution -> - Some (consensusQueryInEraInMode era Consensus.GetStakeDistribution) + Some (consensusQueryInEraInMode era Consensus.GetStakeDistribution2) QueryUTxO QueryUTxOWhole -> Some (consensusQueryInEraInMode era Consensus.GetUTxOWhole) QueryUTxO (QueryUTxOByAddress addrs) -> @@ -613,7 +624,7 @@ toConsensusQueryShelleyBased sbe = \case ) QueryPoolDistribution poolIds -> Some - (consensusQueryInEraInMode era (Consensus.GetCBOR (Consensus.GetPoolDistr (getPoolIds <$> poolIds)))) + (consensusQueryInEraInMode era (Consensus.GetCBOR (Consensus.GetPoolDistr2 (getPoolIds <$> poolIds)))) where getPoolIds :: Set PoolId -> Set (Shelley.KeyHash Shelley.StakePool) getPoolIds = Set.map (\(StakePoolKeyHash kh) -> kh) @@ -858,7 +869,6 @@ fromConsensusQueryResultShelleyBased . HasCallStack => ShelleyLedgerEra era ~ ledgerera => ConsensusProtocol era ~ protocol - => ProtoCrypto protocol ~ StandardCrypto => ShelleyBasedEra era -> QueryInShelleyBasedEra era result -> Consensus.BlockQuery (Consensus.ShelleyBlock protocol ledgerera) fp result' @@ -884,7 +894,7 @@ fromConsensusQueryResultShelleyBased sbe sbeQuery q' r' = _ -> fromConsensusQueryResultMismatch QueryStakeDistribution -> case q' of - Consensus.GetStakeDistribution -> fromShelleyPoolDistr r' + Consensus.GetStakeDistribution2 -> fromShelleyPoolDistr r' _ -> fromConsensusQueryResultMismatch QueryUTxO QueryUTxOWhole -> case q' of @@ -937,10 +947,25 @@ fromConsensusQueryResultShelleyBased sbe sbeQuery q' r' = Consensus.GetCBOR Consensus.GetPoolState{} -> SerialisedPoolState r' _ -> fromConsensusQueryResultMismatch + -- FIXME: the following constructor is deprecated: + -- GetPoolDistr :: + -- Maybe (Set (SL.KeyHash 'SL.StakePool)) -> + -- BlockQuery + -- (ShelleyBlock proto era) + -- QFNoTables + -- (PoolDistr (ProtoCrypto proto)) + -- It is replaced by: + -- GetPoolDistr2 :: + -- Maybe (Set (SL.KeyHash 'SL.StakePool)) -> + -- BlockQuery + -- (ShelleyBlock proto era) + -- QFNoTables + -- SL.PoolDistr + -- The changes here might not be correct, double-check before merging! QueryPoolDistribution{} -> case q' of - Consensus.GetCBOR Consensus.GetPoolDistr{} -> - SerialisedPoolDistribution r' + Consensus.GetCBOR Consensus.GetPoolDistr2{} -> + SerialisedPoolDistribution (coerce r') _ -> fromConsensusQueryResultMismatch QueryStakeSnapshot{} -> case q' of diff --git a/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs b/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs index 8a7530bcee..0555653c73 100644 --- a/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs +++ b/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs @@ -280,7 +280,6 @@ import Cardano.Ledger.BaseTypes (StrictMaybe (..)) import Cardano.Ledger.Binary (Annotated (..)) import Cardano.Ledger.Binary qualified as CBOR import Cardano.Ledger.Coin qualified as L -import Cardano.Ledger.Conway.Core qualified as L import Cardano.Ledger.Core () import Cardano.Ledger.Core qualified as Ledger import Cardano.Ledger.Credential qualified as Shelley diff --git a/cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs b/cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs index 3565f8f272..cbaaa9d0c4 100644 --- a/cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs +++ b/cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs @@ -58,7 +58,6 @@ import Cardano.Ledger.Alonzo.Core qualified as L import Cardano.Ledger.Api qualified as L import Cardano.Ledger.BaseTypes (SlotNo, StrictMaybe (..)) import Cardano.Ledger.Coin qualified as L -import Cardano.Ledger.Conway.Core qualified as L import Cardano.Ledger.Mary.Value qualified as L import Cardano.Ledger.Shelley.PParams qualified as L import Cardano.Ledger.TxIn qualified as L diff --git a/cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs b/cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs index 1f2c8df849..78cab6acf8 100644 --- a/cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs +++ b/cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs @@ -531,7 +531,7 @@ selectTxDatums :: TxBodyScriptData era -> Map L.DataHash (L.Data (ShelleyLedgerEra era)) selectTxDatums TxBodyNoScriptData = Map.empty -selectTxDatums (TxBodyScriptData _ (Alonzo.TxDats' datums) _) = datums +selectTxDatums (TxBodyScriptData _ (Alonzo.TxDats datums) _) = datums -- | Indicates whether a script is expected to fail or pass validation. data ScriptValidity @@ -1025,7 +1025,7 @@ makeShelleyBasedBootstrapWitness sbe nwOrAddr txbody (ByronSigningKey sk) = -- Byron era witnesses were weird. This reveals all that weirdness. Shelley.BootstrapWitness { Shelley.bwKey = vk - , Shelley.bwSig = signature + , Shelley.bwSignature = signature , Shelley.bwChainCode = chainCode , Shelley.bwAttributes = attributes } diff --git a/flake.nix b/flake.nix index d6daf44dd1..8cdfad019d 100644 --- a/flake.nix +++ b/flake.nix @@ -115,6 +115,8 @@ # Skip cross compilers for the shell shell.crossPlatforms = _: []; shell.shellHook = '' + export LANG="en_US.UTF-8" + export LOCALE_ARCHIVE="${nixpkgs.glibcLocales}/lib/locale/locale-archive" export PATH="$(git rev-parse --show-toplevel)/scripts/devshell:$PATH" '';