From 800ef204477e4b97d2bdcfdda55ba4444c22d4ac Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Tue, 15 Dec 2020 09:56:24 +0000 Subject: [PATCH] Remove byron delegation cli commands --- README.rst | 20 ------- cardano-cli/src/Cardano/CLI/Byron/Commands.hs | 20 ------- cardano-cli/src/Cardano/CLI/Byron/Parsers.hs | 54 ------------------- cardano-cli/src/Cardano/CLI/Byron/Run.hs | 35 ------------ 4 files changed, 129 deletions(-) diff --git a/README.rst b/README.rst index 49694f5af53..ebc540317f9 100644 --- a/README.rst +++ b/README.rst @@ -246,26 +246,6 @@ and ``signing-key-address`` subcommands (the latter requires the network magic): 2cWKMJemoBakxhXgZSsMteLP9TUvz7owHyEYbUDwKRLsw2UGDrG93gPqmpv1D9ohWNddx VerKey address with root e5a3807d99a1807c3f161a1558bcbc45de8392e049682df01809c488, attributes: AddrAttributes { derivation path: {} } -Delegation -========== - -The ``issue-delegation-certificate`` subcommand enables generation of Byron genesis -delegation certificates, given the following inputs: - - - network magic - - starting epoch of delegation - - genesis delegator's signing key - - delegatee's verification key - -To check the generated delegation certificate, you can use the ``check-delegation`` subcommand, -which would verify: - - - certificate signature validity - - correspondence of the expected issuer/delegate with those on the certificate. - -The expected issuer and delegate are supplied through the ``--issuer-key`` and ``--delegate-key`` -options. - Transactions ============ diff --git a/cardano-cli/src/Cardano/CLI/Byron/Commands.hs b/cardano-cli/src/Cardano/CLI/Byron/Commands.hs index 4f2783140ef..110d61f0099 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Commands.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Commands.hs @@ -11,7 +11,6 @@ module Cardano.CLI.Byron.Commands import Cardano.Prelude -import Cardano.Chain.Slotting (EpochNumber (..)) import Cardano.Chain.Update (InstallerHash (..), ProtocolVersion (..), SoftwareVersion (..), SystemTag (..)) @@ -70,25 +69,6 @@ data ByronCommand = NetworkId SigningKeyFile - --- Delegation Related Commands --- - - | IssueDelegationCertificate - NetworkId - ByronKeyFormat - EpochNumber - -- ^ The epoch from which the delegation is valid. - SigningKeyFile - -- ^ The issuer of the certificate, who delegates their right to sign blocks. - VerificationKeyFile - -- ^ The delegate, who gains the right to sign blocks on behalf of the issuer. - NewCertificateFile - -- ^ Filepath of the newly created delegation certificate. - | CheckDelegation - NetworkId - CertificateFile - VerificationKeyFile - VerificationKeyFile - | GetLocalNodeTip NetworkId diff --git a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs index 2f07647a709..327c54b2fff 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs @@ -76,7 +76,6 @@ backwardsCompatibilityCommands = hiddenCmds :: [Parser ClientCommand] hiddenCmds = map convertToByronCommand [ parseGenesisRelatedValues , parseKeyRelatedValues - , parseDelegationRelatedValues , parseTxRelatedValues , parseLocalNodeQueryValues , parseMiscellaneous @@ -96,8 +95,6 @@ parseByronCommands = asum $ Opt.progDesc "Byron genesis block commands") , subParser "governance" (Opt.info (NodeCmd <$> Opt.subparser pNodeCmd) $ Opt.progDesc "Byron governance commands") - , subParser "delegation" (Opt.info (Opt.subparser parseDelegationRelatedValues) - $ Opt.progDesc "Byron delegation commands") , subParser "miscellaneous" (Opt.info (Opt.subparser parseMiscellaneous) $ Opt.progDesc "Byron miscellaneous commands") , NodeCmd <$> pNodeCmdBackwardCompatible @@ -136,47 +133,6 @@ parseCBORObject = asum <> help "The CBOR file is a byron era vote" ] -parseDelegationRelatedValues :: Mod CommandFields ByronCommand -parseDelegationRelatedValues = - mconcat - [ command' - "issue-delegation-certificate" - "Create a delegation certificate allowing the\ - \ delegator to sign blocks on behalf of the issuer" - $ IssueDelegationCertificate - <$> pNetworkId - <*> parseByronKeyFormat - <*> ( EpochNumber - <$> parseIntegral - "since-epoch" - "The epoch from which the delegation is valid." - ) - <*> parseSigningKeyFile - "secret" - "The issuer of the certificate, who delegates\ - \ their right to sign blocks." - <*> parseVerificationKeyFile - "delegate-key" - "The delegate, who gains the right to sign block." - <*> parseNewCertificateFile "certificate" - , command' - "check-delegation" - "Verify that a given certificate constitutes a valid\ - \ delegation relationship between keys." - $ CheckDelegation - <$> pNetworkId - <*> parseCertificateFile - "certificate" - "The certificate embodying delegation to verify." - <*> parseVerificationKeyFile - "issuer-key" - "The genesis key that supposedly delegates." - <*> parseVerificationKeyFile - "delegate-key" - "The operation verification key supposedly delegated to." - ] - - -- | Values required to create genesis. parseGenesisParameters :: Parser GenesisParameters parseGenesisParameters = @@ -372,9 +328,6 @@ parseTxRelatedValues = <$> parseTxFile "tx" ] -parseVerificationKeyFile :: String -> String -> Parser VerificationKeyFile -parseVerificationKeyFile opt desc = VerificationKeyFile <$> parseFilePath opt desc - pNodeCmd :: Mod CommandFields NodeCmd pNodeCmd = mconcat @@ -635,8 +588,6 @@ parseByronKeyFormat = asum , flag' NonLegacyByronKeyFormat $ hidden <> long "real-pbft" ] -parseCertificateFile :: String -> String -> Parser CertificateFile -parseCertificateFile opt desc = CertificateFile <$> parseFilePath opt desc parseFakeAvvmOptions :: Parser FakeAvvmOptions parseFakeAvvmOptions = @@ -685,11 +636,6 @@ pTestnetMagic = <> Opt.help "Specify a testnet magic id." ) -parseNewCertificateFile :: String -> Parser NewCertificateFile -parseNewCertificateFile opt = - NewCertificateFile - <$> parseFilePath opt "Non-existent file to write the certificate to." - parseNewSigningKeyFile :: String -> Parser NewSigningKeyFile parseNewSigningKeyFile opt = NewSigningKeyFile diff --git a/cardano-cli/src/Cardano/CLI/Byron/Run.hs b/cardano-cli/src/Cardano/CLI/Byron/Run.hs index 3659ad89676..8a6e6dda986 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Run.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Run.hs @@ -13,9 +13,7 @@ import qualified Data.Text.Lazy.IO as TL import qualified Formatting as F import qualified Cardano.Chain.Common as Common -import qualified Cardano.Chain.Delegation as Delegation import qualified Cardano.Chain.Genesis as Genesis -import Cardano.Chain.Slotting (EpochNumber) import Cardano.Chain.UTxO (TxIn, TxOut) import qualified Cardano.Crypto.Hashing as Crypto @@ -77,9 +75,6 @@ runByronClientCommand c = PrintSigningKeyAddress bKeyFormat networkid skF -> runPrintSigningKeyAddress bKeyFormat networkid skF Keygen bKeyFormat nskf passReq -> runKeygen bKeyFormat nskf passReq ToVerification bKeyFormat skFp nvkFp -> runToVerification bKeyFormat skFp nvkFp - IssueDelegationCertificate nw bKeyFormat epoch issuerSK delVK cert -> - runIssueDelegationCertificate nw bKeyFormat epoch issuerSK delVK cert - CheckDelegation nw cert issuerVF delegateVF -> runCheckDelegation nw cert issuerVF delegateVF SubmitTx network fp -> runSubmitTx network fp GetTxId fp -> runGetTxId fp SpendGenesisUTxO genFp nw era nftx ctKey genRichAddr outs -> @@ -170,36 +165,6 @@ runToVerification bKeyFormat skFp (NewVerificationKeyFile vkFp) = do let vKey = Builder.toLazyText . Crypto.formatFullVerificationKey $ Crypto.toVerification sk firstExceptT ByronCmdHelpersError $ ensureNewFile TL.writeFile vkFp vKey -runIssueDelegationCertificate - :: NetworkId - -> ByronKeyFormat - -> EpochNumber - -> SigningKeyFile - -> VerificationKeyFile - -> NewCertificateFile - -> ExceptT ByronClientCmdError IO () -runIssueDelegationCertificate nw bKeyFormat epoch issuerSK delegateVK cert = do - vk <- firstExceptT ByronCmdKeyFailure $ readPaymentVerificationKey delegateVK - sk <- firstExceptT ByronCmdKeyFailure $ readEraSigningKey bKeyFormat issuerSK - let byGenDelCert :: Delegation.Certificate - byGenDelCert = issueByronGenesisDelegation (toByronProtocolMagicId nw) epoch sk vk - sCert = serialiseDelegationCert byGenDelCert - firstExceptT ByronCmdHelpersError $ ensureNewFileLBS (nFp cert) sCert - - -runCheckDelegation - :: NetworkId - -> CertificateFile - -> VerificationKeyFile - -> VerificationKeyFile - -> ExceptT ByronClientCmdError IO () -runCheckDelegation nw cert issuerVF delegateVF = do - issuerVK <- firstExceptT ByronCmdKeyFailure $ readPaymentVerificationKey issuerVF - delegateVK <- firstExceptT ByronCmdKeyFailure $ readPaymentVerificationKey delegateVF - firstExceptT ByronCmdDelegationError $ - checkByronGenesisDelegation cert (toByronProtocolMagicId nw) - issuerVK delegateVK - runSubmitTx :: NetworkId -> TxFile -> ExceptT ByronClientCmdError IO () runSubmitTx network fp = do tx <- firstExceptT ByronCmdTxError $ readByronTx fp