Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove byron delegation cli commands #2219

Merged
merged 1 commit into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============

Expand Down
20 changes: 0 additions & 20 deletions cardano-cli/src/Cardano/CLI/Byron/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 (..))

Expand Down Expand Up @@ -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

Expand Down
54 changes: 0 additions & 54 deletions cardano-cli/src/Cardano/CLI/Byron/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ backwardsCompatibilityCommands =
hiddenCmds :: [Parser ClientCommand]
hiddenCmds = map convertToByronCommand [ parseGenesisRelatedValues
, parseKeyRelatedValues
, parseDelegationRelatedValues
, parseTxRelatedValues
, parseLocalNodeQueryValues
, parseMiscellaneous
Expand All @@ -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
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down
35 changes: 0 additions & 35 deletions cardano-cli/src/Cardano/CLI/Byron/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand Down Expand Up @@ -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
Expand Down