Skip to content

Commit

Permalink
DO NOT MERGE preparing for Conway 1.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrisby committed Aug 16, 2023
1 parent 965e3ae commit 78881a5
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 24 deletions.
57 changes: 57 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/Commands/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,26 @@ 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
vStakeCred = StakeCredentialByKey . (verificationKeyHash . castVerificationKey) $ vStakePoolKey
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

Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/EraBased/Vote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
20 changes: 13 additions & 7 deletions cardano-cli/src/Cardano/CLI/Json/Friendly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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' $
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/Legacy/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 (..))
Expand Down Expand Up @@ -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 ((&))
Expand Down Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 78881a5

Please sign in to comment.