Skip to content

Commit

Permalink
Merge pull request #609 from IntersectMBO/jordan/bump-chap
Browse files Browse the repository at this point in the history
Enable deposit return scripts and constitutional scripts
  • Loading branch information
Jimbo4350 authored Feb 23, 2024
2 parents 53c4eb9 + 46abeda commit 7f49f39
Show file tree
Hide file tree
Showing 91 changed files with 339 additions and 172 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-stylish-haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2023-07-28"
CABAL_CACHE_VERSION: "2024-02-23"

STYLISH_HASKELL_VERSION: "0.14.4.0"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2023-12-12"
CABAL_CACHE_VERSION: "2024-02-23"

concurrency:
group: >
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2024-02-23-3"
CABAL_CACHE_VERSION: "2024-02-23-4"

concurrency:
group: >
Expand Down
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2024-02-23T02:09:28Z
, cardano-haskell-packages 2024-02-22T17:04:08Z
, cardano-haskell-packages 2024-02-23T11:16:54Z

packages:
cardano-cli
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.39.0.0
, cardano-api ^>= 8.39.1.0
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ data GoveranceActionUpdateCommitteeCmdArgs era
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !Lovelace
, returnAddress :: !(VerificationKeyOrHashOrFile StakeKey)
, returnAddress :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, oldCommitteeVkeySource :: ![VerificationKeyOrHashOrFile CommitteeColdKey]
Expand All @@ -61,12 +61,13 @@ data GovernanceActionCreateConstitutionCmdArgs era
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !Lovelace
, stakeCredential :: !(VerificationKeyOrHashOrFile StakeKey)
, stakeCredential :: !StakeIdentifier
, mPrevGovernanceActionId :: !(Maybe (TxId, Word32))
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, constitutionUrl :: !ConstitutionUrl
, constitutionHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, constitutionScript :: !(Maybe ScriptHash)
, outFile :: !(File () Out)
} deriving Show

Expand All @@ -76,7 +77,7 @@ data GovernanceActionInfoCmdArgs era
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !Lovelace
, returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey)
, returnStakeAddress :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, outFile :: !(File () Out)
Expand All @@ -87,7 +88,7 @@ data GovernanceActionCreateNoConfidenceCmdArgs era
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !Lovelace
, returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey)
, returnStakeAddress :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, governanceActionId :: !TxId
Expand Down Expand Up @@ -117,7 +118,7 @@ data GovernanceActionTreasuryWithdrawalCmdArgs era
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !Lovelace
, returnAddr :: !(VerificationKeyOrHashOrFile StakeKey)
, returnAddr :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)]
Expand All @@ -138,7 +139,7 @@ data UpdateProtocolParametersConwayOnwards era
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !Lovelace
, returnAddr :: !(VerificationKeyOrHashOrFile StakeKey)
, returnAddr :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, governanceActionId :: !(Maybe (TxId, Word32))
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Options/Address.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pAddressBuild :: EnvCli -> Parser (AddressCmds era)
pAddressBuild envCli =
AddressBuild
<$> pPaymentVerifier
<*> Opt.optional pStakeIdentifier
<*> Opt.optional (pStakeIdentifier Nothing)
<*> pNetworkId envCli
<*> pMaybeOutputFile

Expand Down
24 changes: 12 additions & 12 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,22 @@ decimal :: Parsec.Parser Integer
Parsec.TokenParser { Parsec.decimal = decimal } = Parsec.haskell


pStakeIdentifier :: Parser StakeIdentifier
pStakeIdentifier = asum
[ StakeIdentifierVerifier <$> pStakeVerifier
, StakeIdentifierAddress <$> pStakeAddress
pStakeIdentifier :: Maybe String -> Parser StakeIdentifier
pStakeIdentifier prefix = asum
[ StakeIdentifierVerifier <$> pStakeVerifier prefix
, StakeIdentifierAddress <$> pStakeAddress prefix
]

pStakeVerifier :: Parser StakeVerifier
pStakeVerifier = asum
[ StakeVerifierKey <$> pStakeVerificationKeyOrFile Nothing
, StakeVerifierScriptFile <$> pScriptFor "stake-script-file" Nothing "Filepath of the staking script."
pStakeVerifier :: Maybe String -> Parser StakeVerifier
pStakeVerifier prefix = asum
[ StakeVerifierKey <$> pStakeVerificationKeyOrHashOrFile prefix
, StakeVerifierScriptFile <$> pScriptFor (prefixFlag prefix "stake-script-file") Nothing "Filepath of the staking script."
]

pStakeAddress :: Parser StakeAddress
pStakeAddress =
pStakeAddress :: Maybe String -> Parser StakeAddress
pStakeAddress prefix =
Opt.option (readerFromParsecParser parseStakeAddress) $ mconcat
[ Opt.long "stake-address"
[ Opt.long $ prefixFlag prefix "stake-address"
, Opt.metavar "ADDRESS"
, Opt.help "Target stake address (bech32 format)."
]
Expand Down Expand Up @@ -1295,7 +1295,7 @@ pCertificateFile balanceExecUnits =
<$> ( fmap CertificateFile $ asum
[ Opt.strOption $ mconcat
[ Opt.long "certificate-file"
, Opt.metavar "CERTIFICATEFILE"
, Opt.metavar "FILE"
, Opt.help helpText
, Opt.completer (Opt.bashCompleter "file")
]
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Options/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pMIRPayStakeAddresses :: ()
pMIRPayStakeAddresses w =
GovernanceCreateMirCertificateStakeAddressesCmd w
<$> pMIRPot
<*> some pStakeAddress
<*> some (pStakeAddress Nothing)
<*> some pRewardAmt
<*> pOutputFile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pGovernanceActionNewInfoCmd era = do
Cmd.GovernanceActionInfoCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit
<*> pStakeVerificationKeyOrHashOrFile (Just "deposit-return")
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pFileOutDirection "out-file" "Path to action file to be used later on with build or build-raw "
Expand All @@ -86,12 +86,13 @@ pGovernanceActionNewConstitutionCmd era = do
Cmd.GovernanceActionCreateConstitutionCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit
<*> pStakeVerificationKeyOrHashOrFile (Just "deposit-return")
<*> pStakeIdentifier (Just "deposit-return")
<*> pPreviousGovernanceAction
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pConstitutionUrl
<*> pConstitutionHash
<*> optional pConstitutionScriptHash
<*> pFileOutDirection "out-file" "Output filepath of the constitution."
)
$ Opt.progDesc "Create a constitution."
Expand All @@ -116,7 +117,7 @@ pUpdateCommitteeCmd eon =
Cmd.GoveranceActionUpdateCommitteeCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit
<*> pStakeVerificationKeyOrHashOrFile (Just "deposit-return")
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> many pRemoveCommitteeColdVerificationKeyOrHashOrFile
Expand All @@ -141,7 +142,7 @@ pGovernanceActionNoConfidenceCmd era = do
Cmd.GovernanceActionCreateNoConfidenceCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit
<*> pStakeVerificationKeyOrHashOrFile (Just "deposit-return")
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pTxId "prev-governance-action-tx-id" "Txid of the previous governance action."
Expand All @@ -161,7 +162,7 @@ pUpdateProtocolParametersPostConway conwayOnwards =
Cmd.UpdateProtocolParametersConwayOnwards conwayOnwards
<$> pNetwork
<*> pGovActionDeposit
<*> pStakeVerificationKeyOrHashOrFile (Just "deposit-return")
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pPreviousGovernanceAction
Expand Down Expand Up @@ -353,7 +354,7 @@ pGovernanceActionTreasuryWithdrawalCmd era = do
Cmd.GovernanceActionTreasuryWithdrawalCmdArgs eon
<$> pNetwork
<*> pGovActionDeposit
<*> pStakeVerificationKeyOrHashOrFile (Just "deposit-return")
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> many ((,) <$> pStakeVerificationKeyOrHashOrFile (Just "funds-receiving") <*> pTransferAmt)
Expand Down
16 changes: 8 additions & 8 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pStakeAddressBuildCmd era envCli = do
$ subParser "build"
$ Opt.info
( StakeAddressBuildCmd w
<$> pStakeVerifier
<$> pStakeVerifier Nothing
<*> pNetworkId envCli
<*> pMaybeOutputFile
)
Expand All @@ -90,7 +90,7 @@ pStakeAddressRegistrationCertificateCmd era = do
(const $ subParser "registration-certificate"
$ Opt.info
( StakeAddressRegistrationCertificateCmd sbe
<$> pStakeIdentifier
<$> pStakeIdentifier Nothing
<*> pure Nothing
<*> pOutputFile
)
Expand All @@ -99,7 +99,7 @@ pStakeAddressRegistrationCertificateCmd era = do
(const $ subParser "registration-certificate"
$ Opt.info
( StakeAddressRegistrationCertificateCmd sbe
<$> pStakeIdentifier
<$> pStakeIdentifier Nothing
<*> fmap Just pKeyRegistDeposit
<*> pOutputFile
)
Expand All @@ -118,7 +118,7 @@ pStakeAddressDeregistrationCertificateCmd era = do
(\shelleyToBabbage -> subParser "deregistration-certificate"
$ Opt.info
( StakeAddressDeregistrationCertificateCmd (shelleyToBabbageEraToShelleyBasedEra shelleyToBabbage)
<$> pStakeIdentifier
<$> pStakeIdentifier Nothing
<*> pure Nothing
<*> pOutputFile
)
Expand All @@ -127,7 +127,7 @@ pStakeAddressDeregistrationCertificateCmd era = do
(\conwayOnwards -> subParser "deregistration-certificate"
$ Opt.info
( StakeAddressDeregistrationCertificateCmd (conwayEraOnwardsToShelleyBasedEra conwayOnwards)
<$> pStakeIdentifier
<$> pStakeIdentifier Nothing
<*> fmap Just pKeyRegistDeposit
<*> pOutputFile
)
Expand All @@ -144,7 +144,7 @@ pStakeAddressStakeDelegationCertificateCmd era = do
$ subParser "stake-delegation-certificate"
$ Opt.info
( StakeAddressStakeDelegationCertificateCmd w
<$> pStakeIdentifier
<$> pStakeIdentifier Nothing
<*> pStakePoolVerificationKeyOrHashOrFile Nothing
<*> pOutputFile
)
Expand All @@ -163,7 +163,7 @@ pStakeAddressStakeAndVoteDelegationCertificateCmd era = do
$ subParser "stake-and-vote-delegation-certificate"
$ Opt.info
( StakeAddressStakeAndVoteDelegationCertificateCmd w
<$> pStakeIdentifier
<$> pStakeIdentifier Nothing
<*> pStakePoolVerificationKeyOrHashOrFile Nothing
<*> pVoteDelegationTarget
<*> pOutputFile
Expand All @@ -183,7 +183,7 @@ pStakeAddressVoteDelegationCertificateCmd era = do
$ subParser "vote-delegation-certificate"
$ Opt.info
( StakeAddressVoteDelegationCertificateCmd w
<$> pStakeIdentifier
<$> pStakeIdentifier Nothing
<*> pVoteDelegationTarget
<*> pOutputFile
)
Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Address.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Errors.AddressCmdError
import Cardano.CLI.Types.Key (PaymentVerifier (..), StakeIdentifier (..),
StakeVerifier (..), VerificationKeyTextOrFile, generateKeyPair,
readVerificationKeyOrFile, readVerificationKeyTextOrFileAnyOf)
readVerificationKeyOrHashOrFile, readVerificationKeyTextOrFileAnyOf)

import qualified Data.ByteString.Char8 as BS
import Data.Function
Expand Down Expand Up @@ -194,10 +194,10 @@ makeStakeAddressRef stakeIdentifier =
StakeIdentifierVerifier stakeVerifier ->
case stakeVerifier of
StakeVerifierKey stkVkeyOrFile -> do
stakeVKey <- firstExceptT AddressCmdReadKeyFileError $
newExceptT $ readVerificationKeyOrFile AsStakeKey stkVkeyOrFile
stakeVKeyHash <- firstExceptT AddressCmdReadKeyFileError $
newExceptT $ readVerificationKeyOrHashOrFile AsStakeKey stkVkeyOrFile

return . StakeAddressByValue . StakeCredentialByKey . verificationKeyHash $ stakeVKey
return . StakeAddressByValue $ StakeCredentialByKey stakeVKeyHash

StakeVerifierScriptFile (ScriptFile fp) -> do
ScriptInAnyLang _lang script <-
Expand Down
Loading

0 comments on commit 7f49f39

Please sign in to comment.