From 74086ede72321f5e455f9bdf4d4a854d58edd1f1 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Thu, 3 Oct 2024 18:35:49 +0200 Subject: [PATCH] Move exposed terms to `Cardano.Api.Byron.Misc` --- cardano-api/cardano-api.cabal | 3 +- .../internal/Cardano/Api/ByronDelegation.hs | 9 -- .../internal/Cardano/Api/ReexposeLedger.hs | 77 ---------------- .../internal/Cardano/Api/SpecialByron.hs | 7 +- cardano-api/internal/Cardano/Api/Tx/Body.hs | 2 - cardano-api/internal/Cardano/Api/TxIn.hs | 6 -- cardano-api/src/Cardano/Api/Byron.hs | 11 --- cardano-api/src/Cardano/Api/Byron/Misc.hs | 89 +++++++++++++++++++ 8 files changed, 93 insertions(+), 111 deletions(-) delete mode 100644 cardano-api/internal/Cardano/Api/ByronDelegation.hs create mode 100644 cardano-api/src/Cardano/Api/Byron/Misc.hs diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 352b0b05a..af8148c8c 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -62,7 +62,6 @@ library internal Cardano.Api.Address Cardano.Api.Anchor Cardano.Api.Block - Cardano.Api.ByronDelegation Cardano.Api.Certificate Cardano.Api.Convenience.Construction Cardano.Api.Convenience.Query @@ -236,6 +235,7 @@ library exposed-modules: Cardano.Api Cardano.Api.Byron + Cardano.Api.Byron.Misc Cardano.Api.ChainSync.Client Cardano.Api.ChainSync.ClientPipelined Cardano.Api.Crypto.Ed25519Bip32 @@ -251,6 +251,7 @@ library cardano-binary, cardano-crypto, cardano-crypto-class ^>=2.1.2, + cardano-ledger-byron, cryptonite, deepseq, memory, diff --git a/cardano-api/internal/Cardano/Api/ByronDelegation.hs b/cardano-api/internal/Cardano/Api/ByronDelegation.hs deleted file mode 100644 index 7cd855daf..000000000 --- a/cardano-api/internal/Cardano/Api/ByronDelegation.hs +++ /dev/null @@ -1,9 +0,0 @@ --- | Functions and types for working with delegation certificates in Byron -module Cardano.Api.ByronDelegation - ( ACertificate (..) - , isValid - , signCertificate - ) -where - -import Cardano.Chain.Delegation (ACertificate (..), isValid, signCertificate) diff --git a/cardano-api/internal/Cardano/Api/ReexposeLedger.hs b/cardano-api/internal/Cardano/Api/ReexposeLedger.hs index 13c62578f..080b673e4 100644 --- a/cardano-api/internal/Cardano/Api/ReexposeLedger.hs +++ b/cardano-api/internal/Cardano/Api/ReexposeLedger.hs @@ -86,74 +86,16 @@ module Cardano.Api.ReexposeLedger , drepDepositL , csCommitteeCredsL -- Byron - , AddrAttributes (..) - , Address - , addressDetailedF - , addressF - , addressHash - , ApplicationName (..) , Annotated (..) - , aTaAnnotation - , BlockCount (..) - , Byron.CompactTxIn - , Byron.CompactTxOut - , Byron.fromCompactTxIn - , Byron.fromCompactTxOut , byronProtVer , Byron.Tx (..) - , Byron.unUTxO , ByteSpan (..) - , Certificate - , checkApplicationName - , checkVerKeyAddress - , checkSystemTag - , Config (..) - , decCBORABlockOrBoundary - , decodeAddressBase58 , Decoder - , defaultUTxOConfiguration - , EpochNumber (..) - , FakeAvvmOptions (..) , fromCBOR - , GeneratedSecrets (..) - , generateGenesisData - , GenesisAvvmBalances (..) - , GenesisData (..) - , GenesisDataError (..) - , GenesisDataGenerationError (..) - , GenesisDelegation (..) - , GenesisDelegationError - , GenesisHash (..) - , GenesisInitializer (..) - , GenesisSpec (..) - , genesisUtxo - , InstallerHash (..) - , Lovelace - , LovelacePortion - , lovelacePortionToRational - , mkAttributes - , mkGenesisDelegation - , mkGenesisSpec - , mkKnownLovelace - , NetworkMagic (..) - , NumSoftwareVersion - , PoorSecret (..) - , Proposal - , ProtocolParameters (..) - , rationalToLovelacePortion - , readGenesisData , serialize' , slice - , SlotNumber (..) - , SoftforkRule (..) - , SoftwareVersion (..) - , SystemTag (..) - , TestnetBalanceOptions (..) - , TxFeePolicy (..) - , TxSizeLinear (..) , toCBOR , toPlainDecoder - , txOutAddress -- Shelley , secondsToNominalDiffTimeMicro -- Babbage @@ -199,25 +141,6 @@ module Cardano.Api.ReexposeLedger ) where -import Cardano.Chain.Block (decCBORABlockOrBoundary) -import Cardano.Chain.Common (AddrAttributes (..), Address, BlockCount (..), Lovelace, - LovelacePortion, NetworkMagic (..), TxFeePolicy (..), TxSizeLinear (..), - addressDetailedF, addressF, addressHash, checkVerKeyAddress, decodeAddressBase58, - lovelacePortionToRational, mkAttributes, mkKnownLovelace, - rationalToLovelacePortion) -import Cardano.Chain.Delegation (Certificate) -import Cardano.Chain.Genesis (Config (..), FakeAvvmOptions (..), GeneratedSecrets (..), - GenesisAvvmBalances (..), GenesisData (..), GenesisDataError (..), - GenesisDataGenerationError (..), GenesisDelegation (..), GenesisDelegationError, - GenesisHash (..), GenesisInitializer (..), GenesisSpec (..), PoorSecret, - TestnetBalanceOptions (..), generateGenesisData, mkGenesisDelegation, - mkGenesisSpec, poorSecretToKey, readGenesisData) -import Cardano.Chain.Slotting (EpochNumber (..), SlotNumber (..)) -import Cardano.Chain.Update (ApplicationName (..), InstallerHash (..), NumSoftwareVersion, - Proposal, ProtocolParameters (..), SoftforkRule (..), SoftwareVersion (..), - SystemTag (..), checkApplicationName, checkSystemTag) -import Cardano.Chain.UTxO (aTaAnnotation, defaultUTxOConfiguration, genesisUtxo, - txOutAddress) import qualified Cardano.Chain.UTxO as Byron import Cardano.Crypto.Hash.Class (hashFromBytes, hashToBytes) import Cardano.Ledger.Alonzo.Core (AsIxItem (AsIxItem), CoinPerWord (..), diff --git a/cardano-api/internal/Cardano/Api/SpecialByron.hs b/cardano-api/internal/Cardano/Api/SpecialByron.hs index c1f4c76be..9f66f7c3d 100644 --- a/cardano-api/internal/Cardano/Api/SpecialByron.hs +++ b/cardano-api/internal/Cardano/Api/SpecialByron.hs @@ -15,9 +15,6 @@ module Cardano.Api.SpecialByron , applicationName , applicationVersion , softwareVersion - , KeyHash - , ProtocolVersion (..) - , Vote ) where @@ -27,11 +24,11 @@ import Cardano.Api.NetworkId (NetworkId, toByronProtocolMagicId) import Cardano.Api.SerialiseRaw import qualified Cardano.Binary as Binary -import Cardano.Chain.Common (KeyHash, LovelacePortion, TxFeePolicy) +import Cardano.Chain.Common (LovelacePortion, TxFeePolicy) import Cardano.Chain.Slotting import Cardano.Chain.Update (AProposal (aBody, annotation), InstallerHash, ProposalBody (ProposalBody), ProtocolParametersUpdate (..), ProtocolVersion (..), - SoftforkRule, SoftwareVersion, SystemTag, UpId, Vote, mkVote, recoverUpId, + SoftforkRule, SoftwareVersion, SystemTag, UpId, mkVote, recoverUpId, recoverVoteId, signProposal) import qualified Cardano.Chain.Update as Update import qualified Cardano.Chain.Update.Vote as ByronVote diff --git a/cardano-api/internal/Cardano/Api/Tx/Body.hs b/cardano-api/internal/Cardano/Api/Tx/Body.hs index c8edc5a5d..0e40356f0 100644 --- a/cardano-api/internal/Cardano/Api/Tx/Body.hs +++ b/cardano-api/internal/Cardano/Api/Tx/Body.hs @@ -80,7 +80,6 @@ module Cardano.Api.Tx.Body , TxIx (..) , genesisUTxOPseudoTxIn , getReferenceInputsSizeForTxIds - , ByronTxIn -- * Transaction outputs , CtxTx @@ -96,7 +95,6 @@ module Cardano.Api.Tx.Body , parseHash , TxOutInAnyEra (..) , txOutInAnyEra - , ByronTxOut -- * Other transaction body types , TxInsCollateral (..) diff --git a/cardano-api/internal/Cardano/Api/TxIn.hs b/cardano-api/internal/Cardano/Api/TxIn.hs index e4f615aee..54643a8d8 100644 --- a/cardano-api/internal/Cardano/Api/TxIn.hs +++ b/cardano-api/internal/Cardano/Api/TxIn.hs @@ -15,8 +15,6 @@ module Cardano.Api.TxIn ( -- * Transaction inputs TxIn (..) , TxIx (..) - , ByronTxIn - , ByronTxOut -- * Transaction Ids , TxId (..) @@ -172,7 +170,3 @@ toShelleyTxIn (TxIn txid (TxIx txix)) = fromShelleyTxIn :: Ledger.TxIn StandardCrypto -> TxIn fromShelleyTxIn (Ledger.TxIn txid (Ledger.TxIx txix)) = TxIn (fromShelleyTxId txid) (TxIx (fromIntegral txix)) - -type ByronTxIn = Byron.TxIn - -type ByronTxOut = Byron.TxOut diff --git a/cardano-api/src/Cardano/Api/Byron.hs b/cardano-api/src/Cardano/Api/Byron.hs index 7d1e76921..616dea34a 100644 --- a/cardano-api/src/Cardano/Api/Byron.hs +++ b/cardano-api/src/Cardano/Api/Byron.hs @@ -11,11 +11,6 @@ module Cardano.Api.Byron , SigningKey (..) , SomeByronSigningKey (..) - -- * Delegation - , Dlg.ACertificate (..) - , Dlg.isValid - , Dlg.signCertificate - -- * Hashes , Hash (..) @@ -76,13 +71,8 @@ module Cardano.Api.Byron , ByronVote (..) , makeByronVote , toByronLedgertoByronVote - , KeyHash - , ProtocolVersion (..) - , Vote -- ** Conversions - , ByronTxIn - , ByronTxOut , fromByronTxIn , toByronLovelace , toByronNetworkMagic @@ -102,7 +92,6 @@ where import Cardano.Api import Cardano.Api.Address -import Cardano.Api.ByronDelegation as Dlg import Cardano.Api.Keys.Byron import Cardano.Api.NetworkId import Cardano.Api.SerialiseLedgerCddl diff --git a/cardano-api/src/Cardano/Api/Byron/Misc.hs b/cardano-api/src/Cardano/Api/Byron/Misc.hs new file mode 100644 index 000000000..abbdc2635 --- /dev/null +++ b/cardano-api/src/Cardano/Api/Byron/Misc.hs @@ -0,0 +1,89 @@ +module Cardano.Api.Byron.Misc + ( ACertificate (..) + , AddrAttributes (..) + , Address + , ApplicationName (..) + , ATxAux (..) + , BlockCount (..) + , Certificate + , CompactTxIn + , CompactTxOut + , Config (..) + , EpochNumber (..) + , FakeAvvmOptions (..) + , GeneratedSecrets (..) + , GenesisAvvmBalances (..) + , GenesisData (..) + , GenesisDataError (..) + , GenesisDataGenerationError (..) + , GenesisDelegation (..) + , GenesisDelegationError + , GenesisHash (..) + , GenesisInitializer (..) + , GenesisSpec (..) + , InstallerHash (..) + , KeyHash + , Lovelace + , LovelacePortion + , NetworkMagic (..) + , NumSoftwareVersion + , PoorSecret (..) + , Proposal + , ProtocolParameters (..) + , ProtocolVersion (..) + , SlotNumber (..) + , SoftforkRule (..) + , SoftwareVersion (..) + , SystemTag (..) + , TestnetBalanceOptions (..) + , TxFeePolicy (..) + , TxIn (..) + , TxOut (..) + , TxSizeLinear (..) + , UTxO (..) + , Vote + , addressDetailedF + , addressF + , addressHash + , checkApplicationName + , checkSystemTag + , checkVerKeyAddress + , decCBORABlockOrBoundary + , decodeAddressBase58 + , defaultUTxOConfiguration + , fromCompactTxIn + , fromCompactTxOut + , generateGenesisData + , genesisUtxo + , isValid + , lovelacePortionToRational + , mkAttributes + , mkGenesisDelegation + , mkGenesisSpec + , mkKnownLovelace + , rationalToLovelacePortion + , readGenesisData + , signCertificate + ) +where + +import Cardano.Chain.Block (decCBORABlockOrBoundary) +import Cardano.Chain.Common (AddrAttributes (..), Address, BlockCount (..), KeyHash, + Lovelace, LovelacePortion, NetworkMagic (..), TxFeePolicy (..), + TxSizeLinear (..), addressDetailedF, addressF, addressHash, checkVerKeyAddress, + decodeAddressBase58, lovelacePortionToRational, mkAttributes, mkKnownLovelace, + rationalToLovelacePortion) +import Cardano.Chain.Delegation (ACertificate (..), Certificate, isValid, signCertificate) +import Cardano.Chain.Genesis (Config (..), FakeAvvmOptions (..), GeneratedSecrets (..), + GenesisAvvmBalances (..), GenesisData (..), GenesisDataError (..), + GenesisDataGenerationError (..), GenesisDelegation (..), GenesisDelegationError, + GenesisHash (..), GenesisInitializer (..), GenesisSpec (..), PoorSecret (..), + TestnetBalanceOptions (..), generateGenesisData, mkGenesisDelegation, + mkGenesisSpec, readGenesisData) +import Cardano.Chain.Slotting (EpochNumber (..), SlotNumber (..)) +import Cardano.Chain.Update (ApplicationName (..), InstallerHash (..), NumSoftwareVersion, + Proposal, ProtocolParameters (..), ProtocolVersion (..), SoftforkRule (..), + SoftwareVersion (..), SystemTag (..), Vote, checkApplicationName, checkSystemTag) +import Cardano.Chain.UTxO (ATxAux (..), CompactTxIn, CompactTxOut, TxIn (..), TxOut (..), + UTxO (..), defaultUTxOConfiguration, fromCompactTxIn, fromCompactTxOut, + genesisUtxo)