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

New debug log-epoch-state command #775

Merged
merged 5 commits into from
Jun 1, 2024

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented May 25, 2024

Changelog

- description: |
    New `debug log-epoch-state` command
# uncomment types applicable to the change:
  type:
  - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

This command will log the epoch state to the given file. The contents of the log file is jsonl.

The command will not terminate.

Callers of the command can kill the process to terminate it.

Example run

$ cardano-cli debug log-epoch-state --socket-path /tmp/testnet-test-ed04aa0bdae2044f/socket/pool1/sock --node-configuration-file /tmp/testnet-test-ed04aa0bdae2044f/configuration.yaml --out-file /dev/stdout | cut -c 1-300 | head -n 20
{"currentEpoch":0,"currentEpochBlocks":{"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":1},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"genDelegs":{"3abe4942f90b5fb5e2ec7c7d2e86593ca6c38a0ff948b0ed5c
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":1,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":1},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":2,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":1},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":3,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":1},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":4,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":1},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":4,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":2},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":4,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":3},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":5,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":3},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":5,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":4},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0},"esLState":{"delegationState":{"dstate":{"fGenDelegs":[],"ge
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":5,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":1,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":4},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":6,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":1,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":4},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":6,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":2,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":4},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":6,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":3,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":4},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":6,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":3,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":5},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":7,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":3,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":5},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":7,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":4,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":5},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":7,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":5,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":5},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":8,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":5,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":5},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":9,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":5,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":5},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
{"currentEpoch":0,"currentEpochBlocks":{"3d03bbf47ad37a9183ee57b5b01c92049bcd9f4468db40eb5e06854f":9,"6b92f2da974188ed1e05b2d14d0299ef1ee6a6fefc9b3e70960e8088":5,"fbfe6b9c0005569a3b751ac017a63265767a4a8c5426104d8f26497d":6},"currentEpochState":{"esAccountState":{"reserves":191999999999,"treasury":0}
Error: FoldBlocksIOException /dev/stdout: withFile: resource vanished (Broken pipe)

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@newhoggy newhoggy force-pushed the newhoggy/new-debug-log-epoch-state-command branch from 2a9e2de to c432eef Compare May 26, 2024 06:11
Copy link
Contributor

@carbolymer carbolymer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@newhoggy newhoggy force-pushed the newhoggy/new-debug-log-epoch-state-command branch 2 times, most recently from be3c8c9 to 191e914 Compare May 28, 2024 12:12
@newhoggy newhoggy enabled auto-merge May 28, 2024 12:17
@newhoggy newhoggy force-pushed the newhoggy/new-debug-log-epoch-state-command branch 2 times, most recently from 19e203e to 3a884d6 Compare May 28, 2024 13:07
@newhoggy newhoggy added this pull request to the merge queue May 28, 2024
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! A few comments.

import Options.Applicative.Types (ParserInfo (..), ParserPrefs (..))

-- | Sub-commands of 'cardano-cli'.
data ClientCommand =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

| UnixSockEndPoint String
deriving (Eq, Show)

data PingCmd = PingCmd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Not necessarily for this PR but haddocks would be good here.


import Cardano.CLI.Orphans ()

data Configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A haddock here saying this is a file type level tag would be useful.


data Configuration

data LogEpochStateCmdArgs = LogEpochStateCmdArgs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A brief haddock here describing the command would be useful.

pDebugCmds envCli =
asum
[ subParser "log-epoch-state"
(Opt.info pLogEpochStateCmdArgs $ Opt.progDesc "Log epoch state.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a better description of what this command does and what it outputs.

pure ConditionNotMet
)

case result of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also be catching exceptions here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What sort of exceptions?

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 28, 2024
@newhoggy newhoggy force-pushed the newhoggy/new-debug-log-epoch-state-command branch from 3a884d6 to 928aac5 Compare May 29, 2024 13:28
@newhoggy newhoggy enabled auto-merge May 29, 2024 14:48
@newhoggy newhoggy disabled auto-merge May 29, 2024 15:33
@newhoggy newhoggy force-pushed the newhoggy/new-debug-log-epoch-state-command branch from 928aac5 to 5127c88 Compare May 29, 2024 15:34
@newhoggy newhoggy enabled auto-merge May 29, 2024 15:34
@newhoggy newhoggy added this pull request to the merge queue May 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 29, 2024
@newhoggy newhoggy added this pull request to the merge queue May 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 30, 2024
@newhoggy newhoggy force-pushed the newhoggy/new-debug-log-epoch-state-command branch from 5127c88 to c744dbb Compare May 30, 2024 10:37
@newhoggy newhoggy force-pushed the newhoggy/new-debug-log-epoch-state-command branch from c744dbb to 116a342 Compare May 30, 2024 22:36
@newhoggy newhoggy added this pull request to the merge queue May 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 31, 2024
@newhoggy newhoggy added this pull request to the merge queue Jun 1, 2024
@newhoggy newhoggy removed this pull request from the merge queue due to a manual request Jun 1, 2024
@newhoggy newhoggy requested review from a team as code owners June 1, 2024 00:51
@newhoggy newhoggy enabled auto-merge June 1, 2024 00:51
@newhoggy newhoggy added this pull request to the merge queue Jun 1, 2024
Merged via the queue into main with commit fed71b3 Jun 1, 2024
21 checks passed
@newhoggy newhoggy deleted the newhoggy/new-debug-log-epoch-state-command branch June 1, 2024 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants