diff --git a/.changes/20260813_120000_cardano-cli_sebastian.nagel_pool_reg_bls_key.yml b/.changes/20260813_120000_cardano-cli_sebastian.nagel_pool_reg_bls_key.yml new file mode 100644 index 0000000000..e9decf8890 --- /dev/null +++ b/.changes/20260813_120000_cardano-cli_sebastian.nagel_pool_reg_bls_key.yml @@ -0,0 +1,7 @@ +description: | + `stake-pool registration-certificate` can now register a stake pool's BLS voting key. The new `--bls-signing-key-file FILEPATH` option is era-gated: it is mandatory from the Dijkstra era onwards and not offered in Conway or earlier, so existing Conway invocations are unaffected. The signing key is read as a text envelope (produce one with `node key-gen-BLS`) and converted to the registered verification key plus proof of possession via `toLedgerBlsKey`. + Genesis pool parameters built by `genesis create-staked` and `genesis create-testnet-data` set the new ledger `sppBlsKey` field to `SNothing`. +kind: + - feature +pr: 1439 +project: cardano-cli diff --git a/.changes/20260904_fix_dijkstra_era_commands.yml b/.changes/20260904_fix_dijkstra_era_commands.yml new file mode 100644 index 0000000000..85f915bf3c --- /dev/null +++ b/.changes/20260904_fix_dijkstra_era_commands.yml @@ -0,0 +1,9 @@ +project: cardano-cli + +pr: 1439 + +kind: + - bugfix + +description: | + Fix Dijkstra era commands (BLS key generation, transaction witness/assemble) that were failing with "TODO DijkstraEra" because the era dispatch in runAnyEraCommand was unconditionally calling obtainCommonConstraints, which is not yet implemented for DijkstraEra. Commands that do not require EraCommonConstraints now work correctly for the Dijkstra era. diff --git a/.changes/20260918_084856_cardano-cli_ch1bo_leios_pparam_updates.yml b/.changes/20260918_084856_cardano-cli_ch1bo_leios_pparam_updates.yml new file mode 100644 index 0000000000..a20c9ddbdc --- /dev/null +++ b/.changes/20260918_084856_cardano-cli_ch1bo_leios_pparam_updates.yml @@ -0,0 +1,6 @@ +description: | + Add new Leios parameters to create-protocol-parameters-update command line options +kind: + - feature +pr: 1439 +project: cardano-cli diff --git a/.changes/20260925_100000_cardano-cli_sebastian.nagel_drop_bls_pop_and_hash_cmds.yml b/.changes/20260925_100000_cardano-cli_sebastian.nagel_drop_bls_pop_and_hash_cmds.yml new file mode 100644 index 0000000000..4af5feccb1 --- /dev/null +++ b/.changes/20260925_100000_cardano-cli_sebastian.nagel_drop_bls_pop_and_hash_cmds.yml @@ -0,0 +1,9 @@ +project: cardano-cli + +pr: 1439 + +kind: + - breaking + +description: | + Removed the `node issue-pop-BLS` and `node key-hash-BLS` commands. A pool's BLS proof of possession is now built straight into the registration certificate from the signing key given to `stake-pool registration-certificate --bls-signing-key-file`, so there is no need to issue one as a standalone artifact; a standalone BLS key hash was never needed at all. Both commands shipped in 10.16.0.0 but no node release ever made use of their output, so removing them breaks no existing workflow. `node key-gen-BLS` is unaffected, and either command can be reinstated if a concrete use case turns up. diff --git a/.changes/20261006_120000_cardano-cli_jordan.millar_pool_state_bls_epoch.yml b/.changes/20261006_120000_cardano-cli_jordan.millar_pool_state_bls_epoch.yml new file mode 100644 index 0000000000..efb0dbf7a6 --- /dev/null +++ b/.changes/20261006_120000_cardano-cli_jordan.millar_pool_state_bls_epoch.yml @@ -0,0 +1,9 @@ +project: cardano-cli + +pr: 1439 + +kind: + - compatible + +description: | + Adapt to cardano-ledger-core 1.22, where `mkStakePoolState` stamps a pool's BLS voting key with the epoch its registration takes effect in. The pool-state query does not report that epoch yet, so `query pool-state` fills `bksRegisteredIn` with the epoch the parameters take effect in: the current epoch for the active parameters and the next one for the future parameters. The reported value is a placeholder until the ledger exposes the real one (https://github.com/IntersectMBO/cardano-ledger/issues/6147); the feature is not yet used on mainnet. diff --git a/.gitignore b/.gitignore index 1df0246b51..e2e9172fb8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .stack-work/ .ghc.environment.* .nix-shell-cabal.project +.direnv +.envrc /cabal.project.diff /cabal.project.freeze /cabal.project.local* diff --git a/cabal.project b/cabal.project index 6876c158ff..3bb9880929 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2026-07-30T07:30:12Z - , cardano-haskell-packages 2026-09-24T00:08:56Z + , hackage.haskell.org 2026-09-02T14:05:07Z + , cardano-haskell-packages 2026-10-06T19:41:19Z packages: cardano-cli @@ -35,16 +35,21 @@ extra-packages: Cabal if impl(ghc < 9.14) constraints: - -- hourglass and time-hourglass both in dependency tree break musl build - , time-hourglass < 0 -- haskell.nix patch does not work for 1.6.8 - , any.crypton-x509-system < 1.6.8 + , any.crypton-x509-system (< 1.6.8 || >= 1.7) if os(windows) constraints: time ^>=1.14 allow-newer: *:time -- Needed for running tests with WINE (see https://github.com/haskell/network/issues/604) constraints: network <3.2.8.0 + -- cardano-config and kes-agent (pulled in by ouroboros-consensus 5.0 and + -- cardano-api) require network ^>=3.2.8, but they only need APIs that are + -- already in 3.2.7, so let them accept the WINE-compatible network pinned + -- above. + allow-older: + , cardano-config:network + , kes-agent:network -- cardano-ledger-binary 1.9.0.0 reversed the byte order of relay IPv4 addresses (cardano-cli#1442) constraints: cardano-ledger-binary >=1.9.1 @@ -73,6 +78,23 @@ write-ghc-environment-files: always -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. +-- Allow network-mux 0.11 from SRP (cardano-ping 0.10 on CHaP expects ^>=0.10) +-- Allow grapesy deps with updated bounds (matching cardano-node) +allow-newer: + , cardano-ping:network-mux + , grapesy:aeson + , grapesy:crypton-x509 + , grapesy:crypton-x509-store + , grapesy:crypton-x509-system + , grapesy:crypton-x509-validation + , grapesy:http2 + , grapesy:http2-tls + , grapesy:network-run + , grapesy:tls + -- kes-agent bounds cardano-crypto-class ^>=2.5 but we have a newer version + , kes-agent:cardano-crypto-class + , kes-agent-crypto:cardano-crypto-class + -- cabal-allow-newer begin if impl(ghc >= 9.14) allow-newer: @@ -86,6 +108,13 @@ if impl(ghc >= 9.14) , dictionary-sharing:containers , diff-containers:base , fs-sim:QuickCheck + , grapesy:base + , grapesy:containers + , grapesy:tls + , grpc-spec:base + , grpc-spec:containers + , lens-family:containers + , lens-family-core:containers , lsm-tree:data-elevator , ordered-containers:containers , partial-order:containers diff --git a/cardano-cli/CHANGELOG.md b/cardano-cli/CHANGELOG.md index 5609f69885..576e87d624 100644 --- a/cardano-cli/CHANGELOG.md +++ b/cardano-cli/CHANGELOG.md @@ -63,37 +63,37 @@ [PR 1396](https://github.com/intersectmbo/cardano-cli/pull/1396) - new `cardano-cli ping` api - + `cardano-cli ping` allows now to ping multiple servers, does domain name resolution and supports SRV records (as specified in https://cips.cardano.org/cip/CIP-0155) - + Some examples: - + Run a ping against two ip addresses, ipv4 & ipv6 ```bash cardano-cli ping 127.0.0.1:3001 [::1]:3001 ``` - + Run a ping against a domain name: ```bash cardano-cli ping my.domain.com:3001 ``` - + Run a ping against an SRV domain. According to CIP#0155 the SRV record needs to be registered at `_cardano._tcp.srv.domain.com` ```bash cardano-cli ping srv.domain.com ``` - + Run a ping against unix socket ```bash cardano-cli ping /var/run/cardano-node.socket ``` - + `cardano-cli` ping has three modes of operation: - + * ping mode: `--mode ping` (the default) * tip mode `--mode tip` * query handshake parameters: `--mode query` @@ -101,20 +101,20 @@ [PR 1384](https://github.com/intersectmbo/cardano-cli/pull/1384) - The interface for `cardano-cli ping` has been reshuffled: - + Removed: - + * `-h`/`--host`, `-u`/`--unixsock` and `-p`/`--port`. The target is now given as a positional argument instead (see below). * `-Q`/`--query-versions`, replaced by `--mode query`. * `-t`/`--tip`, replaced by `--mode tip`. - + Renamed: - + * `-m`/`--magic` is now `-m`/`--network-magic`. - + Added: - + * A positional `ADDRS` argument, which accepts one or more targets: an IP/DNS address with a port (`127.0.0.1:3001`, `[::1]:3001`, `example.org:3001`), an SRV name, or a UNIX socket path. @@ -124,7 +124,7 @@ (default `_cardano._tcp`). * `--color COLOR`, one of `auto`, `never` or `always`. * `--short-hash`, to show an abbreviated tip hash. - + Note that `-h` is now only a short form of `--help`; it no longer means `--host`. (breaking, feature) [PR 1384](https://github.com/intersectmbo/cardano-cli/pull/1384) diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index f635112921..cd40ba2990 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -246,13 +246,13 @@ library binary, bytestring, canonical-json, - cardano-api ^>=11.7, + cardano-api ^>=11.8, cardano-binary, cardano-crypto, - cardano-crypto-class ^>=2.5, - cardano-crypto-wrapper ^>=1.7, + cardano-crypto-class ^>=2.6, + cardano-crypto-wrapper ^>=1.8, cardano-data >=1.1, - cardano-diffusion:ping ^>=1.1.1, + cardano-diffusion:ping ^>=1.3, cardano-git-rev ^>=0.2.2, cardano-ledger-api, cardano-ledger-conway, @@ -483,6 +483,7 @@ test-suite cardano-cli-golden Test.Golden.CreateStaked Test.Golden.CreateTestnetData Test.Golden.Debug.TransactionView + Test.Golden.Dijkstra.StakePool.RegistrationCertificate Test.Golden.Dijkstra.Transaction.Assemble Test.Golden.ErrorsSpec Test.Golden.Genesis.Common @@ -509,12 +510,10 @@ test-suite cardano-cli-golden Test.Golden.Shelley.Metadata.StakePoolMetadata Test.Golden.Shelley.MultiSig.Address Test.Golden.Shelley.Node.IssueOpCert - Test.Golden.Shelley.Node.IssuePopBls Test.Golden.Shelley.Node.KeyGen Test.Golden.Shelley.Node.KeyGenBls Test.Golden.Shelley.Node.KeyGenKes Test.Golden.Shelley.Node.KeyGenVrf - Test.Golden.Shelley.Node.KeyHashBls Test.Golden.Shelley.StakeAddress.Build Test.Golden.Shelley.StakeAddress.DeregistrationCertificate Test.Golden.Shelley.StakeAddress.KeyGen diff --git a/cardano-cli/src/Cardano/CLI/Compatible/StakePool/Run.hs b/cardano-cli/src/Cardano/CLI/Compatible/StakePool/Run.hs index 16730d4a69..26058b6d1f 100644 --- a/cardano-cli/src/Cardano/CLI/Compatible/StakePool/Run.hs +++ b/cardano-cli/src/Cardano/CLI/Compatible/StakePool/Run.hs @@ -84,6 +84,7 @@ runStakePoolRegistrationCertificateCmd StakePoolParameters { stakePoolId = stakePoolId' , stakePoolVRF = vrfKeyHash' + , stakePoolBlsKey = Nothing , stakePoolCost = poolCost , stakePoolMargin = poolMargin , stakePoolRewardAccount = rewardAccountAddr diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Genesis/CreateTestnetData/Run.hs b/cardano-cli/src/Cardano/CLI/EraBased/Genesis/CreateTestnetData/Run.hs index d43852bf05..9d17714612 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Genesis/CreateTestnetData/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Genesis/CreateTestnetData/Run.hs @@ -453,7 +453,7 @@ runGenesisCreateTestNetDataCmd mkPoolDir idx = poolsDir ("pool" <> show idx) mkDelegationMapEntry - :: Delegation -> (L.KeyHash L.Staking, L.StakePoolParams) + :: Delegation -> (L.KeyHash L.Staking, GenesisStakePoolParams) mkDelegationMapEntry d = (dDelegStaking d, dPoolParams d) addCommitteeToConwayGenesis @@ -765,7 +765,7 @@ createPoolCredentials fmt dir = do data Delegation = Delegation { dInitialUtxoAddr :: !(AddressInEra ShelleyEra) , dDelegStaking :: !(L.KeyHash L.Staking) - , dPoolParams :: !L.StakePoolParams + , dPoolParams :: !GenesisStakePoolParams } deriving (Generic, NFData) @@ -777,7 +777,7 @@ buildPoolParams -- ^ The index of the pool being built. Starts at 0. -> Map Word [L.StakePoolRelay] -- ^ User submitted stake pool relay map. Starts at 0 - -> ExceptT GenesisCmdError IO L.StakePoolParams + -> ExceptT GenesisCmdError IO (L.StakePoolParams era) buildPoolParams nw dir index specifiedRelays = do StakePoolVerificationKey poolColdVK <- firstExceptT (GenesisCmdStakePoolCmdError . StakePoolCmdReadFileError) @@ -802,6 +802,7 @@ buildPoolParams nw dir index specifiedRelays = do , L.sppMargin = minBound , L.sppAccountAddress = toShelleyStakeAddr $ makeStakeAddress nw $ StakeCredentialByKey (verificationKeyHash rewardsSVK) + , L.sppBlsKey = L.SNothing , L.sppOwners = mempty , L.sppRelays = lookupPoolRelay specifiedRelays , L.sppMetadata = L.SNothing @@ -826,7 +827,7 @@ computeInsecureStakeKeyAddr g0 = do computeDelegation :: NetworkId -> (VerificationKey PaymentKey, VerificationKey StakeKey) - -> L.StakePoolParams + -> GenesisStakePoolParams -> Delegation computeDelegation nw (paymentVK, stakeVK) dPoolParams = do let paymentCredential = PaymentCredentialByKey (verificationKeyHash paymentVK) @@ -849,7 +850,7 @@ updateOutputTemplate -- ^ Total amount of lovelace -> [AddressInEra ShelleyEra] -- ^ UTxO addresses that are not delegating - -> [(L.KeyHash L.StakePool, L.StakePoolParams)] + -> [(L.KeyHash L.StakePool, GenesisStakePoolParams)] -- ^ Pool map -> [(L.KeyHash L.Staking, L.KeyHash L.StakePool)] -- ^ Delegaton map diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Internal/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Internal/Common.hs index df4ab8bdb9..d55f0c4fe1 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Internal/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Internal/Common.hs @@ -9,7 +9,8 @@ {-# LANGUAGE TypeApplications #-} module Cardano.CLI.EraBased.Genesis.Internal.Common - ( decodeShelleyGenesisFile + ( GenesisStakePoolParams + , decodeShelleyGenesisFile , decodeAlonzoGenesisFile , decodeConwayGenesisFile , decodeDijkstraGenesisFile @@ -35,6 +36,7 @@ import Cardano.Crypto.Hash (HashAlgorithm) import Cardano.Crypto.Hash qualified as Hash import Cardano.Crypto.Random qualified as Crypto import Cardano.Ledger.Dijkstra.Genesis (DijkstraGenesis (..)) +import Cardano.Ledger.Shelley qualified as L import Data.Aeson qualified as A import Data.Binary.Get qualified as Bin @@ -91,6 +93,15 @@ readAndDecodeGenesisFileWith decode' fpath = do . hoistEither $ decode' lbs +-- | Stake pool parameters for the Shelley genesis file. +-- +-- Pinned to 'L.ShelleyEra' because the ledger's 'ShelleyGenesisStaking' field +-- @sgsPools@ requires @StakePoolParams ShelleyEra@. The era index on +-- 'L.StakePoolParams' is phantom (cardano-ledger-core 1.22) and is dropped by +-- 'mkStakePoolState' when the initial pool state is built, so this holds for +-- whichever era the chain starts in. +type GenesisStakePoolParams = L.StakePoolParams L.ShelleyEra + genStuffedAddress :: L.Network -> IO (AddressInEra ShelleyEra) genStuffedAddress network = do paymentCredential <- diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Run.hs b/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Run.hs index 093c768e38..af675039f6 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Genesis/Run.hs @@ -747,7 +747,7 @@ runGenesisCreateStakedCmd where adjustTemplate t = t{sgNetworkMagic = unNetworkMagic (toNetworkMagic networkId)} mkDelegationMapEntry - :: Delegation -> (L.KeyHash L.Staking, L.StakePoolParams) + :: Delegation -> (L.KeyHash L.Staking, GenesisStakePoolParams) mkDelegationMapEntry d = (dDelegStaking d, dPoolParams d) -- ------------------------------------------------------------------------------------------------- @@ -763,7 +763,7 @@ updateOutputTemplate -- ^ Number of UTxO addresses that are delegating -> [AddressInEra ShelleyEra] -- ^ UTxO addresses that are not delegating - -> [(L.KeyHash L.StakePool, L.StakePoolParams)] + -> [(L.KeyHash L.StakePool, GenesisStakePoolParams)] -- ^ Pool map -> [(L.KeyHash L.Staking, L.KeyHash L.StakePool)] -- ^ Delegaton map @@ -950,7 +950,7 @@ createPoolCredentials fmt dir index = do data Delegation = Delegation { dInitialUtxoAddr :: !(AddressInEra ShelleyEra) , dDelegStaking :: !(L.KeyHash L.Staking) - , dPoolParams :: !L.StakePoolParams + , dPoolParams :: !GenesisStakePoolParams } deriving (Generic, NFData) @@ -961,7 +961,7 @@ buildPoolParams -> Maybe Word -> Map Word [L.StakePoolRelay] -- ^ User submitted stake pool relay map - -> ExceptT GenesisCmdError IO L.StakePoolParams + -> ExceptT GenesisCmdError IO GenesisStakePoolParams buildPoolParams nw dir index specifiedRelays = do StakePoolVerificationKey poolColdVK <- firstExceptT (GenesisCmdStakePoolCmdError . StakePoolCmdReadFileError) @@ -986,6 +986,7 @@ buildPoolParams nw dir index specifiedRelays = do , L.sppMargin = minBound , L.sppAccountAddress = toShelleyStakeAddr $ makeStakeAddress nw $ StakeCredentialByKey (verificationKeyHash rewardsSVK) + , L.sppBlsKey = L.SNothing , L.sppOwners = mempty , L.sppRelays = lookupPoolRelay specifiedRelays , L.sppMetadata = L.SNothing @@ -1041,7 +1042,7 @@ writeBulkPoolCredentials dir bulkIx poolIxs = do computeInsecureDelegation :: StdGen -> NetworkId - -> L.StakePoolParams + -> GenesisStakePoolParams -> IO (StdGen, Delegation) computeInsecureDelegation g0 nw pool = do (paymentVK, g1) <- first getVerificationKey <$> generateInsecureSigningKey g0 AsPaymentKey @@ -1091,7 +1092,7 @@ updateTemplate -- ^ Amount of lovelace not delegated -> [AddressInEra ShelleyEra] -- ^ UTxO addresses that are not delegating - -> Map (L.KeyHash L.Staking) L.StakePoolParams + -> Map (L.KeyHash L.Staking) GenesisStakePoolParams -- ^ Genesis staking: pools/delegation map & delegated initial UTxO spec -> Lovelace -- ^ Number of UTxO Addresses for delegation diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Option.hs b/cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Option.hs index bc9a51f7b7..da68d4f117 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Option.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Option.hs @@ -21,11 +21,12 @@ import Cardano.CLI.EraBased.Governance.Actions.Command qualified as Cmd import Cardano.CLI.Option.Flag (setDefault) import Cardano.CLI.Parser import Cardano.CLI.Type.Common -import Cardano.Ledger.BaseTypes (NonZero, PositiveInterval, nonZero) +import Cardano.Ledger.BaseTypes (Milliseconds32 (..), NonZero, PositiveInterval, nonZero) +import Cardano.Ledger.Plutus.ExUnits (OrdExUnits (..)) import Data.Foldable import Data.Function ((&)) -import Data.Word (Word32) +import Data.Word (Word16, Word32) import GHC.Natural (Natural) import Options.Applicative import Options.Applicative qualified as Opt @@ -312,6 +313,112 @@ pIntroducedInDijkstraPParams = <*> convertToLedger id (optional pMaxRefScriptSizePerTx) <*> convertToLedger id (optional pRefScriptCostStride) <*> convertToLedger id (optional pRefScriptCostMultiplier) + <*> convertToLedger id (optional pLeiosAnnouncementPeriodLength) + <*> convertToLedger id (optional pLeiosVotePeriodLength) + <*> convertToLedger id (optional pLeiosDiffusionPeriodLength) + <*> convertToLedger id (optional pLeiosCommitteeSize) + <*> convertToLedger toUnitIntervalOrErr (optional pLeiosQuorumStakeThreshold) + <*> convertToLedger id (optional pMaxEndorserBlockReferencesSize) + <*> convertToLedger id (optional pMaxEndorserBlockTxsSize) + <*> convertToLedger (OrdExUnits . toAlonzoExUnits) (optional pMaxEndorserBlockExecutionUnits) + <*> convertToLedger id (optional pMaxRefScriptSizePerEndorserBlock) + +pLeiosAnnouncementPeriodLength :: Parser Milliseconds32 +pLeiosAnnouncementPeriodLength = + Milliseconds32 + <$> Opt.option + integralReader + ( mconcat + [ Opt.long "leios-announcement-period-length" + , Opt.metavar "MILLISECONDS" + , Opt.help "Length of the Leios announcement period, in milliseconds." + ] + ) + +pLeiosVotePeriodLength :: Parser Milliseconds32 +pLeiosVotePeriodLength = + Milliseconds32 + <$> Opt.option + integralReader + ( mconcat + [ Opt.long "leios-vote-period-length" + , Opt.metavar "MILLISECONDS" + , Opt.help "Length of the Leios voting period, in milliseconds." + ] + ) + +pLeiosDiffusionPeriodLength :: Parser Milliseconds32 +pLeiosDiffusionPeriodLength = + Milliseconds32 + <$> Opt.option + integralReader + ( mconcat + [ Opt.long "leios-diffusion-period-length" + , Opt.metavar "MILLISECONDS" + , Opt.help "Length of the Leios diffusion period, in milliseconds." + ] + ) + +pLeiosCommitteeSize :: Parser Word16 +pLeiosCommitteeSize = + Opt.option integralReader $ + mconcat + [ Opt.long "leios-committee-size" + , Opt.metavar "WORD16" + , Opt.help "Number of seats on the Leios voting committee." + ] + +pLeiosQuorumStakeThreshold :: Parser Rational +pLeiosQuorumStakeThreshold = + Opt.option readRational $ + mconcat + [ Opt.long "leios-quorum-stake-threshold" + , Opt.metavar "RATIONAL" + , Opt.help "Fraction of committee stake required to certify an endorser block." + ] + +pMaxEndorserBlockReferencesSize :: Parser Word32 +pMaxEndorserBlockReferencesSize = + Opt.option integralReader $ + mconcat + [ Opt.long "max-endorser-block-references-size" + , Opt.metavar "WORD32" + , Opt.help "Maximum total size of the transaction references in an endorser block." + ] + +pMaxEndorserBlockTxsSize :: Parser Word32 +pMaxEndorserBlockTxsSize = + Opt.option integralReader $ + mconcat + [ Opt.long "max-endorser-block-txs-size" + , Opt.metavar "WORD32" + , Opt.help "Maximum total size of the transactions referenced by an endorser block." + ] + +pMaxEndorserBlockExecutionUnits :: Parser ExecutionUnits +pMaxEndorserBlockExecutionUnits = + uncurry ExecutionUnits + <$> Opt.option + pairIntegralReader + ( mconcat + [ Opt.long "max-endorser-block-execution-units" + , Opt.metavar "(INT, INT)" + , Opt.help $ + mconcat + [ "Max total script execution resource units allowed per endorser " + , "block. They are denominated as follows (steps, memory)." + ] + ] + ) + +pMaxRefScriptSizePerEndorserBlock :: Parser Word32 +pMaxRefScriptSizePerEndorserBlock = + Opt.option integralReader $ + mconcat + [ Opt.long "max-ref-script-size-per-endorser-block" + , Opt.metavar "WORD32" + , Opt.help "Maximum total size of reference scripts per endorser block." + ] pMaxRefScriptSizePerBlock :: Parser Word32 pMaxRefScriptSizePerBlock = diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Option.hs b/cardano-cli/src/Cardano/CLI/EraBased/Option.hs index 804acbaf9f..515cacf13c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Option.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Option.hs @@ -7,7 +7,6 @@ module Cardano.CLI.EraBased.Option ) where -import Cardano.Api (DijkstraEra) import Cardano.Api.Experimental import Cardano.CLI.Environment diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Query/Option.hs b/cardano-cli/src/Cardano/CLI/EraBased/Query/Option.hs index 510c38d524..bf7e51bdf7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Query/Option.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Query/Option.hs @@ -15,6 +15,7 @@ where import Cardano.Api hiding (QueryInShelleyBasedEra (..)) import Cardano.Api qualified as MemberStatus (MemberStatus (..)) import Cardano.Api.Experimental +import Cardano.Api.Experimental qualified as Exp import Cardano.CLI.Environment (EnvCli (..)) import Cardano.CLI.EraBased.Common.Option @@ -169,12 +170,23 @@ pKesPeriodInfo envCli = Opt.info (pKesPeriodInfoCmd envCli) $ Opt.progDesc "Get information about the current KES period and your node's operational certificate." -pPoolState :: IsEra era => EnvCli -> Parser (QueryCmds era) +poolStateDesc :: forall era. IsEra era => String +poolStateDesc = case useEra @era of + Exp.ConwayEra -> "Dump the pool state" + Exp.DijkstraEra -> + mconcat + [ "Dump the pool state. For pools that have registered a BLS voting key, the " + , "bksRegisteredIn epoch reported is the epoch the parameters take effect in " + , "rather than the epoch the key was registered in, as the node does not " + , "expose that value yet." + ] + +pPoolState :: forall era. IsEra era => EnvCli -> Parser (QueryCmds era) pPoolState envCli = Opt.hsubparser $ commandWithMetavar "pool-state" $ Opt.info (pQueryPoolStateCmd envCli) $ - Opt.progDesc "Dump the pool state" + Opt.progDesc (poolStateDesc @era) pTxMempool :: EnvCli -> Parser (QueryCmds era) pTxMempool envCli = @@ -206,7 +218,8 @@ pQueryLedgerPeerSnapshot envCli = -- which must be re-exposed thru cardano-api pQueryCmds - :: IsEra era + :: forall era + . IsEra era => EnvCli -> Maybe (Parser (QueryCmds era)) pQueryCmds envCli = @@ -271,7 +284,7 @@ pQueryCmds envCli = . Opt.hsubparser . commandWithMetavar "pool-state" . Opt.info (pQueryPoolStateCmd envCli) - $ Opt.progDesc "Dump the pool state" + $ Opt.progDesc (poolStateDesc @era) , pQueryProposalsCmd envCli , Just $ Opt.hsubparser $ diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs b/cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs index ee87e7af34..bc42b7a246 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs @@ -43,7 +43,8 @@ import Cardano.Api.Consensus qualified as Consensus import Cardano.Api.Experimental (obtainCommonConstraints) import Cardano.Api.Experimental qualified as Exp import Cardano.Api.Experimental.Certificate - ( OperationalCertificate (..) + ( KESPeriod (..) + , OperationalCertificate (..) , PoolId , getKesPeriod , getOpCertCount @@ -427,7 +428,7 @@ runQueryKesPeriodInfoCmd in CurrentKesPeriod $ unSlotNo currSlot `div` slotsPerKesPeriod opCertStartingKesPeriod :: OperationalCertificate -> OpCertStartingKesPeriod - opCertStartingKesPeriod = OpCertStartingKesPeriod . fromIntegral . getKesPeriod + opCertStartingKesPeriod = OpCertStartingKesPeriod . fromIntegral . unKESPeriod . getKesPeriod opCertEndKesPeriod :: GenesisParameters era -> OperationalCertificate -> OpCertEndingKesPeriod opCertEndKesPeriod gParams oCert = @@ -668,8 +669,10 @@ runQueryPoolStateCmd All -> Nothing Only poolIds -> Just $ fromList poolIds + currentEpoch <- easyRunQuery (queryEpoch (convert era)) + result <- easyRunQuery (queryPoolState beo poolFilter) - hoist liftIO $ writePoolState era outputFormat mOutFile result + hoist liftIO $ writePoolState era currentEpoch outputFormat mOutFile result ) & fromEitherCIOCli @@ -1171,16 +1174,17 @@ writeStakeSnapshots era outputFormat mOutFile qState = do -- .nesEs.esLState.lsDPState.dpsPState.psStakePoolParams. writePoolState :: Exp.Era era + -> EpochNo -> Vary [FormatJson, FormatYaml] -> Maybe (File () Out) - -> SerialisedPoolState + -> SerialisedPoolState era -> ExceptT QueryCmdError IO () -writePoolState era outputFormat mOutFile serialisedCurrentEpochState = do +writePoolState era currentEpoch outputFormat mOutFile serialisedCurrentEpochState = do poolState <- liftEither . first QueryCmdPoolStateDecodeError $ decodePoolState (convert era) serialisedCurrentEpochState - let poolStates = mkPoolStates poolState :: Map (L.KeyHash L.StakePool) PoolParams + let poolStates = mkPoolStates currentEpoch poolState :: Map (L.KeyHash L.StakePool) PoolParams output = outputFormat & ( id diff --git a/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Command.hs b/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Command.hs index 5c2a530bfa..48a4f6109f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Command.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Command.hs @@ -74,6 +74,9 @@ data StakePoolRegistrationCertificateCmdArgs era -- ^ Stake pool verification key. , vrfVerificationKeyOrFile :: !(VerificationKeyOrFile VrfKey) -- ^ VRF Verification key. + , blsSkeyFile :: !(Maybe (SigningKeyFile In)) + -- ^ BLS signing key, from which the registered voting key and its proof of + -- possession are derived. Required from Dijkstra onwards, unavailable before. , poolPledge :: !Coin -- ^ Pool pledge. , poolCost :: !Coin diff --git a/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Option.hs b/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Option.hs index b5802be05c..bb781f7995 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Option.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Option.hs @@ -10,6 +10,7 @@ where import Cardano.Api import Cardano.Api.Experimental +import Cardano.Api.Experimental qualified as Exp import Cardano.Api.Experimental.Certificate (Hash (StakePoolMetadataHash), StakePoolMetadata) import Cardano.Api.Ledger qualified as L @@ -18,6 +19,7 @@ import Cardano.CLI.EraBased.Common.Option import Cardano.CLI.EraBased.StakePool.Command qualified as Cmd import Cardano.CLI.EraIndependent.Hash.Command qualified as Cmd import Cardano.CLI.Parser +import Cardano.CLI.Type.Common (SigningKeyFile) import Data.Foldable qualified as F import Options.Applicative hiding (help, str) @@ -99,14 +101,16 @@ pStakePoolRegistrationCertificateCmd => EnvCli -> Maybe (Parser (Cmd.StakePoolCmds era)) pStakePoolRegistrationCertificateCmd envCli = do + let era = useEra pure $ Opt.hsubparser $ commandWithMetavar "registration-certificate" $ Opt.info ( fmap Cmd.StakePoolRegistrationCertificateCmd $ - Cmd.StakePoolRegistrationCertificateCmdArgs (convert useEra) + Cmd.StakePoolRegistrationCertificateCmdArgs (convert era) <$> pStakePoolVerificationKeyOrFile Nothing <*> pVrfVerificationKeyOrFile + <*> pBlsSigningKeyFileForEra era <*> pPoolPledge <*> pPoolCost <*> pPoolMargin @@ -124,6 +128,19 @@ pStakePoolRegistrationCertificateCmd envCli = do ) $ Opt.progDesc "Create a stake pool registration certificate" +-- | A pool registers its voting key from Dijkstra onwards, so the BLS signing +-- key is mandatory there and not offered at all in earlier eras. +pBlsSigningKeyFileForEra :: Exp.Era era -> Parser (Maybe (SigningKeyFile In)) +pBlsSigningKeyFileForEra Exp.ConwayEra = pure Nothing +pBlsSigningKeyFileForEra Exp.DijkstraEra = Just <$> pBlsSigningKeyFile + +pBlsSigningKeyFile :: Parser (SigningKeyFile In) +pBlsSigningKeyFile = + File + <$> parseFilePath + "bls-signing-key-file" + "Input filepath of the BLS signing key." + pStakePoolDeregistrationCertificateCmd :: IsEra era => Maybe (Parser (Cmd.StakePoolCmds era)) pStakePoolDeregistrationCertificateCmd = do diff --git a/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Run.hs b/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Run.hs index a5a5ee4e5e..b4697f0a71 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/StakePool/Run.hs @@ -43,7 +43,7 @@ import Cardano.CLI.Type.Error.HashCmdError (FetchURLError (..)) import Cardano.CLI.Type.Error.StakePoolCmdError import Cardano.CLI.Type.Key (readVerificationKeyOrFile) -import Control.Monad (when) +import Control.Monad (forM, when) import Data.ByteString.Char8 qualified as BS import Data.ByteString.Lazy qualified as LBS import Data.Function ((&)) @@ -77,6 +77,7 @@ runStakePoolRegistrationCertificateCmd { era , poolVerificationKeyOrFile , vrfVerificationKeyOrFile + , blsSkeyFile , poolPledge , poolCost , poolMargin @@ -114,10 +115,19 @@ runStakePoolRegistrationCertificateCmd ownerStakeVerificationKeyOrFiles let stakePoolOwners' = map verificationKeyHash sPoolOwnerVkeys + -- BLS voting key, registered from Dijkstra onwards + mBlsKey <- + forM blsSkeyFile $ \skeyFile -> do + blsSkey <- + fromEitherIOCli @(FileError TextEnvelopeError) $ + readFileTextEnvelope @(SigningKey BlsKey) skeyFile + pure $ toLedgerBlsKey blsSkey + let stakePoolParams = StakePoolParameters { stakePoolId = stakePoolId' , stakePoolVRF = vrfKeyHash' + , stakePoolBlsKey = mBlsKey , stakePoolCost = poolCost , stakePoolMargin = poolMargin , stakePoolRewardAccount = rewardAccountAddr diff --git a/cardano-cli/src/Cardano/CLI/EraIndependent/Key/Run.hs b/cardano-cli/src/Cardano/CLI/EraIndependent/Key/Run.hs index 6f581620eb..0847c666e1 100644 --- a/cardano-cli/src/Cardano/CLI/EraIndependent/Key/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraIndependent/Key/Run.hs @@ -43,7 +43,7 @@ import Cardano.Api.Byron qualified as ByronApi import Cardano.Api.Crypto.Ed25519Bip32 (xPrvFromBytes) import Cardano.Api.Ledger qualified as L -import Cardano.Binary.FixedSizeCodec (rawDecodeFixedSized) +import Cardano.Binary.FixedSizeCodec qualified as FixedSized import Cardano.CLI.Byron.Key qualified as Byron import Cardano.CLI.Compatible.Exception import Cardano.CLI.EraIndependent.Key.Command qualified as Cmd @@ -498,7 +498,7 @@ runConvertITNBip32KeyCmd convertITNVerificationKey :: Text -> Either ItnKeyConversionError (VerificationKey StakeKey) convertITNVerificationKey pubKey = do (_, _, keyBS) <- first ItnKeyBech32DecodeError (decodeBech32 pubKey) - case rawDecodeFixedSized keyBS of + case FixedSized.rawDecodeFixedSized keyBS of Just verKey -> Right . StakeVerificationKey $ L.VKey verKey Nothing -> Left $ ItnVerificationKeyDeserialisationError keyBS @@ -506,7 +506,7 @@ convertITNVerificationKey pubKey = do convertITNSigningKey :: Text -> Either ItnKeyConversionError (SigningKey StakeKey) convertITNSigningKey privKey = do (_, _, keyBS) <- first ItnKeyBech32DecodeError (decodeBech32 privKey) - case rawDecodeFixedSized keyBS of + case FixedSized.rawDecodeFixedSized keyBS of Just signKey -> Right $ StakeSigningKey signKey Nothing -> Left $ ItnSigningKeyDeserialisationError keyBS diff --git a/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Command.hs b/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Command.hs index 12b34dc76a..cc31508cab 100644 --- a/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Command.hs +++ b/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Command.hs @@ -10,8 +10,6 @@ module Cardano.CLI.EraIndependent.Node.Command , NodeKeyGenVRFCmdArgs (..) , NodeKeyGenBLSCmdArgs (..) , NodeKeyHashVRFCmdArgs (..) - , NodeKeyHashBLSCmdArgs (..) - , NodeIssuePopBLSCmdArgs (..) , NodeNewCounterCmdArgs (..) , NodeIssueOpCertCmdArgs (..) ) @@ -31,8 +29,6 @@ data NodeCmds | NodeKeyGenVRFCmd !NodeKeyGenVRFCmdArgs | NodeKeyGenBLSCmd !NodeKeyGenBLSCmdArgs | NodeKeyHashVRFCmd !NodeKeyHashVRFCmdArgs - | NodeKeyHashBLSCmd !NodeKeyHashBLSCmdArgs - | NodeIssuePopBLSCmd !NodeIssuePopBLSCmdArgs | NodeNewCounterCmd !NodeNewCounterCmdArgs | NodeIssueOpCertCmd !NodeIssueOpCertCmdArgs deriving Show @@ -77,21 +73,6 @@ data NodeKeyHashVRFCmdArgs } deriving Show -data NodeKeyHashBLSCmdArgs - = NodeKeyHashBLSCmdArgs - { vkeySource :: !(VerificationKeyOrFile BlsKey) - , mOutFile :: !(Maybe (File () Out)) - } - deriving Show - -data NodeIssuePopBLSCmdArgs - = NodeIssuePopBLSCmdArgs - { blsSkeyFile :: !(SigningKeyFile In) - -- ^ The BLS signing key. - , outFile :: !(File () Out) - } - deriving Show - data NodeNewCounterCmdArgs = NodeNewCounterCmdArgs { coldVkeyFile :: !ColdVerificationKeyOrFile @@ -121,7 +102,5 @@ renderNodeCmds = \case NodeKeyGenVRFCmd{} -> "node key-gen-VRF" NodeKeyGenBLSCmd{} -> "node key-gen-BLS" NodeKeyHashVRFCmd{} -> "node key-hash-VRF" - NodeKeyHashBLSCmd{} -> "node key-hash-BLS" - NodeIssuePopBLSCmd{} -> "node issue-pop-BLS" NodeNewCounterCmd{} -> "node new-counter" NodeIssueOpCertCmd{} -> "node issue-op-cert" diff --git a/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Option.hs b/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Option.hs index ae8be2d3f5..ce01dbc1d5 100644 --- a/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Option.hs +++ b/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Option.hs @@ -10,14 +10,12 @@ module Cardano.CLI.EraIndependent.Node.Option ) where -import Cardano.Api (File (..), FileDirection (In)) import Cardano.Api.Experimental qualified as Exp import Cardano.CLI.EraBased.Common.Option import Cardano.CLI.EraIndependent.Node.Command import Cardano.CLI.EraIndependent.Node.Command qualified as Cmd import Cardano.CLI.Parser -import Cardano.CLI.Type.Common (SigningKeyFile) import Data.Foldable import Data.Maybe (catMaybes) @@ -62,8 +60,6 @@ pNodeCmds = mconcat [ "Print hash of a node's operational VRF key." ] - , pKeyHashBLS @era - , pIssuePopBLS @era , Just $ Opt.hsubparser $ commandWithMetavar "new-counter" $ @@ -148,51 +144,6 @@ pKeyHashVRF = <$> pVerificationKeyOrFileIn <*> pMaybeOutputFile -pKeyHashBLS :: forall era. Exp.IsEra era => Maybe (Parser NodeCmds) -pKeyHashBLS = case Exp.useEra @era of - Exp.ConwayEra -> Nothing - Exp.DijkstraEra -> - Just - $ Opt.hsubparser - $ commandWithMetavar "key-hash-BLS" - . Opt.info - ( fmap Cmd.NodeKeyHashBLSCmd $ - Cmd.NodeKeyHashBLSCmdArgs - <$> pVerificationKeyOrFileIn - <*> pMaybeOutputFile - ) - $ Opt.progDesc - $ mconcat - [ "Print hash of a node's operational BLS key." - ] - -pIssuePopBLS :: forall era. Exp.IsEra era => Maybe (Parser NodeCmds) -pIssuePopBLS = case Exp.useEra @era of - Exp.ConwayEra -> Nothing - Exp.DijkstraEra -> - Just - $ Opt.hsubparser - $ commandWithMetavar "issue-pop-BLS" - $ Opt.info - ( fmap Cmd.NodeIssuePopBLSCmd $ - Cmd.NodeIssuePopBLSCmdArgs - <$> pBlsSigningKeyFile - <*> pOutputFile - ) - $ Opt.progDesc - $ mconcat - [ "Issue a BLS proof of possession for a node's operational BLS key. " - , "Both a BLS key and its proof of possession are required by stake pool " - , "operators to participate as voting member/block producing node in Leios." - ] - -pBlsSigningKeyFile :: Parser (SigningKeyFile In) -pBlsSigningKeyFile = - File - <$> parseFilePath - "bls-signing-key-file" - "Input filepath of the BLS signing key." - pNewCounter :: Parser NodeCmds pNewCounter = fmap Cmd.NodeNewCounterCmd $ diff --git a/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Run.hs b/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Run.hs index 508b18d60a..841f920992 100644 --- a/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraIndependent/Node/Run.hs @@ -13,7 +13,6 @@ module Cardano.CLI.EraIndependent.Node.Run , runNodeKeyGenKesCmd , runNodeKeyGenVrfCmd , runNodeKeyHashVrfCmd - , runNodeKeyHashBlsCmd , runNodeNewCounterCmd ) where @@ -44,8 +43,6 @@ runNodeCmds = \case Cmd.NodeKeyGenVRFCmd args -> runNodeKeyGenVrfCmd args Cmd.NodeKeyGenBLSCmd args -> runNodeKeyGenBLSCmd args Cmd.NodeKeyHashVRFCmd args -> runNodeKeyHashVrfCmd args - Cmd.NodeKeyHashBLSCmd args -> runNodeKeyHashBlsCmd args - Cmd.NodeIssuePopBLSCmd args -> runNodeIssuePopBLSCmd args Cmd.NodeNewCounterCmd args -> runNodeNewCounterCmd args Cmd.NodeIssueOpCertCmd args -> runNodeIssueOpCertCmd args @@ -276,41 +273,6 @@ runNodeKeyHashVrfCmd fromEitherIOCli @(FileError ()) $ writeByteStringOutput mOutFile hexKeyHash -runNodeKeyHashBlsCmd - :: Cmd.NodeKeyHashBLSCmdArgs - -> CIO e () -runNodeKeyHashBlsCmd - Cmd.NodeKeyHashBLSCmdArgs - { vkeySource - , mOutFile - } = do - vkey <- - readVerificationKeyOrFile vkeySource - - let hexKeyHash = serialiseToRawBytesHex (verificationKeyHash vkey) - - fromEitherIOCli @(FileError ()) $ - writeByteStringOutput mOutFile hexKeyHash - -runNodeIssuePopBLSCmd - :: () - => Cmd.NodeIssuePopBLSCmdArgs - -> CIO e () -runNodeIssuePopBLSCmd - Cmd.NodeIssuePopBLSCmdArgs - { blsSkeyFile - , outFile - } = do - skey <- - fromEitherIOCli @(FileError TextEnvelopeError) $ - readFileTextEnvelope @(SigningKey BlsKey) blsSkeyFile - - let pop = createBlsPossessionProof skey - - fromEitherIOCli @(FileError ()) $ - writeLazyByteStringFile outFile $ - textEnvelopeToJSON Nothing pop - runNodeNewCounterCmd :: () => Cmd.NodeNewCounterCmdArgs diff --git a/cardano-cli/src/Cardano/CLI/Type/Common.hs b/cardano-cli/src/Cardano/CLI/Type/Common.hs index 91193aa5c1..950f60c9ca 100644 --- a/cardano-cli/src/Cardano/CLI/Type/Common.hs +++ b/cardano-cli/src/Cardano/CLI/Type/Common.hs @@ -371,8 +371,20 @@ data PoolParams = PoolParams } deriving Show -mkPoolStates :: PoolState era -> Map (L.KeyHash L.StakePool) PoolParams +-- | The current epoch is needed to reconstruct a 'L.StakePoolState' from the +-- query result. 'L.QueryPoolStateResult' does not report the epoch in which a +-- pool's BLS voting key was registered, so the epoch in which the parameters +-- take effect is used instead: the current epoch for the active parameters and +-- the next one for the future parameters, which @POOLREAP@ activates at the +-- epoch boundary. This only affects pools that have registered a BLS key, and +-- it means the @bksRegisteredIn@ field in the @query pool-state@ output is a +-- placeholder. +-- +-- TODO: use the real registration epoch once the ledger exposes it through a +-- query. See https://github.com/IntersectMBO/cardano-ledger/issues/6147. +mkPoolStates :: EpochNo -> PoolState era -> Map (L.KeyHash L.StakePool) PoolParams mkPoolStates + currentEpoch ( PoolState ( L.QueryPoolStateResult { L.qpsrStakePoolParams @@ -385,10 +397,13 @@ mkPoolStates let mDeposit = L.toCompact =<< Map.lookup kh qpsrDeposits stakingCredentials = mempty -- QueryPoolStateResult does not provide delegators PoolParams - { poolParameters = (\deposit -> L.mkStakePoolState deposit stakingCredentials pp) <$> mDeposit + { poolParameters = + (\deposit -> L.mkStakePoolState currentEpoch deposit stakingCredentials pp) <$> mDeposit , futurePoolParameters = do futurePp <- Map.lookup kh qpsrFutureStakePoolParams - (\deposit -> L.mkStakePoolState deposit stakingCredentials futurePp) <$> mDeposit + -- Future parameters only take effect at the next epoch boundary. + (\deposit -> L.mkStakePoolState (succ currentEpoch) deposit stakingCredentials futurePp) + <$> mDeposit , retiringEpoch = Map.lookup kh qpsrRetiring } diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/StakePool/RegistrationCertificate.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/StakePool/RegistrationCertificate.hs new file mode 100644 index 0000000000..813a7878c6 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Dijkstra/StakePool/RegistrationCertificate.hs @@ -0,0 +1,153 @@ +module Test.Golden.Dijkstra.StakePool.RegistrationCertificate where + +import Control.Monad (void) +import Data.List (isInfixOf) +import System.Exit (ExitCode (..)) + +import Test.Cardano.CLI.Util + ( execCardanoCLI + , execDetailCardanoCLI + , noteInputFile + , noteTempFile + , propertyOnce + , watchdogProp + ) + +import Hedgehog (Property) +import Hedgehog qualified as H +import Hedgehog.Extras qualified as H + +-- | From Dijkstra onwards a pool registers a BLS voting key, so the emitted +-- certificate carries the verification key together with its proof of +-- possession. The BLS signing key is a fixed input and the proof of possession +-- is deterministic, so the whole certificate can be compared against a golden +-- file. +hprop_golden_dijkstra_stake_pool_registration_certificate :: Property +hprop_golden_dijkstra_stake_pool_registration_certificate = + watchdogProp . propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + operatorVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/operator.vkey" + vrfVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/vrf.vkey" + ownerVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/owner.vkey" + blsSigningKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/bls_keys/signing_key" + registrationCertFile <- noteTempFile tempDir "registration.cert" + + void $ + execCardanoCLI + [ "dijkstra" + , "stake-pool" + , "registration-certificate" + , "--testnet-magic" + , "42" + , "--pool-pledge" + , "0" + , "--pool-cost" + , "0" + , "--pool-margin" + , "0" + , "--cold-verification-key-file" + , operatorVerificationKeyFile + , "--vrf-verification-key-file" + , vrfVerificationKeyFile + , "--bls-signing-key-file" + , blsSigningKeyFile + , "--pool-reward-account-verification-key-file" + , ownerVerificationKeyFile + , "--pool-owner-stake-verification-key-file" + , ownerVerificationKeyFile + , "--out-file" + , registrationCertFile + ] + + goldenFile <- + H.note "test/cardano-cli-golden/files/golden/dijkstra/stake_pool/registration_certificate.json" + + H.diffFileVsGoldenFile registrationCertFile goldenFile + +-- | The BLS voting key is mandatory in Dijkstra. +hprop_golden_dijkstra_stake_pool_registration_certificate_missing_bls_key :: Property +hprop_golden_dijkstra_stake_pool_registration_certificate_missing_bls_key = + watchdogProp . propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + operatorVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/operator.vkey" + vrfVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/vrf.vkey" + ownerVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/owner.vkey" + registrationCertFile <- noteTempFile tempDir "registration.cert" + + (exitCode, _stdout, stderr) <- + execDetailCardanoCLI + [ "dijkstra" + , "stake-pool" + , "registration-certificate" + , "--testnet-magic" + , "42" + , "--pool-pledge" + , "0" + , "--pool-cost" + , "0" + , "--pool-margin" + , "0" + , "--cold-verification-key-file" + , operatorVerificationKeyFile + , "--vrf-verification-key-file" + , vrfVerificationKeyFile + , "--pool-reward-account-verification-key-file" + , ownerVerificationKeyFile + , "--pool-owner-stake-verification-key-file" + , ownerVerificationKeyFile + , "--out-file" + , registrationCertFile + ] + + exitCode H.=== ExitFailure 1 + H.assertWith stderr ("Missing: --bls-signing-key-file" `isInfixOf`) + +-- | A pool cannot register a BLS voting key before Dijkstra, so the option is +-- not offered in Conway at all. +hprop_golden_conway_stake_pool_registration_certificate_rejects_bls_key :: Property +hprop_golden_conway_stake_pool_registration_certificate_rejects_bls_key = + watchdogProp . propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + operatorVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/operator.vkey" + vrfVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/vrf.vkey" + ownerVerificationKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/node-pool/owner.vkey" + blsSigningKeyFile <- + noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/bls_keys/signing_key" + registrationCertFile <- noteTempFile tempDir "registration.cert" + + (exitCode, _stdout, stderr) <- + execDetailCardanoCLI + [ "conway" + , "stake-pool" + , "registration-certificate" + , "--testnet-magic" + , "42" + , "--pool-pledge" + , "0" + , "--pool-cost" + , "0" + , "--pool-margin" + , "0" + , "--cold-verification-key-file" + , operatorVerificationKeyFile + , "--vrf-verification-key-file" + , vrfVerificationKeyFile + , "--bls-signing-key-file" + , blsSigningKeyFile + , "--pool-reward-account-verification-key-file" + , ownerVerificationKeyFile + , "--pool-owner-stake-verification-key-file" + , ownerVerificationKeyFile + , "--out-file" + , registrationCertFile + ] + + exitCode H.=== ExitFailure 1 + H.assertWith stderr ("Invalid option `--bls-signing-key-file'" `isInfixOf`) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs index 06bdd52aee..a63755aaf1 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs @@ -564,3 +564,67 @@ base_golden_conway_governance_action_create_hardfork hash tempDir = do H.note "test/cardano-cli-golden/files/golden/governance/action/hardfork/conway-create-hardfork.action" H.diffFileVsGoldenFile actionFile goldenActionFile + +-- | The Dijkstra era adds the Leios protocol parameters on top of the Conway +-- ones. Set every parameter introduced in Dijkstra to a distinct value in a +-- single update, so that a field-order or conversion mistake in +-- @pIntroducedInDijkstraPParams@ shows up as a diff against the golden action +-- rather than only as a change in the generated help text. +hprop_golden_dijkstra_governance_action_create_protocol_parameters_update :: Property +hprop_golden_dijkstra_governance_action_create_protocol_parameters_update = + watchdogProp . propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + stakeAddressVKeyFile <- H.note "test/cardano-cli-golden/files/input/governance/stake-address.vkey" + + actionFile <- noteTempFile tempDir "action" + + void $ + execCardanoCLI + [ "dijkstra" + , "governance" + , "action" + , "create-protocol-parameters-update" + , "--anchor-url" + , "example.com" + , "--anchor-data-hash" + , "c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" + , "--mainnet" + , "--deposit-return-stake-verification-key-file" + , stakeAddressVKeyFile + , "--governance-action-deposit" + , "12345" + , -- Introduced in Dijkstra, before Leios + "--max-ref-script-size-per-block" + , "1000001" + , "--max-ref-script-size-per-tx" + , "1000002" + , "--ref-script-cost-stride" + , "1000003" + , "--ref-script-cost-multiplier" + , "11/10" + , -- Leios + "--leios-announcement-period-length" + , "1000" + , "--leios-vote-period-length" + , "2000" + , "--leios-diffusion-period-length" + , "3000" + , "--leios-committee-size" + , "500" + , "--leios-quorum-stake-threshold" + , "3/4" + , "--max-endorser-block-references-size" + , "1000004" + , "--max-endorser-block-txs-size" + , "1000005" + , "--max-endorser-block-execution-units" + , "(1000006, 1000007)" + , "--max-ref-script-size-per-endorser-block" + , "1000008" + , "--out-file" + , actionFile + ] + + goldenActionFile <- + H.note + "test/cardano-cli-golden/files/golden/governance/action/dijkstra-create-protocol-parameters-update.action" + H.diffFileVsGoldenFile actionFile goldenActionFile diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/IssuePopBls.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/IssuePopBls.hs deleted file mode 100644 index 462ab5f231..0000000000 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/IssuePopBls.hs +++ /dev/null @@ -1,32 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -module Test.Golden.Shelley.Node.IssuePopBls where - -import Control.Monad (void) - -import Test.Cardano.CLI.Util - -import Hedgehog (Property) -import Hedgehog.Extras qualified as H - -hprop_golden_shelleyNodeIssuePopBls :: Property -hprop_golden_shelleyNodeIssuePopBls = - watchdogProp . propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do - signingKeyFile <- - noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/bls_keys/signing_key" - goldenPopFile <- - noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/bls_keys/signing_key.pop" - popFile <- noteTempFile tempDir "bls.pop" - - void $ - execCardanoCLI - [ "dijkstra" - , "node" - , "issue-pop-BLS" - , "--bls-signing-key-file" - , signingKeyFile - , "--out-file" - , popFile - ] - - H.diffFileVsGoldenFile popFile goldenPopFile diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyHashBls.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyHashBls.hs deleted file mode 100644 index dd0ef720fb..0000000000 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/Node/KeyHashBls.hs +++ /dev/null @@ -1,28 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -module Test.Golden.Shelley.Node.KeyHashBls where - -import Test.Cardano.CLI.Util - -import Hedgehog (Property) -import Hedgehog.Extras.Test qualified as H - -hprop_golden_shelleyNodeKeyHashBls :: Property -hprop_golden_shelleyNodeKeyHashBls = - watchdogProp . propertyOnce $ do - verificationKeyFile <- - noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/bls_keys/verification_key" - goldenVerificationKeyHashFile <- - noteInputFile - "test/cardano-cli-golden/files/input/shelley/keys/bls_keys/verification_key.key-hash" - - verificationKeyHash <- - execCardanoCLI - [ "dijkstra" - , "node" - , "key-hash-BLS" - , "--verification-key-file" - , verificationKeyFile - ] - - H.diffVsGoldenFile verificationKeyHash goldenVerificationKeyHashFile diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs index a78860b4cb..4d6bd8c4e3 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Certificates/Operational.hs @@ -2,7 +2,7 @@ module Test.Golden.Shelley.TextEnvelope.Certificates.Operational where -import Cardano.Api (HasTextEnvelope (..)) +import Cardano.Api (textEnvelopeType) import Cardano.Api.Experimental.Certificate (AsType (AsOperationalCertificate)) import Control.Monad (void) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs index bb001c0115..17d09bfab4 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/ExtendedPaymentKeys.hs @@ -3,7 +3,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.ExtendedPaymentKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Control.Monad (void) import Text.Regex.TDFA ((=~)) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs index 5e3b975ae1..81d7e6870c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisDelegateKeys.hs @@ -2,7 +2,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.GenesisDelegateKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Cardano.Api.Experimental.Certificate (AsType (AsOperationalCertificateIssueCounter)) import Control.Monad (void) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs index 0b60eeb0e1..cb622d2d80 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisKeys.hs @@ -2,7 +2,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.GenesisKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Control.Monad (void) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs index cdaf8f5cb1..f73633553b 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/GenesisUTxOKeys.hs @@ -2,7 +2,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.GenesisUTxOKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Control.Monad (void) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs index edfb936371..82145b0c32 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/KESKeys.hs @@ -3,7 +3,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.KESKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Control.Monad (void) import Text.Regex.TDFA ((=~)) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs index 0958b9df10..bcdfca3244 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/PaymentKeys.hs @@ -3,7 +3,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.PaymentKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Control.Monad (void) import Text.Regex.TDFA ((=~)) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs index 397b6395d0..146359c0a2 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/StakeKeys.hs @@ -3,7 +3,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.StakeKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Control.Monad (void) import Text.Regex.TDFA ((=~)) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs index fa2cbeaa97..ef48f26d17 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Shelley/TextEnvelope/Keys/VRFKeys.hs @@ -3,7 +3,7 @@ module Test.Golden.Shelley.TextEnvelope.Keys.VRFKeys where -import Cardano.Api (AsType (..), HasTextEnvelope (..)) +import Cardano.Api (AsType (..), textEnvelopeType) import Control.Monad (void) import Text.Regex.TDFA ((=~)) diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/stake_pool/registration_certificate.json b/cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/stake_pool/registration_certificate.json new file mode 100644 index 0000000000..46e46b4b0c --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/dijkstra/stake_pool/registration_certificate.json @@ -0,0 +1,5 @@ +{ + "type": "Certificate", + "description": "Stake Pool Registration Certificate", + "cborHex": "8b03581c4124a0c2ba8a7ba05824b3df23f706a1c8b3239446ab16709ae85aa158206aa5f600f54659d456dc2628997df23d98f8f85681edd3e6f4a9340cb06b8db78258608f25d696f778b68ceca228315b9366423029d781a36c4353a9ccfc7b4e879b5827324000c1c0748d19f11ea92857d7ce004c3c11ef18949e6df8cfced42c25764ff95c3603973af54e38b7d760a2a9921959498ef895d66d8ba2266dcb69659b583087f83b7745e33d7eab3b5bf257eeefe2642d6fc7b5255d53c3febb881b62e335291ea4addc744222f1aee37d17a577f30000d81e820001581de0749440f878a5ba2ac3ab03dbdec6ae3ad5c89f06fc9c031611947803d9010281581c749440f878a5ba2ac3ab03dbdec6ae3ad5c89f06fc9c03161194780380f6" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/dijkstra-create-protocol-parameters-update.action b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/dijkstra-create-protocol-parameters-update.action new file mode 100644 index 0000000000..3e20bfba91 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/dijkstra-create-protocol-parameters-update.action @@ -0,0 +1,5 @@ +{ + "type": "Governance proposal", + "description": "Update protocol parameters proposal", + "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6ad18221a000f424118231a000f424218241a000f42431825d81e820b0a18281903e818291907d0182a190bb8182b1901f4182cd81e820304182d1a000f4244182e1a000f4245182f821a000f42471a000f424618301a000f4248f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 8281519c36..7416688660 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -3983,6 +3983,15 @@ Usage: cardano-cli dijkstra governance action create-protocol-parameters-update [--max-ref-script-size-per-tx WORD32] [--ref-script-cost-stride WORD32] [--ref-script-cost-multiplier RATIONAL] + [--leios-announcement-period-length MILLISECONDS] + [--leios-vote-period-length MILLISECONDS] + [--leios-diffusion-period-length MILLISECONDS] + [--leios-committee-size WORD16] + [--leios-quorum-stake-threshold RATIONAL] + [--max-endorser-block-references-size WORD32] + [--max-endorser-block-txs-size WORD32] + [--max-endorser-block-execution-units (INT, INT)] + [--max-ref-script-size-per-endorser-block WORD32] [--cost-model-file FILE] --out-file FILEPATH @@ -4256,8 +4265,6 @@ Usage: cardano-cli dijkstra node | key-gen-VRF | key-gen-BLS | key-hash-VRF - | key-hash-BLS - | issue-pop-BLS | new-counter | issue-op-cert ) @@ -4320,23 +4327,6 @@ Usage: cardano-cli dijkstra node key-hash-VRF Print hash of a node's operational VRF key. -Usage: cardano-cli dijkstra node key-hash-BLS - ( --verification-key STRING - | --verification-key-file FILEPATH - ) - [--out-file FILEPATH] - - - Print hash of a node's operational BLS key. - -Usage: cardano-cli dijkstra node issue-pop-BLS --bls-signing-key-file FILEPATH - --out-file FILEPATH - - - Issue a BLS proof of possession for a node's operational BLS key. Both a BLS - key and its proof of possession are required by stake pool operators to - participate as voting member/block producing node in Leios. - Usage: cardano-cli dijkstra node new-counter ( --stake-pool-verification-key STRING | --stake-pool-verification-extended-key STRING @@ -4672,7 +4662,10 @@ Usage: cardano-cli dijkstra query pool-state [--out-file FILEPATH] - Dump the pool state + Dump the pool state. For pools that have registered a BLS voting key, the + bksRegisteredIn epoch reported is the epoch the parameters take effect in + rather than the epoch the key was registered in, as the node does not expose + that value yet. Usage: cardano-cli dijkstra query proposals [--cardano-mode @@ -5204,6 +5197,7 @@ Usage: cardano-cli dijkstra stake-pool registration-certificate ( --vrf-verification-key STRING | --vrf-verification-key-file FILEPATH ) + --bls-signing-key-file FILEPATH --pool-pledge LOVELACE --pool-cost LOVELACE --pool-margin RATIONAL diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_governance_action_create-protocol-parameters-update.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_governance_action_create-protocol-parameters-update.cli index 4743d7ca0b..94fd5ca556 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_governance_action_create-protocol-parameters-update.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_governance_action_create-protocol-parameters-update.cli @@ -62,6 +62,15 @@ Usage: cardano-cli dijkstra governance action create-protocol-parameters-update [--max-ref-script-size-per-tx WORD32] [--ref-script-cost-stride WORD32] [--ref-script-cost-multiplier RATIONAL] + [--leios-announcement-period-length MILLISECONDS] + [--leios-vote-period-length MILLISECONDS] + [--leios-diffusion-period-length MILLISECONDS] + [--leios-committee-size WORD16] + [--leios-quorum-stake-threshold RATIONAL] + [--max-endorser-block-references-size WORD32] + [--max-endorser-block-txs-size WORD32] + [--max-endorser-block-execution-units (INT, INT)] + [--max-ref-script-size-per-endorser-block WORD32] [--cost-model-file FILE] --out-file FILEPATH @@ -219,6 +228,32 @@ Available options: calculation. --ref-script-cost-multiplier RATIONAL Reference script cost multiplier for fee calculation. + --leios-announcement-period-length MILLISECONDS + Length of the Leios announcement period, in + milliseconds. + --leios-vote-period-length MILLISECONDS + Length of the Leios voting period, in milliseconds. + --leios-diffusion-period-length MILLISECONDS + Length of the Leios diffusion period, in + milliseconds. + --leios-committee-size WORD16 + Number of seats on the Leios voting committee. + --leios-quorum-stake-threshold RATIONAL + Fraction of committee stake required to certify an + endorser block. + --max-endorser-block-references-size WORD32 + Maximum total size of the transaction references in + an endorser block. + --max-endorser-block-txs-size WORD32 + Maximum total size of the transactions referenced by + an endorser block. + --max-endorser-block-execution-units (INT, INT) + Max total script execution resource units allowed per + endorser block. They are denominated as follows + (steps, memory). + --max-ref-script-size-per-endorser-block WORD32 + Maximum total size of reference scripts per endorser + block. --cost-model-file FILE Filepath of the JSON formatted cost model --out-file FILEPATH The output file. -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node.cli index d8f00ee7c3..393a9a0f0d 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node.cli @@ -4,8 +4,6 @@ Usage: cardano-cli dijkstra node | key-gen-VRF | key-gen-BLS | key-hash-VRF - | key-hash-BLS - | issue-pop-BLS | new-counter | issue-op-cert ) @@ -23,11 +21,5 @@ Available commands: key-gen-VRF Create a key pair for a node VRF operational key key-gen-BLS Create a key pair for a node BLS operational key key-hash-VRF Print hash of a node's operational VRF key. - key-hash-BLS Print hash of a node's operational BLS key. - issue-pop-BLS Issue a BLS proof of possession for a node's - operational BLS key. Both a BLS key and its proof of - possession are required by stake pool operators to - participate as voting member/block producing node in - Leios. new-counter Create a new certificate issue counter issue-op-cert Issue a node operational certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node_issue-pop-BLS.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node_issue-pop-BLS.cli deleted file mode 100644 index 15f1e2b0a5..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node_issue-pop-BLS.cli +++ /dev/null @@ -1,13 +0,0 @@ -Usage: cardano-cli dijkstra node issue-pop-BLS --bls-signing-key-file FILEPATH - --out-file FILEPATH - - - Issue a BLS proof of possession for a node's operational BLS key. Both a BLS - key and its proof of possession are required by stake pool operators to - participate as voting member/block producing node in Leios. - -Available options: - --bls-signing-key-file FILEPATH - Input filepath of the BLS signing key. - --out-file FILEPATH The output file. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node_key-hash-BLS.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node_key-hash-BLS.cli deleted file mode 100644 index 4980153967..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_node_key-hash-BLS.cli +++ /dev/null @@ -1,16 +0,0 @@ -Usage: cardano-cli dijkstra node key-hash-BLS - ( --verification-key STRING - | --verification-key-file FILEPATH - ) - [--out-file FILEPATH] - - - Print hash of a node's operational BLS key. - -Available options: - --verification-key STRING - Verification key (Bech32 or hex-encoded). - --verification-key-file FILEPATH - Input filepath of the verification key. - --out-file FILEPATH Optional output file. Default is to write to stdout. - -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query.cli index 9e461ddff8..fd0d9a6232 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query.cli @@ -66,7 +66,11 @@ Available commands: pool parameters (Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced command) - pool-state Dump the pool state + pool-state Dump the pool state. For pools that have registered a + BLS voting key, the bksRegisteredIn epoch reported is + the epoch the parameters take effect in rather than + the epoch the key was registered in, as the node does + not expose that value yet. proposals Get the governance proposals that are eligible for ratification. Proposals submitted during the current epoch are excluded, as they cannot be ratified until diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query_pool-state.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query_pool-state.cli index dd856e9250..bd364fa6c7 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query_pool-state.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_query_pool-state.cli @@ -15,7 +15,10 @@ Usage: cardano-cli dijkstra query pool-state [--out-file FILEPATH] - Dump the pool state + Dump the pool state. For pools that have registered a BLS voting key, the + bksRegisteredIn epoch reported is the epoch the parameters take effect in + rather than the epoch the key was registered in, as the node does not expose + that value yet. Available options: --cardano-mode For talking to a node running in full Cardano mode diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_stake-pool_registration-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_stake-pool_registration-certificate.cli index 0f16a3a2ec..8e56503988 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_stake-pool_registration-certificate.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/dijkstra_stake-pool_registration-certificate.cli @@ -6,6 +6,7 @@ Usage: cardano-cli dijkstra stake-pool registration-certificate ( --vrf-verification-key STRING | --vrf-verification-key-file FILEPATH ) + --bls-signing-key-file FILEPATH --pool-pledge LOVELACE --pool-cost LOVELACE --pool-margin RATIONAL @@ -46,6 +47,8 @@ Available options: VRF verification key (Bech32 or hex-encoded). --vrf-verification-key-file FILEPATH Filepath of the VRF verification key. + --bls-signing-key-file FILEPATH + Input filepath of the BLS signing key. --pool-pledge LOVELACE The stake pool's pledge. --pool-cost LOVELACE The stake pool's cost. --pool-margin RATIONAL The stake pool's margin. diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/bls_keys/signing_key.pop b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/bls_keys/signing_key.pop deleted file mode 100644 index 59d9d2b363..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/bls_keys/signing_key.pop +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "BlsPossessionProof_bls12-381-BLS-Signature-Mininimal-Signature-Size", - "description": "BLS12-381 possession proof", - "cborHex": "583087f83b7745e33d7eab3b5bf257eeefe2642d6fc7b5255d53c3febb881b62e335291ea4addc744222f1aee37d17a577f3" -} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/bls_keys/verification_key.key-hash b/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/bls_keys/verification_key.key-hash deleted file mode 100644 index 384924225e..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/input/shelley/keys/bls_keys/verification_key.key-hash +++ /dev/null @@ -1 +0,0 @@ -be1845522652ed53a57652b17927b8f1028876602b7aba1f93101f01e12082ef \ No newline at end of file diff --git a/flake.lock b/flake.lock index 30e218e6c7..b698052e9b 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1790211900, - "narHash": "sha256-o/e7qqnyMNMEht+0yZiGQQ6EhE9opeiSSvvxa8CYUy4=", + "lastModified": 1791320560, + "narHash": "sha256-IbzWjnP7ETXz0V0QG5pc8TVLp1d3A0oZHd+u6bfz1Do=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "315bf143ebaaaefdb3917131d6cb08e8d35a8178", + "rev": "f6abe8aa50daaa4bf66a81ea903aab06a31686ea", "type": "github" }, "original": { @@ -384,11 +384,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1785398528, - "narHash": "sha256-dl5vmLjnVynFaniJ60YNZfDT7m/psLU1P/bj+gwlZt8=", + "lastModified": 1788358854, + "narHash": "sha256-NIF+y/9ctwQILbHsCZCOFN7dxuwWXKnFn5T0+ya49+Y=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "cee34cd6eac747364751d1971080bc72c461506d", + "rev": "04149d44d879f7115282c442f8904b5eb5a78c4e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d13d3c2554..f6bad90c03 100644 --- a/flake.nix +++ b/flake.nix @@ -210,13 +210,18 @@ ... }: let cliExe = "${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable}"; - needsQemu = pkgs.stdenv.hostPlatform.isLinux + needsQemu = + pkgs.stdenv.hostPlatform.isLinux && pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform && pkgs.stdenv.hostPlatform.parsed.cpu.name != pkgs.stdenv.buildPlatform.parsed.cpu.name; qemuWrapped = pkgs.buildPackages.writeShellScript "cardano-cli-qemu" '' exec ${pkgs.buildPackages.qemu}/bin/qemu-${pkgs.stdenv.hostPlatform.qemuArch} ${cliExe} "$@" ''; - exportCliPath = "export CARDANO_CLI=${if needsQemu then qemuWrapped else cliExe}"; + exportCliPath = "export CARDANO_CLI=${ + if needsQemu + then qemuWrapped + else cliExe + }"; mainnetConfigFiles = [ "configuration/cardano/mainnet-config.yaml" "configuration/cardano/mainnet-config.json" @@ -262,9 +267,36 @@ ); }) { + # haskell.nix's windows.nix points crypton-x509-system >=1.7 at a + # patch path that does not exist (missing ".patch" suffix); the + # postPatch below already applies the same Crypt32 -> crypt32 + # rename, so drop the broken patch list. + packages.crypton-x509-system.patches = lib.mkForce []; packages.crypton-x509-system.postPatch = '' substituteInPlace crypton-x509-system.cabal --replace 'Crypt32' 'crypt32' ''; + # hourglass (via dns) and its fork time-hourglass (via crypton) + # both define the C symbol hourglass_clock_calendar; the GHC RTS + # linker refuses the duplicate when it loads both for Template + # Haskell in cross-compiled builds. Rename the fork's copy. + packages.time-hourglass.postPatch = '' + substituteInPlace cbits/unix.c src/unix/Time/Internal.hs \ + --replace-fail hourglass_clock_calendar time_hourglass_clock_calendar + ''; + # cardano-addresses vendors cardano-crypto's C bits, so the two + # packages define 15 identical symbols (the ed25519 set, the + # wallet_encrypted_* wrappers, and two unprefixed helpers), which + # the GHC RTS linker likewise refuses. Namespace the vendored + # copy and make the file-local helpers static. + packages.cardano-addresses.postPatch = '' + substituteInPlace cbits/ed25519/ed25519.c cbits/ed25519/ed25519.h cbits/encrypted_sign.c \ + --replace-fail cardano_crypto_ cardano_addresses_ + substituteInPlace cbits/encrypted_sign.c lib/Cardano/Address/Crypto/Wallet/Encrypted.hs \ + --replace-fail wallet_encrypted_ addresses_wallet_encrypted_ + substituteInPlace cbits/encrypted_sign.c \ + --replace-fail 'void clear(void *buf' 'static void clear(void *buf' \ + --replace-fail 'void scalar_add_no_overflow(' 'static void scalar_add_no_overflow(' + ''; } # On Darwin link statically against selected 3rd party crypto libs (as in haskell-nix-example cardano-tools) ({