Skip to content

Commit

Permalink
Merge pull request #404 from input-output-hk/newhoggy/remove-shelley-…
Browse files Browse the repository at this point in the history
…mode-and-byron-mode

Remove `ShelleyMode` and `ByronMode`
  • Loading branch information
newhoggy authored Oct 28, 2023
2 parents d4eaabd + 445d892 commit 096bb69
Show file tree
Hide file tree
Showing 208 changed files with 1,056 additions and 3,289 deletions.
1 change: 0 additions & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ library
Cardano.CLI.Byron.Key
Cardano.CLI.Byron.Legacy
Cardano.CLI.Byron.Parsers
Cardano.CLI.Byron.Query
Cardano.CLI.Byron.Run
Cardano.CLI.Byron.Tx
Cardano.CLI.Byron.UpdateProposal
Expand Down
4 changes: 0 additions & 4 deletions cardano-cli/src/Cardano/CLI/Byron/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ data ByronCommand =
NetworkId
(SigningKeyFile In)

| GetLocalNodeTip
SocketPath
NetworkId

-----------------------------------

| SubmitTx
Expand Down
13 changes: 0 additions & 13 deletions cardano-cli/src/Cardano/CLI/Byron/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ backwardsCompatibilityCommands envCli =
[ parseGenesisRelatedValues
, parseKeyRelatedValues envCli
, parseTxRelatedValues envCli
, return (parseLocalNodeQueryValues envCli)
, parseMiscellaneous
]

Expand All @@ -95,8 +94,6 @@ parseByronCommands envCli = asum
$ Opt.progDesc "Byron key utility commands")
, subParser' "transaction" (Opt.info (asum $ map Opt.subparser (parseTxRelatedValues envCli))
$ Opt.progDesc "Byron transaction commands")
, subParser' "query" (Opt.info (Opt.subparser (parseLocalNodeQueryValues envCli))
$ Opt.progDesc "Byron node query commands.")
, subParser' "genesis" (Opt.info (asum $ map Opt.subparser parseGenesisRelatedValues)
$ Opt.progDesc "Byron genesis block commands")
, subParser' "governance" (Opt.info (NodeCmds <$> Opt.subparser (pNodeCmds envCli))
Expand Down Expand Up @@ -218,14 +215,6 @@ parseKeyRelatedValues envCli =
<*> parseNewSigningKeyFile "to"
]

parseLocalNodeQueryValues :: EnvCli -> Mod CommandFields ByronCommand
parseLocalNodeQueryValues envCli =
command' "get-tip" "Get the tip of your local node's blockchain"
$ GetLocalNodeTip
<$> pSocketPath envCli
<*> pNetworkId envCli


parseMiscellaneous :: [Mod CommandFields ByronCommand]
parseMiscellaneous =
[ command'
Expand All @@ -241,8 +230,6 @@ parseMiscellaneous =
<$> parseFilePath "filepath" "Filepath of CBOR file."
]



parseTestnetBalanceOptions :: Parser TestnetBalanceOptions
parseTestnetBalanceOptions =
TestnetBalanceOptions
Expand Down
39 changes: 0 additions & 39 deletions cardano-cli/src/Cardano/CLI/Byron/Query.hs

This file was deleted.

2 changes: 0 additions & 2 deletions cardano-cli/src/Cardano/CLI/Byron/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Cardano.CLI.Byron.Commands
import Cardano.CLI.Byron.Delegation
import Cardano.CLI.Byron.Genesis
import Cardano.CLI.Byron.Key
import Cardano.CLI.Byron.Query
import Cardano.CLI.Byron.Tx
import Cardano.CLI.Byron.UpdateProposal
import Cardano.CLI.Byron.Vote
Expand Down Expand Up @@ -63,7 +62,6 @@ runByronClientCommand c =
case c of
NodeCmds bc -> runNodeCmds bc
Genesis outDir params -> runGenesisCommand outDir params
GetLocalNodeTip mNodeSocketPath network -> liftIO $ runGetLocalNodeTip mNodeSocketPath network
ValidateCBOR cborObject fp -> runValidateCBOR cborObject fp
PrettyPrintCBOR fp -> runPrettyPrintCBOR fp
PrettySigningKeyPublic bKeyFormat skF -> runPrettySigningKeyPublic bKeyFormat skF
Expand Down
38 changes: 19 additions & 19 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ data QueryCmds era

data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, genesisFp :: !GenesisFile
, poolColdVerKeyFile :: !(VerificationKeyOrHashOrFile StakePoolKey)
Expand All @@ -72,95 +72,95 @@ data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs

data QueryProtocolParametersCmdArgs = QueryProtocolParametersCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryConstitutionHashCmdArgs = QueryConstitutionHashCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryTipCmdArgs = QueryTipCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryStakePoolsCmdArgs = QueryStakePoolsCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryStakeDistributionCmdArgs = QueryStakeDistributionCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryStakeAddressInfoCmdArgs = QueryStakeAddressInfoCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, addr :: !StakeAddress
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryUTxOCmdArgs = QueryUTxOCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, queryFilter :: !QueryUTxOFilter
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryLedgerStateCmdArgs = QueryLedgerStateCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryProtocolStateCmdArgs = QueryProtocolStateCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryStakeSnapshotCmdArgs = QueryStakeSnapshotCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, allOrOnlyPoolIds :: !(AllOrOnly [Hash StakePoolKey])
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryKesPeriodInfoCmdArgs = QueryKesPeriodInfoCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, nodeOpCertFp :: !(File () In) -- ^ Node operational certificate
, mOutFile :: !(Maybe (File () Out))
} deriving (Generic, Show)

data QueryPoolStateCmdArgs = QueryPoolStateCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, poolIds :: ![Hash StakePoolKey]
} deriving (Generic, Show)

data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, query :: !TxMempoolQuery
, mOutFile :: !(Maybe (File () Out))
Expand All @@ -169,23 +169,23 @@ data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs

data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, utcTime :: !UTCTime
} deriving (Generic, Show)

data QueryNoArgCmdArgs era = QueryNoArgCmdArgs
{ eon :: !(ConwayEraOnwards era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mOutFile :: !(Maybe (File () Out))
} deriving Show

data QueryDRepStateCmdArgs era = QueryDRepStateCmdArgs
{ eon :: !(ConwayEraOnwards era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, drepKeys :: ![VerificationKeyOrHashOrFile DRepKey]
, mOutFile :: !(Maybe (File () Out))
Expand All @@ -194,7 +194,7 @@ data QueryDRepStateCmdArgs era = QueryDRepStateCmdArgs
data QueryDRepStakeDistributionCmdArgs era = QueryDRepStakeDistributionCmdArgs
{ eon :: !(ConwayEraOnwards era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, drepKeys :: ![VerificationKeyOrHashOrFile DRepKey]
, mOutFile :: !(Maybe (File () Out))
Expand All @@ -203,7 +203,7 @@ data QueryDRepStakeDistributionCmdArgs era = QueryDRepStakeDistributionCmdArgs
data QueryCommitteeMembersStateCmdArgs era = QueryCommitteeMembersStateCmdArgs
{ eon :: !(ConwayEraOnwards era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, committeeColdKeys :: ![VerificationKeyOrHashOrFile CommitteeColdKey]
, committeeHotKeys :: ![VerificationKeyOrHashOrFile CommitteeHotKey]
Expand Down
10 changes: 5 additions & 5 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ data TransactionBuildRawCmdArgs era = TransactionBuildRawCmdArgs
data TransactionBuildCmdArgs era = TransactionBuildCmdArgs
{ eon :: !(ShelleyBasedEra era)
, nodeSocketPath :: !SocketPath
, consensusModeParams :: !AnyConsensusModeParams
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, mScriptValidity :: !(Maybe ScriptValidity)
-- ^ Mark script as expected to pass or fail validation
Expand Down Expand Up @@ -147,10 +147,10 @@ data TransactionSignWitnessCmdArgs = TransactionSignWitnessCmdArgs
} deriving Show

data TransactionSubmitCmdArgs = TransactionSubmitCmdArgs
{ nodeSocketPath :: !SocketPath
, anyConsensusModeParams :: !AnyConsensusModeParams
, networkId :: !NetworkId
, txFile :: !FilePath
{ nodeSocketPath :: !SocketPath
, consensusModeParams :: !(ConsensusModeParams CardanoMode)
, networkId :: !NetworkId
, txFile :: !FilePath
} deriving Show

newtype TransactionPolicyIdCmdArgs = TransactionPolicyIdCmdArgs
Expand Down
34 changes: 6 additions & 28 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,47 +109,25 @@ toUnitIntervalOrErr r = case Ledger.boundRational r of
]
Just n -> n

pConsensusModeParams :: Parser AnyConsensusModeParams
pConsensusModeParams :: Parser (ConsensusModeParams CardanoMode)
pConsensusModeParams = asum
[ pShelleyMode *> pShelleyConsensusMode
, pByronMode *> pByronConsensusMode
, pCardanoMode *> pCardanoConsensusMode
[ pCardanoMode *> pCardanoConsensusMode
, pDefaultConsensusMode
]
where
pShelleyMode :: Parser ()
pShelleyMode =
Opt.flag' () $ mconcat
[ Opt.long "shelley-mode"
, Opt.help "For talking to a node running in Shelley-only mode."
]

pByronMode :: Parser ()
pByronMode =
Opt.flag' () $ mconcat
[ Opt.long "byron-mode"
, Opt.help "For talking to a node running in Byron-only mode."
]

pCardanoMode :: Parser ()
pCardanoMode =
Opt.flag' () $ mconcat
[ Opt.long "cardano-mode"
, Opt.help "For talking to a node running in full Cardano mode (default)."
]

pCardanoConsensusMode :: Parser AnyConsensusModeParams
pCardanoConsensusMode = AnyConsensusModeParams . CardanoModeParams <$> pEpochSlots

pByronConsensusMode :: Parser AnyConsensusModeParams
pByronConsensusMode = AnyConsensusModeParams . ByronModeParams <$> pEpochSlots

pShelleyConsensusMode :: Parser AnyConsensusModeParams
pShelleyConsensusMode = pure (AnyConsensusModeParams ShelleyModeParams)
pCardanoConsensusMode :: Parser (ConsensusModeParams CardanoMode)
pCardanoConsensusMode = CardanoModeParams <$> pEpochSlots

pDefaultConsensusMode :: Parser AnyConsensusModeParams
pDefaultConsensusMode :: Parser (ConsensusModeParams CardanoMode)
pDefaultConsensusMode =
pure . AnyConsensusModeParams . CardanoModeParams $ EpochSlots defaultByronEpochSlots
pure . CardanoModeParams $ EpochSlots defaultByronEpochSlots

defaultByronEpochSlots :: Word64
defaultByronEpochSlots = 21600
Expand Down
Loading

0 comments on commit 096bb69

Please sign in to comment.