diff --git a/cabal.project b/cabal.project index c807b7d072..83c89e3fb4 100644 --- a/cabal.project +++ b/cabal.project @@ -43,3 +43,60 @@ write-ghc-environment-files: always -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. + + + +source-repository-package + type: git + location: https://github.com/input-output-hk/cardano-ledger + tag: d4dfc0e5e519c09e525f99c954f6816a340bdc87 + 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/crypto/test + eras/byron/ledger/executable-spec + eras/byron/ledger/impl + eras/byron/ledger/impl/test + eras/conway/impl + eras/conway/test-suite + eras/mary/impl + eras/shelley-ma/test-suite + eras/shelley/impl + eras/shelley/test-suite + libs/cardano-data + libs/cardano-ledger-api + libs/cardano-ledger-binary + libs/cardano-ledger-core + libs/cardano-ledger-pretty + libs/cardano-ledger-test + libs/cardano-protocol-tpraos + libs/ledger-state + libs/non-integral + libs/plutus-preprocessor + libs/set-algebra + libs/small-steps-test + libs/small-steps + libs/vector-map + +source-repository-package + type: git + location: https://github.com/input-output-hk/ouroboros-consensus + tag: b2b7d4926e1183b72e5653bf40e64c226e0efb72 + subdir: + ouroboros-consensus + ouroboros-consensus-cardano + ouroboros-consensus-diffusion + ouroboros-consensus-protocol + +source-repository-package + type: git + location: https://github.com/input-output-hk/cardano-api + tag: 1d8bc06db767c47d653a9fef0b01d8948efb18f6 + subdir: + cardano-api + cardano-api-gen diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 1d379c955e..7746a104b6 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -137,7 +137,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.14 + , cardano-api ^>= 8.15 , cardano-binary , cardano-crypto , cardano-crypto-class >= 2.1.1 @@ -170,7 +170,7 @@ library , network , optparse-applicative-fork , ouroboros-consensus >= 0.9 - , ouroboros-consensus-cardano >= 0.7 + , ouroboros-consensus-cardano >= 0.8 , ouroboros-consensus-protocol >= 0.5.0.4 , ouroboros-network-api , ouroboros-network-protocols @@ -224,7 +224,7 @@ test-suite cardano-cli-test , base16-bytestring , bech32 >= 1.1.0 , bytestring - , cardano-api:{cardano-api, internal} ^>= 8.14 + , cardano-api:{cardano-api, internal} ^>= 8.15 , cardano-api-gen ^>= 8.1.1.0 , cardano-cli , cardano-cli:cardano-cli-test-lib @@ -268,7 +268,7 @@ test-suite cardano-cli-golden build-depends: aeson >= 1.5.6.0 , base16-bytestring , bytestring - , cardano-api:{cardano-api, gen} ^>= 8.14 + , cardano-api:{cardano-api, gen} ^>= 8.15 , cardano-binary , cardano-cli , cardano-cli:cardano-cli-test-lib diff --git a/cardano-cli/src/Cardano/CLI/Commands/Governance.hs b/cardano-cli/src/Cardano/CLI/Commands/Governance.hs index bc3d070cc1..7b477ff07a 100644 --- a/cardano-cli/src/Cardano/CLI/Commands/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Commands/Governance.hs @@ -125,7 +125,7 @@ runGovernanceCreateVoteCmd -> VerificationKeyOrFile StakePoolKey -> VoteFile Out -> ExceptT GovernanceCmdError IO () -runGovernanceCreateVoteCmd anyEra vChoice vType govActionTxIn votingStakeCred oFp = do +runGovernanceCreateVoteCmd anyEra vChoice vType (TxIn govTxInIdentifier _govTxId) votingStakeCred oFp = do AnyShelleyBasedEra sbe <- pure anyEra vStakePoolKey <- firstExceptT ReadFileError . newExceptT $ readVerificationKeyOrFile AsStakePoolKey votingStakeCred let stakePoolKeyHash = verificationKeyHash vStakePoolKey @@ -133,18 +133,18 @@ runGovernanceCreateVoteCmd anyEra vChoice vType govActionTxIn votingStakeCred oF case vType of VCC -> do votingCred <- hoistEither $ first VotingCredentialDecodeGovCmdEror $ toVotingCredential sbe vStakeCred - let govActIdentifier = makeGoveranceActionId sbe govActionTxIn + let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier (error "TODO: Conway era - the TxInId does not determine the govActId") voteProcedure = createVotingProcedure sbe vChoice (VoterCommittee votingCred) govActIdentifier firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing voteProcedure VDR -> do votingCred <- hoistEither $ first VotingCredentialDecodeGovCmdEror $ toVotingCredential sbe vStakeCred - let govActIdentifier = makeGoveranceActionId sbe govActionTxIn + let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier (error "TODO: Conway era - the TxInId does not determine the govActId") voteProcedure = createVotingProcedure sbe vChoice (VoterDRep votingCred) govActIdentifier firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing voteProcedure VSP -> do - let govActIdentifier = makeGoveranceActionId sbe govActionTxIn + let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier (error "TODO: Conway era - the TxInId does not determine the govActId") voteProcedure = createVotingProcedure sbe vChoice (VoterSpo stakePoolKeyHash) govActIdentifier firstExceptT WriteFileError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope oFp Nothing voteProcedure diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Vote.hs index ef1134b670..1d0700250f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Vote.hs @@ -23,7 +23,7 @@ runGovernanceVote :: AnyVote -> File () Out -> ExceptT EraBasedVoteError IO () -runGovernanceVote (ConwayOnwardsVote cOnwards v govTxInIdentifier anyStake) outFp = +runGovernanceVote (ConwayOnwardsVote cOnwards v (TxIn govTxInIdentifier _govTxId) anyStake) outFp = case anyStake of AnyDRepVerificationKeyOrHashOrFile stake -> do let sbe = conwayEraOnwardsToShelleyBasedEra cOnwards -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards @@ -32,7 +32,7 @@ runGovernanceVote (ConwayOnwardsVote cOnwards v govTxInIdentifier anyStake) outF let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h votingCred <- hoistEither $ first EraBasedVotingCredentialDecodeError $ toVotingCredential sbe vStakeCred - let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier + let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier (error "TODO: Conway era - the TxInId does not determine the govActId") voteProcedure = createVotingProcedure sbe v (VoterDRep votingCred) govActIdentifier firstExceptT EraBasedVoteWriteError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope outFp Nothing voteProcedure @@ -42,7 +42,7 @@ runGovernanceVote (ConwayOnwardsVote cOnwards v govTxInIdentifier anyStake) outF h <- firstExceptT EraBasedVoteReadError . newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsStakePoolKey stake - let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier + let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier (error "TODO: Conway era - the TxInId does not determine the govActId") voteProcedure = createVotingProcedure sbe v (VoterSpo h) govActIdentifier firstExceptT EraBasedVoteWriteError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope outFp Nothing voteProcedure @@ -54,7 +54,7 @@ runGovernanceVote (ConwayOnwardsVote cOnwards v govTxInIdentifier anyStake) outF let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h votingCred <- hoistEither $ first EraBasedVotingCredentialDecodeError $ toVotingCredential sbe vStakeCred - let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier + let govActIdentifier = makeGoveranceActionId sbe govTxInIdentifier (error "TODO: Conway era - the TxInId does not determine the govActId") voteProcedure = createVotingProcedure sbe v (VoterCommittee votingCred) govActIdentifier firstExceptT EraBasedVoteWriteError . newExceptT $ shelleyBasedEraConstraints sbe $ writeFileTextEnvelope outFp Nothing voteProcedure diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index c8eb1e4419..fc375a0b49 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -363,7 +363,7 @@ renderCertificate sbe = \case ConwayCertificate w cert -> conwayEraOnwardsConstraints w $ case cert of - Ledger.RegDRepTxCert credential coin -> + Ledger.RegDRepTxCert credential coin _TODO -> -- TODO Conway: new StrictMaybe Anchor argument "Drep registration certificate" .= object [ "deposit" .= coin , "certificate" .= conwayToObject w credential @@ -373,15 +373,21 @@ renderCertificate sbe = \case [ "refund" .= coin , "certificate" .= conwayToObject w credential ] - Ledger.AuthCommitteeHotKeyTxCert (Shelley.KeyHash coldKey) (Shelley.KeyHash hotKey) -> + Ledger.AuthCommitteeHotKeyTxCert coldCred hotCred + | Shelley.ScriptHashObj{} <- coldCred -> error "TODO Conway" + | Shelley.ScriptHashObj{} <- hotCred -> error "TODO Conway" + | Shelley.KeyHashObj (Shelley.KeyHash coldKey) <- coldCred + , Shelley.KeyHashObj (Shelley.KeyHash hotKey) <- hotCred -> "Constitutional committee member hot key registration" .= object ["cold key hash" .= String (textShow coldKey) , "hot key hash" .= String (textShow hotKey) ] - Ledger.ResignCommitteeColdTxCert (Shelley.KeyHash coldKey) -> - "Constitutional committee cold key resignation" .= object - [ "cold key hash" .= String (textShow coldKey) - ] + Ledger.ResignCommitteeColdTxCert cred -> case cred of + Shelley.ScriptHashObj{} -> error "TODO Conway" + Shelley.KeyHashObj (Shelley.KeyHash coldKey) -> + "Constitutional committee cold key resignation" .= object + [ "cold key hash" .= String (textShow coldKey) + ] Ledger.RegTxCert stakeCredential -> "Stake address registration" .= object [ "stake credential" .= stakeCredJson sbe stakeCredential @@ -428,7 +434,7 @@ renderCertificate sbe = \case where conwayToObject :: () => ConwayEraOnwards era - -> Shelley.Credential 'Shelley.Voting (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> Shelley.Credential 'Shelley.DRepRole (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value conwayToObject w' = conwayEraOnwardsConstraints w' $ diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs index 50281666af..6be922ee92 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs @@ -45,6 +45,7 @@ import Cardano.CLI.Types.Key (VerificationKeyOrHashOrFile, import qualified Cardano.CLI.Types.Output as O import Cardano.Crypto.Hash (hashToBytesAsHex) import qualified Cardano.Crypto.Hash.Blake2b as Blake2b +import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.Core as Core import qualified Cardano.Ledger.Crypto as Crypto import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..)) @@ -74,7 +75,6 @@ import Data.Aeson as Aeson import Data.Aeson.Encode.Pretty (encodePretty) import Data.Aeson.Types as Aeson import Data.Bifunctor (Bifunctor (..)) -import Data.ByteString (ByteString) import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Coerce (coerce) import Data.Function ((&)) @@ -225,7 +225,7 @@ runQueryConstitutionHash socketPath (AnyConsensusModeParams cModeParams) network where writeConstitutionHash :: Maybe (File () Out) - -> Maybe (SafeHash StandardCrypto ByteString) + -> Maybe (SafeHash StandardCrypto L.AnchorData) -> ExceptT ShelleyQueryCmdError IO () writeConstitutionHash mOutFile' cHash = case mOutFile' of diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index f2bb9e3775..23dfa51c65 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -88,6 +88,7 @@ import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy.Char8 as LBS import Data.IORef (IORef, newIORef, readIORef, writeIORef) import qualified Data.List as List +import qualified Data.Map.Strict as Map import Data.Text (Text) import qualified Data.Text as Text import Data.Word @@ -749,14 +750,21 @@ readTxVotes :: () -> IO (Either VoteError (TxVotes era)) readTxVotes _ [] = return $ Right TxVotesNone readTxVotes w files = runExceptT $ do - TxVotes w <$> forM files (ExceptT . readVoteFile w) + TxVotes w . Map.fromList . map entryToAssoc <$> forM files (ExceptT . readVoteFile w) + where + entryToAssoc :: VotingEntry era -> ((Voter era, GovernanceActionId era), VotingProcedure era) + entryToAssoc VotingEntry + { votingEntryVoter = voter + , votingEntryGovActionId = govActId + , votingEntryVotingProcedure = vproc + } = ((voter, govActId), vproc) readVoteFile :: ConwayEraOnwards era -> VoteFile In - -> IO (Either VoteError (VotingProcedure era)) + -> IO (Either VoteError (VotingEntry era)) readVoteFile w fp = - first VoteErrorFile <$> conwayEraOnwardsConstraints w (readFileTextEnvelope AsVote fp) + first VoteErrorFile <$> conwayEraOnwardsConstraints w (readFileTextEnvelope AsVotingEntry fp) data ConstitutionError = ConstitutionErrorFile (FileError TextEnvelopeError)