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

[FR] - Show slotInEpoch in cardano-cli query tip #3878

Closed
Tracked by #4144 ...
CarlosLopezDeLara opened this issue May 19, 2022 · 1 comment · Fixed by #4912
Closed
Tracked by #4144 ...

[FR] - Show slotInEpoch in cardano-cli query tip #3878

CarlosLopezDeLara opened this issue May 19, 2022 · 1 comment · Fixed by #4912
Assignees
Labels
cli revision is used to group all the Node CLI tickets enhancement New feature or request

Comments

@CarlosLopezDeLara
Copy link
Contributor

CarlosLopezDeLara commented May 19, 2022

Internal

Area
Other CLI

Describe the feature you'd like
Show slotInEpoch in cardano-cli query tip output so that one can easily know beforehand (and automate) if is still within the window for submitting transactions like Update proposals and MIR.

Additional context / screenshots

https://input-output-rnd.slack.com/archives/G011N23CEAE/p1652967091248049


Acceptance Criteria

Slot in epoch is the slot number within a given epoch, as opposed to the absolute slot number.

When the user queries the tip of the chain:

  • query tip returns "slotInEpoch":

{
"era": "Alonzo",
"syncProgress":
"hash":
"epoch":
"slot":
"block":
"slotInEpoch":
}

  • slotinEpoch restarts properly at every epoch transition
  • slotinEpoch can never be greater than EpochLength
@CarlosLopezDeLara CarlosLopezDeLara added enhancement New feature or request cli revision is used to group all the Node CLI tickets labels May 19, 2022
@CarlosLopezDeLara CarlosLopezDeLara self-assigned this May 19, 2022
@LudvikGalois LudvikGalois self-assigned this Aug 10, 2022
@CarlosLopezDeLara CarlosLopezDeLara moved this to 📋 Backlog in Node CLI/API 2022 Aug 11, 2022
@CarlosLopezDeLara CarlosLopezDeLara moved this from 📋 Backlog to 🔖 Ready for the next sprint in Node CLI/API 2022 Aug 11, 2022
@Jimbo4350
Copy link
Contributor

So this involves changing the JSON output of the query tip to include the current slot in the current epoch. This is different to what is already reported, the absolute slot value. This will be a little tricky as the epoch size changes as we move from Byron -> Shelley:

defaultByronEpochSlots :: Word64
defaultByronEpochSlots = 21600

and in the mainnet shelley genesis file

  ...
  "networkMagic": 764824073,
  "epochLength": 432000,
  "systemStart": "2017-09-23T21:44:51Z",
  ...

We should be able to take the result of slotToEpoch and subtract one from the other SlotsInEpoch - SlotsToEpochEnd to get the current slot in epoch.

@CarlosLopezDeLara CarlosLopezDeLara removed their assignment Aug 11, 2022
@newhoggy newhoggy assigned newhoggy and unassigned LudvikGalois Feb 23, 2023
iohk-bors bot added a commit that referenced this issue Mar 1, 2023
4912: Add slotsInEpoch and slotsToEpochEnd to query tip command r=newhoggy a=newhoggy

Example output:

```
CARDANO_NODE_SOCKET_PATH=example/node-pool1/node.sock cardano-cli query tip --testnet-magic 42
{
    "block": 768,
    "epoch": 33,
    "era": "Alonzo",
    "hash": "4ca7fd3a9827e74f98e779a8ae333dc6fa3b69832cb11fdbab7af215eb68b1ee",
    "slot": 16814,
    "slotsInEpoch": 314,
    "slotsToEpochEnd": 186,
    "syncProgress": "100.00"
}
```

Resolves #3878


4915: Tip hash metrics r=newhoggy a=newhoggy

Salvaging this PR #2006

Related to #801


4922: Deploy Haddock for merge to master only r=newhoggy a=newhoggy

To merge changes from this PR #3012

Co-authored-by: John Ky <[email protected]>
Co-authored-by: Luke Nadur <[email protected]>
Co-authored-by: James Browning <[email protected]>
iohk-bors bot added a commit that referenced this issue Mar 1, 2023
4912: Add slotsInEpoch and slotsToEpochEnd to query tip command r=newhoggy a=newhoggy

Example output:

```
CARDANO_NODE_SOCKET_PATH=example/node-pool1/node.sock cardano-cli query tip --testnet-magic 42
{
    "block": 768,
    "epoch": 33,
    "era": "Alonzo",
    "hash": "4ca7fd3a9827e74f98e779a8ae333dc6fa3b69832cb11fdbab7af215eb68b1ee",
    "slot": 16814,
    "slotsInEpoch": 314,
    "slotsToEpochEnd": 186,
    "syncProgress": "100.00"
}
```

Resolves #3878


Co-authored-by: John Ky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli revision is used to group all the Node CLI tickets enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@newhoggy @LudvikGalois @Jimbo4350 @CarlosLopezDeLara and others