Skip to content

Commit 8a480f8

Browse files
committed
Add support for eras before conway
1 parent 0cc002a commit 8a480f8

File tree

13 files changed

+508
-25
lines changed

13 files changed

+508
-25
lines changed

cardano-cli/src/Cardano/CLI/EraBased/Query/Command.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ data QueryStakePoolDefaultVoteCmdArgs era = QueryStakePoolDefaultVoteCmdArgs
267267
deriving Show
268268

269269
data QueryEraHistoryCmdArgs era = QueryEraHistoryCmdArgs
270-
{ eon :: !(ConwayEraOnwards era)
270+
{ sbe :: !(ShelleyBasedEra era)
271271
, commons :: !QueryCommons
272272
, outFile :: !(File () Out)
273273
}

cardano-cli/src/Cardano/CLI/EraBased/Query/Option.hs

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -820,30 +820,25 @@ pQueryCommons w envCli =
820820
)
821821
<*> pTarget w
822822

823-
pQueryEraHistoryCmd :: ShelleyBasedEra era -> EnvCli -> Maybe (Parser (QueryCmds era))
823+
pQueryEraHistoryCmd :: forall era. ShelleyBasedEra era -> EnvCli -> Maybe (Parser (QueryCmds era))
824824
pQueryEraHistoryCmd w envCli =
825-
caseShelleyToBabbageOrConwayEraOnwards
826-
(const Nothing)
827-
( \ceo ->
828-
Just
829-
$ Opt.hsubparser
830-
$ commandWithMetavar "era-history"
831-
$ Opt.info
832-
( QueryEraHistoryCmd
833-
<$> pQueryEraHistoryCmdArgs ceo
834-
)
835-
$ Opt.progDesc
836-
( "Obtains the era history data. The era history contains information about when era transitions happened and can "
837-
<> "be used together with the start time to convert slot numbers to POSIX times offline (without connecting to the node). "
838-
<> "Converting slot numbers to POSIX times is useful, for example, when calculating the cost of executing a Plutus "
839-
<> "script. And being able to do it offline means that it can be calculated without access to a live node."
840-
)
841-
)
842-
w
825+
Just
826+
$ Opt.hsubparser
827+
$ commandWithMetavar "era-history"
828+
$ Opt.info
829+
( QueryEraHistoryCmd
830+
<$> pQueryEraHistoryCmdArgs
831+
)
832+
$ Opt.progDesc
833+
( "Obtains the era history data. The era history contains information about when era transitions happened and can "
834+
<> "be used together with the start time to convert slot numbers to POSIX times offline (without connecting to the node). "
835+
<> "Converting slot numbers to POSIX times is useful, for example, when calculating the cost of executing a Plutus "
836+
<> "script. And being able to do it offline means that it can be calculated without access to a live node."
837+
)
843838
where
844839
pQueryEraHistoryCmdArgs
845-
:: ConwayEraOnwards era -> Parser (QueryEraHistoryCmdArgs era)
846-
pQueryEraHistoryCmdArgs ceo =
847-
QueryEraHistoryCmdArgs ceo
840+
:: Parser (QueryEraHistoryCmdArgs era)
841+
pQueryEraHistoryCmdArgs =
842+
QueryEraHistoryCmdArgs w
848843
<$> pQueryCommons w envCli
849844
<*> pOutputFile

cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,15 +1874,15 @@ runQueryProposals
18741874
runQueryEraHistoryCmd :: Cmd.QueryEraHistoryCmdArgs era -> ExceptT QueryCmdError IO ()
18751875
runQueryEraHistoryCmd
18761876
Cmd.QueryEraHistoryCmdArgs
1877-
{ Cmd.eon
1877+
{ Cmd.sbe
18781878
, Cmd.commons =
18791879
Cmd.QueryCommons
18801880
{ Cmd.nodeConnInfo
18811881
, Cmd.target
18821882
}
18831883
, Cmd.outFile
18841884
} =
1885-
conwayEraOnwardsConstraints eon $ do
1885+
shelleyBasedEraConstraints sbe $ do
18861886
eraHistory <-
18871887
lift
18881888
( executeLocalStateQueryExpr nodeConnInfo target $
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Usage: cardano-cli allegra query
2+
( protocol-parameters
3+
| tip
4+
| stake-pools
5+
| stake-distribution
6+
| stake-address-info
7+
| utxo
8+
| ledger-state
9+
| ledger-peer-snapshot
10+
| protocol-state
11+
| stake-snapshot
12+
| leadership-schedule
13+
| kes-period-info
14+
| pool-state
15+
| tx-mempool
16+
| slot-number
17+
| ref-script-size
18+
| era-history
19+
)
20+
21+
Node query commands. Will query the local node whose Unix domain socket is
22+
obtained from the CARDANO_NODE_SOCKET_PATH environment variable.
23+
24+
Available options:
25+
-h,--help Show this help text
26+
27+
Available commands:
28+
protocol-parameters Get the node's current protocol parameters
29+
tip Get the node's current tip (slot no, hash, block no)
30+
stake-pools Get the node's current set of stake pool ids
31+
stake-distribution Get the node's current aggregated stake distribution
32+
stake-address-info Get the current delegations and reward accounts
33+
filtered by stake address.
34+
utxo Get a portion of the current UTxO: by tx in, by
35+
address or the whole.
36+
ledger-state Dump the current ledger state of the node
37+
(Ledger.NewEpochState -- advanced command)
38+
ledger-peer-snapshot Dump the current snapshot of ledger peers.These are
39+
the largest pools that cumulatively hold 90% of total
40+
stake.
41+
protocol-state Dump the current protocol state of the node
42+
(Ledger.ChainDepState -- advanced command)
43+
stake-snapshot Obtain the three stake snapshots for a pool, plus the
44+
total active stake (advanced command)
45+
pool-params DEPRECATED. Use query pool-state instead. Dump the
46+
pool parameters
47+
(Ledger.NewEpochState.esLState._delegationState._pState._pParams
48+
-- advanced command)
49+
leadership-schedule Get the slots the node is expected to mint a block in
50+
(advanced command)
51+
kes-period-info Get information about the current KES period and your
52+
node's operational certificate.
53+
pool-state Dump the pool state
54+
tx-mempool Local Mempool info
55+
slot-number Query slot number for UTC timestamp
56+
ref-script-size Calculate the reference input scripts size in bytes
57+
for provided transaction inputs.
58+
era-history Obtains the era history data. The era history
59+
contains information about when era transitions
60+
happened and can be used together with the start time
61+
to convert slot numbers to POSIX times offline
62+
(without connecting to the node). Converting slot
63+
numbers to POSIX times is useful, for example, when
64+
calculating the cost of executing a Plutus script.
65+
And being able to do it offline means that it can be
66+
calculated without access to a live node.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Usage: cardano-cli allegra query era-history
2+
[--cardano-mode
3+
[--epoch-slots SLOTS]]
4+
( --mainnet
5+
| --testnet-magic NATURAL
6+
)
7+
--socket-path SOCKET_PATH
8+
--out-file FILEPATH
9+
10+
Obtains the era history data. The era history contains information about when
11+
era transitions happened and can be used together with the start time to
12+
convert slot numbers to POSIX times offline (without connecting to the node).
13+
Converting slot numbers to POSIX times is useful, for example, when
14+
calculating the cost of executing a Plutus script. And being able to do it
15+
offline means that it can be calculated without access to a live node.
16+
17+
Available options:
18+
--cardano-mode For talking to a node running in full Cardano mode
19+
(default).
20+
--epoch-slots SLOTS The number of slots per epoch for the Byron era.
21+
(default: 21600)
22+
--mainnet Use the mainnet magic id. This overrides the
23+
CARDANO_NODE_NETWORK_ID environment variable
24+
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
25+
CARDANO_NODE_NETWORK_ID environment variable
26+
--socket-path SOCKET_PATH
27+
Path to the node socket. This overrides the
28+
CARDANO_NODE_SOCKET_PATH environment variable. The
29+
argument is optional if CARDANO_NODE_SOCKET_PATH is
30+
defined and mandatory otherwise.
31+
--out-file FILEPATH The output file.
32+
-h,--help Show this help text
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Usage: cardano-cli alonzo query
2+
( protocol-parameters
3+
| tip
4+
| stake-pools
5+
| stake-distribution
6+
| stake-address-info
7+
| utxo
8+
| ledger-state
9+
| ledger-peer-snapshot
10+
| protocol-state
11+
| stake-snapshot
12+
| leadership-schedule
13+
| kes-period-info
14+
| pool-state
15+
| tx-mempool
16+
| slot-number
17+
| ref-script-size
18+
| era-history
19+
)
20+
21+
Node query commands. Will query the local node whose Unix domain socket is
22+
obtained from the CARDANO_NODE_SOCKET_PATH environment variable.
23+
24+
Available options:
25+
-h,--help Show this help text
26+
27+
Available commands:
28+
protocol-parameters Get the node's current protocol parameters
29+
tip Get the node's current tip (slot no, hash, block no)
30+
stake-pools Get the node's current set of stake pool ids
31+
stake-distribution Get the node's current aggregated stake distribution
32+
stake-address-info Get the current delegations and reward accounts
33+
filtered by stake address.
34+
utxo Get a portion of the current UTxO: by tx in, by
35+
address or the whole.
36+
ledger-state Dump the current ledger state of the node
37+
(Ledger.NewEpochState -- advanced command)
38+
ledger-peer-snapshot Dump the current snapshot of ledger peers.These are
39+
the largest pools that cumulatively hold 90% of total
40+
stake.
41+
protocol-state Dump the current protocol state of the node
42+
(Ledger.ChainDepState -- advanced command)
43+
stake-snapshot Obtain the three stake snapshots for a pool, plus the
44+
total active stake (advanced command)
45+
pool-params DEPRECATED. Use query pool-state instead. Dump the
46+
pool parameters
47+
(Ledger.NewEpochState.esLState._delegationState._pState._pParams
48+
-- advanced command)
49+
leadership-schedule Get the slots the node is expected to mint a block in
50+
(advanced command)
51+
kes-period-info Get information about the current KES period and your
52+
node's operational certificate.
53+
pool-state Dump the pool state
54+
tx-mempool Local Mempool info
55+
slot-number Query slot number for UTC timestamp
56+
ref-script-size Calculate the reference input scripts size in bytes
57+
for provided transaction inputs.
58+
era-history Obtains the era history data. The era history
59+
contains information about when era transitions
60+
happened and can be used together with the start time
61+
to convert slot numbers to POSIX times offline
62+
(without connecting to the node). Converting slot
63+
numbers to POSIX times is useful, for example, when
64+
calculating the cost of executing a Plutus script.
65+
And being able to do it offline means that it can be
66+
calculated without access to a live node.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Usage: cardano-cli alonzo query era-history
2+
[--cardano-mode
3+
[--epoch-slots SLOTS]]
4+
( --mainnet
5+
| --testnet-magic NATURAL
6+
)
7+
--socket-path SOCKET_PATH
8+
--out-file FILEPATH
9+
10+
Obtains the era history data. The era history contains information about when
11+
era transitions happened and can be used together with the start time to
12+
convert slot numbers to POSIX times offline (without connecting to the node).
13+
Converting slot numbers to POSIX times is useful, for example, when
14+
calculating the cost of executing a Plutus script. And being able to do it
15+
offline means that it can be calculated without access to a live node.
16+
17+
Available options:
18+
--cardano-mode For talking to a node running in full Cardano mode
19+
(default).
20+
--epoch-slots SLOTS The number of slots per epoch for the Byron era.
21+
(default: 21600)
22+
--mainnet Use the mainnet magic id. This overrides the
23+
CARDANO_NODE_NETWORK_ID environment variable
24+
--testnet-magic NATURAL Specify a testnet magic id. This overrides the
25+
CARDANO_NODE_NETWORK_ID environment variable
26+
--socket-path SOCKET_PATH
27+
Path to the node socket. This overrides the
28+
CARDANO_NODE_SOCKET_PATH environment variable. The
29+
argument is optional if CARDANO_NODE_SOCKET_PATH is
30+
defined and mandatory otherwise.
31+
--out-file FILEPATH The output file.
32+
-h,--help Show this help text
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Usage: cardano-cli babbage query
2+
( protocol-parameters
3+
| tip
4+
| stake-pools
5+
| stake-distribution
6+
| stake-address-info
7+
| utxo
8+
| ledger-state
9+
| ledger-peer-snapshot
10+
| protocol-state
11+
| stake-snapshot
12+
| leadership-schedule
13+
| kes-period-info
14+
| pool-state
15+
| tx-mempool
16+
| slot-number
17+
| ref-script-size
18+
| era-history
19+
)
20+
21+
Node query commands. Will query the local node whose Unix domain socket is
22+
obtained from the CARDANO_NODE_SOCKET_PATH environment variable.
23+
24+
Available options:
25+
-h,--help Show this help text
26+
27+
Available commands:
28+
protocol-parameters Get the node's current protocol parameters
29+
tip Get the node's current tip (slot no, hash, block no)
30+
stake-pools Get the node's current set of stake pool ids
31+
stake-distribution Get the node's current aggregated stake distribution
32+
stake-address-info Get the current delegations and reward accounts
33+
filtered by stake address.
34+
utxo Get a portion of the current UTxO: by tx in, by
35+
address or the whole.
36+
ledger-state Dump the current ledger state of the node
37+
(Ledger.NewEpochState -- advanced command)
38+
ledger-peer-snapshot Dump the current snapshot of ledger peers.These are
39+
the largest pools that cumulatively hold 90% of total
40+
stake.
41+
protocol-state Dump the current protocol state of the node
42+
(Ledger.ChainDepState -- advanced command)
43+
stake-snapshot Obtain the three stake snapshots for a pool, plus the
44+
total active stake (advanced command)
45+
pool-params DEPRECATED. Use query pool-state instead. Dump the
46+
pool parameters
47+
(Ledger.NewEpochState.esLState._delegationState._pState._pParams
48+
-- advanced command)
49+
leadership-schedule Get the slots the node is expected to mint a block in
50+
(advanced command)
51+
kes-period-info Get information about the current KES period and your
52+
node's operational certificate.
53+
pool-state Dump the pool state
54+
tx-mempool Local Mempool info
55+
slot-number Query slot number for UTC timestamp
56+
ref-script-size Calculate the reference input scripts size in bytes
57+
for provided transaction inputs.
58+
era-history Obtains the era history data. The era history
59+
contains information about when era transitions
60+
happened and can be used together with the start time
61+
to convert slot numbers to POSIX times offline
62+
(without connecting to the node). Converting slot
63+
numbers to POSIX times is useful, for example, when
64+
calculating the cost of executing a Plutus script.
65+
And being able to do it offline means that it can be
66+
calculated without access to a live node.

0 commit comments

Comments
 (0)