diff --git a/cabal.project b/cabal.project index e99f9f9b2f..2a6fd7c868 100644 --- a/cabal.project +++ b/cabal.project @@ -13,9 +13,9 @@ repository cardano-haskell-packages source-repository-package type: git location: https://github.com/intersectmbo/cardano-api.git - tag: 74086ede72321f5e455f9bdf4d4a854d58edd1f1 + tag: a4f4fbdc1dce80f9e6e2f39155b288c543c5a027 subdir: cardano-api - --sha256: sha256-0zolhYSNSvpeXDaeBRITV08X/9k9cYeaEL+c7Y5l9DE= + --sha256: sha256-pANaH73+3ZxRE1Pqd7/h9Oiop81Wz1GJACB2+/8FZY4= -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them diff --git a/cardano-cli/src/Cardano/CLI/Byron/Commands.hs b/cardano-cli/src/Cardano/CLI/Byron/Commands.hs index 3b3401a2e5..1bf4e06bc8 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Commands.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Commands.hs @@ -12,8 +12,7 @@ module Cardano.CLI.Byron.Commands where import Cardano.Api hiding (GenesisParameters) -import Cardano.Api.Byron hiding (GenesisParameters) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.CLI.Byron.Genesis import Cardano.CLI.Byron.Key @@ -108,7 +107,7 @@ data NodeCmds Byron.SystemTag Byron.InstallerHash FilePath - ByronProtocolParametersUpdate + Byron.ByronProtocolParametersUpdate | -- | Update proposal filepath. SubmitUpdateProposal SocketPath diff --git a/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs b/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs index c7c8079d53..ed6511a043 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs @@ -14,7 +14,6 @@ module Cardano.CLI.Byron.Delegation where import Cardano.Api.Byron -import qualified Cardano.Api.Byron.Misc as Byron import qualified Cardano.Api.Ledger as L import Cardano.CLI.Byron.Key (ByronKeyFailure, renderByronKeyFailure) @@ -53,12 +52,12 @@ renderByronDelegationError = \case -- issuer key, for a given protocol magic and coming into effect at given epoch. issueByronGenesisDelegation :: ProtocolMagicId - -> Byron.EpochNumber + -> EpochNumber -> Crypto.SigningKey -> Crypto.VerificationKey - -> Byron.Certificate + -> Certificate issueByronGenesisDelegation magic epoch issuerSK delegateVK' = - Byron.signCertificate magic delegateVK' epoch $ + signCertificate magic delegateVK' epoch $ Crypto.noPassSafeSigner issuerSK -- | Verify that a certificate signifies genesis delegation by assumed genesis key @@ -74,14 +73,14 @@ checkByronGenesisDelegation (CertificateFile certF) magic issuer delegate = do ecert <- liftIO $ canonicalDecodePretty <$> LB.readFile certF case ecert of Left e -> left $ DlgCertificateDeserialisationFailed certF e - Right (cert :: Byron.Certificate) -> do + Right (cert :: Certificate) -> do let issues = checkDlgCert cert magic issuer delegate unless (null issues) $ left $ CertificateValidationErrors certF issues checkDlgCert - :: Byron.ACertificate a + :: ACertificate a -> ProtocolMagicId -> Crypto.VerificationKey -> Crypto.VerificationKey @@ -89,44 +88,44 @@ checkDlgCert checkDlgCert cert magic issuerVK' delegateVK' = mconcat [ [ sformat "Certificate does not have a valid signature." - | not (Byron.isValid magic' cert') + | not (isValid magic' cert') ] , [ sformat ("Certificate issuer " . vkF . " doesn't match expected: " . vkF) - (Byron.issuerVK cert) + (issuerVK cert) issuerVK' - | Byron.issuerVK cert /= issuerVK' + | issuerVK cert /= issuerVK' ] , [ sformat ("Certificate delegate " . vkF . " doesn't match expected: " . vkF) - (Byron.delegateVK cert) + (delegateVK cert) delegateVK' - | Byron.delegateVK cert /= delegateVK' + | delegateVK cert /= delegateVK' ] ] where magic' :: L.Annotated ProtocolMagicId ByteString magic' = L.Annotated magic (L.serialize' L.byronProtVer magic) - epoch :: Byron.EpochNumber - epoch = L.unAnnotated $ Byron.aEpoch cert + epoch :: EpochNumber + epoch = L.unAnnotated $ aEpoch cert - cert' :: Byron.ACertificate ByteString + cert' :: ACertificate ByteString cert' = let unannotated = cert - { Byron.aEpoch = L.Annotated epoch () - , Byron.annotation = () + { aEpoch = L.Annotated epoch () + , annotation = () } in unannotated - { Byron.annotation = L.serialize' L.byronProtVer unannotated - , Byron.aEpoch = L.Annotated epoch (L.serialize' L.byronProtVer epoch) + { annotation = L.serialize' L.byronProtVer unannotated + , aEpoch = L.Annotated epoch (L.serialize' L.byronProtVer epoch) } vkF :: forall r. Format r (Crypto.VerificationKey -> r) vkF = Crypto.fullVerificationKeyF -serialiseDelegationCert :: Byron.Certificate -> ByteString +serialiseDelegationCert :: Certificate -> ByteString serialiseDelegationCert = LB.toStrict . canonicalEncodePretty serialiseByronWitness :: SomeByronSigningKey -> ByteString diff --git a/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs b/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs index c74be3ec51..2abec861bb 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs @@ -15,7 +15,7 @@ where import Cardano.Api (Key (..), NetworkId, writeSecrets) import Cardano.Api.Byron (ByronKey, SerialiseAsRawBytes (..), SigningKey (..), toByronRequiresNetworkMagic) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.CLI.Byron.Delegation import Cardano.CLI.Byron.Key diff --git a/cardano-cli/src/Cardano/CLI/Byron/Key.hs b/cardano-cli/src/Cardano/CLI/Byron/Key.hs index 31eaf93961..d439619373 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Key.hs @@ -17,7 +17,6 @@ module Cardano.CLI.Byron.Key where import Cardano.Api.Byron -import Cardano.Api.Byron.Misc import Cardano.CLI.Types.Common import qualified Cardano.Crypto.Signing as Crypto diff --git a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs index 0203aa9435..e678e0de29 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs @@ -25,9 +25,8 @@ module Cardano.CLI.Byron.Parsers where import Cardano.Api hiding (GenesisParameters, UpdateProposal, parseFilePath) -import Cardano.Api.Byron (Address (..), ByronProtocolParametersUpdate (..), - toByronLovelace) -import qualified Cardano.Api.Byron.Misc as Byron +import Cardano.Api.Byron (ByronProtocolParametersUpdate (..), toByronLovelace) +import qualified Cardano.Api.Byron as Byron import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley (ReferenceScript (ReferenceScriptNone)) diff --git a/cardano-cli/src/Cardano/CLI/Byron/Run.hs b/cardano-cli/src/Cardano/CLI/Byron/Run.hs index 9ef2a6cf31..e24ccd27ae 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Run.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Run.hs @@ -11,7 +11,7 @@ where import Cardano.Api hiding (GenesisParameters, UpdateProposal) import Cardano.Api.Byron (SomeByronSigningKey (..), serializeByronTx) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.CLI.Byron.Commands import Cardano.CLI.Byron.Delegation diff --git a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs index 9e0656cef1..0fc3099ef4 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs @@ -24,8 +24,7 @@ module Cardano.CLI.Byron.Tx where import Cardano.Api -import Cardano.Api.Byron -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import qualified Cardano.Api.Ledger as L import qualified Cardano.Binary as Binary @@ -85,7 +84,7 @@ prettyAddress (ByronAddress addr) = addr -- TODO: Move to cardano-api -readByronTx :: TxFile In -> ExceptT ByronTxError IO (ATxAux ByteString) +readByronTx :: TxFile In -> ExceptT ByronTxError IO (Byron.ATxAux ByteString) readByronTx (File fp) = do txBS <- liftIO $ LB.readFile fp case fromCborTxAux txBS of @@ -94,7 +93,7 @@ readByronTx (File fp) = do -- | The 'GenTx' is all the kinds of transactions that can be submitted -- and \"normal\" Byron transactions are just one of the kinds. -normalByronTxToGenTx :: ATxAux ByteString -> GenTx ByronBlock +normalByronTxToGenTx :: Byron.ATxAux ByteString -> GenTx ByronBlock normalByronTxToGenTx tx' = Byron.ByronTx (Byron.byronIdTx tx') tx' -- | Given a genesis, and a pair of a genesis public key and address, @@ -145,12 +144,12 @@ genesisUTxOTxIn gc vk genAddr = txSpendGenesisUTxOByronPBFT :: Byron.Config -> NetworkId - -> SomeByronSigningKey + -> Byron.SomeByronSigningKey -> Address ByronAddr -> [TxOut CtxTx ByronEra] - -> ATxAux ByteString + -> Byron.ATxAux ByteString txSpendGenesisUTxOByronPBFT gc nId sk (ByronAddress bAddr) outs = - let txins = [(fromByronTxIn txIn, BuildTxWith (KeyWitness KeyWitnessForSpending))] + let txins = [(Byron.fromByronTxIn txIn, BuildTxWith (KeyWitness KeyWitnessForSpending))] in case makeByronTransactionBody txins outs of Left err -> error $ "Error occurred while creating a Byron genesis based UTxO transaction: " <> show err Right txBody -> @@ -166,10 +165,10 @@ txSpendGenesisUTxOByronPBFT gc nId sk (ByronAddress bAddr) outs = -- signed by the given key. txSpendUTxOByronPBFT :: NetworkId - -> SomeByronSigningKey + -> Byron.SomeByronSigningKey -> [TxIn] -> [TxOut CtxTx ByronEra] - -> ATxAux ByteString + -> Byron.ATxAux ByteString txSpendUTxOByronPBFT nId sk txIns outs = do let apiTxIns = [(txIn, BuildTxWith (KeyWitness KeyWitnessForSpending)) | txIn <- txIns] @@ -180,11 +179,11 @@ txSpendUTxOByronPBFT nId sk txIns outs = do in makeSignedByronTransaction [bWit] txBody fromByronWitness - :: SomeByronSigningKey -> NetworkId -> L.Annotated L.Tx ByteString -> KeyWitness ByronEra + :: Byron.SomeByronSigningKey -> NetworkId -> L.Annotated L.Tx ByteString -> KeyWitness ByronEra fromByronWitness bw nId txBody = case bw of - AByronSigningKeyLegacy sk -> makeByronKeyWitness nId txBody sk - AByronSigningKey sk' -> makeByronKeyWitness nId txBody sk' + Byron.AByronSigningKeyLegacy sk -> makeByronKeyWitness nId txBody sk + Byron.AByronSigningKey sk' -> makeByronKeyWitness nId txBody sk' -- | Submit a transaction to a node specified by topology info. nodeSubmitTx @@ -210,7 +209,7 @@ nodeSubmitTx nodeSocketPath network gentx = do return () -- TODO: remove these local definitions when the updated ledger lib is available -fromCborTxAux :: LB.ByteString -> Either Binary.DecoderError (ATxAux B.ByteString) +fromCborTxAux :: LB.ByteString -> Either Binary.DecoderError (Byron.ATxAux B.ByteString) fromCborTxAux lbs = annotationBytes lbs <$> Binary.decodeFullDecoder @@ -221,5 +220,5 @@ fromCborTxAux lbs = annotationBytes :: Functor f => LB.ByteString -> f L.ByteSpan -> f B.ByteString annotationBytes bytes = fmap (LB.toStrict . L.slice bytes) -toCborTxAux :: ATxAux ByteString -> LB.ByteString +toCborTxAux :: Byron.ATxAux ByteString -> LB.ByteString toCborTxAux = LB.fromStrict . Byron.aTaAnnotation -- The ByteString anotation is the CBOR encoded version. diff --git a/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs b/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs index b9df4347bc..0c81225b0f 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs @@ -14,7 +14,7 @@ where import Cardano.Api (NetworkId, SerialiseAsRawBytes (..), SocketPath) import Cardano.Api.Byron (AsType (AsByronUpdateProposal), ByronProtocolParametersUpdate, ByronUpdateProposal, makeByronUpdateProposal, toByronLedgerUpdateProposal) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.CLI.Byron.Genesis (ByronGenesisError) import Cardano.CLI.Byron.Key (ByronKeyFailure, readByronSigningKey) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs index 9d4cd19700..0c7abbc8fe 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs @@ -18,7 +18,7 @@ module Cardano.CLI.EraBased.Commands.Genesis ) where -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.Api.Ledger (Coin) import Cardano.Api.Shelley diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs index 4baafc471b..8d26479e87 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs @@ -10,7 +10,7 @@ module Cardano.CLI.EraBased.Options.Genesis where import Cardano.Api hiding (QueryInShelleyBasedEra (..), parseFilePath) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.Api.Ledger (Coin (..)) import Cardano.CLI.Environment (EnvCli (..)) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs index 349cfcfb79..08735bfa20 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs @@ -30,7 +30,7 @@ where import Cardano.Api import Cardano.Api.Byron (toByronLovelace, toByronProtocolMagicId, toByronRequiresNetworkMagic) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron hiding (GenesisParameters, SigningKey) import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/Common.hs index 287c14002c..70af39090f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/Common.hs @@ -24,8 +24,7 @@ where import Cardano.Api hiding (ConwayEra) import Cardano.Api.Ledger (AlonzoGenesis, ConwayGenesis, StandardCrypto) import qualified Cardano.Api.Ledger as L -import Cardano.Api.Shelley (Address (ShelleyAddress), ShelleyGenesis, ShelleyLedgerEra, - decodeAlonzoGenesis) +import Cardano.Api.Shelley (ShelleyGenesis, ShelleyLedgerEra, decodeAlonzoGenesis) import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.GenesisCmdError diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 3b60bf9088..42211b9bbf 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -39,7 +39,6 @@ where import Cardano.Api hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.Api as Api -import Cardano.Api.Byron hiding (QueryInShelleyBasedEra (..)) import Cardano.Api.Ledger (strictMaybeToMaybe) import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 40aae5774e..8339e3e90a 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -34,8 +34,7 @@ module Cardano.CLI.EraBased.Run.Transaction where import Cardano.Api -import Cardano.Api.Byron hiding (SomeByronSigningKey (..)) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import qualified Cardano.Api.Experimental as Exp import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley @@ -1645,9 +1644,9 @@ mkShelleyBootstrapWitness mkShelleyBootstrapWitness _ Nothing _ (ShelleyBootstrapWitnessSigningKeyData _ Nothing) = Left MissingNetworkIdOrByronAddressError mkShelleyBootstrapWitness sbe (Just nw) txBody (ShelleyBootstrapWitnessSigningKeyData skey Nothing) = - Right $ makeShelleyBootstrapWitness sbe (WitnessNetworkId nw) txBody skey + Right $ makeShelleyBootstrapWitness sbe (Byron.WitnessNetworkId nw) txBody skey mkShelleyBootstrapWitness sbe _ txBody (ShelleyBootstrapWitnessSigningKeyData skey (Just addr)) = - Right $ makeShelleyBootstrapWitness sbe (WitnessByronAddress addr) txBody skey + Right $ makeShelleyBootstrapWitness sbe (Byron.WitnessByronAddress addr) txBody skey -- | Attempt to construct Shelley bootstrap witnesses until an error is -- encountered. diff --git a/cardano-cli/src/Cardano/CLI/Helpers.hs b/cardano-cli/src/Cardano/CLI/Helpers.hs index b7640b2b81..1e0687b8ad 100644 --- a/cardano-cli/src/Cardano/CLI/Helpers.hs +++ b/cardano-cli/src/Cardano/CLI/Helpers.hs @@ -19,7 +19,7 @@ module Cardano.CLI.Helpers where import Cardano.Api (AnyCardanoEra (..), CardanoEra (ConwayEra), ToCardanoEra (..)) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import qualified Cardano.Api.Ledger as L import Cardano.CLI.Pretty (Doc, pretty, pshow) diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index 825af93a61..8240b1c093 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -44,7 +44,7 @@ import Cardano.Api as Api import Cardano.Api.Byron (KeyWitness (ByronKeyWitness)) import Cardano.Api.Ledger (extractHash, strictMaybeToMaybe) import qualified Cardano.Api.Ledger as L -import Cardano.Api.Shelley (Address (ShelleyAddress), Hash (..), +import Cardano.Api.Shelley (Hash (..), KeyWitness (ShelleyBootstrapWitness, ShelleyKeyWitness), Proposal (..), ShelleyLedgerEra, StakeAddress (..), Tx (ShelleyTx), fromShelleyPaymentCredential, fromShelleyStakeReference, diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Genesis.hs b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Genesis.hs index 153411f9ad..ce34840f43 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Commands/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Commands/Genesis.hs @@ -7,7 +7,7 @@ module Cardano.CLI.Legacy.Commands.Genesis ) where -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.Api.Ledger (Coin) import Cardano.Api.Shelley diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index 4109c2a30d..e618806008 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -19,7 +19,7 @@ module Cardano.CLI.Legacy.Options where import Cardano.Api hiding (QueryInShelleyBasedEra (..), parseFilePath) -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.Api.Ledger (Coin (..)) import Cardano.CLI.Environment diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs index b0f8137cd2..fa1dac1c68 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs @@ -10,7 +10,7 @@ module Cardano.CLI.Legacy.Run.Genesis where import Cardano.Api -import qualified Cardano.Api.Byron.Misc as Byron +import qualified Cardano.Api.Byron as Byron import Cardano.Api.Ledger (Coin (..)) import Cardano.CLI.EraBased.Commands.Genesis