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

Introduce command-line tool to dump blocks as JSON #4335

Closed

Conversation

abailly-iohk
Copy link
Contributor

@abailly-iohk abailly-iohk commented Feb 2, 2023

Description

This PR introduces a command-line utility to be able to dump some random CBOR encoded block content as a more human-readable JSON data structure. It can also extract an arbitrary block from a node's immutable DB and dump its content.

The motivation for this PR came when we were troubleshooting some incident on the network with @JaredCorduan @disassembler and others and realised we did not have any tool handy to read the raw content of a block.

Early feedback from Consensus experts:

  • Is such a tool useful? ✅
  • Perhaps there's something better somewhere to do that job that I am not aware of? ❌
  • Does it make sense to put it there? ✅
  • Is it missing some obvious feature? ❌

Known limitations:

  • It's missing tests (I still need to understand how to generate blocks to write some property test),
  • It's does not cover eras prior to Alonzo,
  • It only reads from Immutable DB
  • Its name is lame
    • probably ok for now, we can change it later
  • Code format does not respect ouroboros-network's conventions

Checklist

  • Branch
    • Commit sequence broadly makes sense
    • Commits have useful messages
    • The documentation has been properly updated
    • New tests are added if needed and existing tests are updated
    • Any changes affecting Consensus packages must have an entry in the appropriate changelog.d directory created using scriv. If in doubt, see the Consensus release process.
    • If this branch changes Network and has any consequences for downstream repositories or end users, said changes must be documented in interface-CHANGELOG.md
    • If serialization changes, user-facing consequences (e.g. replay from genesis) are confirmed to be intentional.
  • Pull Request
    • Self-reviewed the diff
    • Useful pull request description at least containing the following information:
      • What does this PR change?
      • Why these changes were needed?
      • How does this affect downstream repositories and/or end-users?
      • Which ticket does this PR close (if any)? If it does, is it linked?
    • Reviewer requested

## Usage

```
Usage: block-tool [--file-in FILE | --db-directory DIR --config FILE
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to refer to the output of block-tool -h to avoid repeating the text 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.

Sort of, yes. My goal here was more to convey a sense of what this tool looks like.

@abailly-iohk
Copy link
Contributor Author

Thanks for your review @dnadales and the approval! However this is just a draft in order to get early feedback from experts, I don't plan to merge this PR as-is if only because it has no tests :) I will take your approval as a sign this effort is worthwhile to pursue.

@abailly-iohk abailly-iohk marked this pull request as ready for review February 9, 2023 13:45
@abailly-iohk abailly-iohk self-assigned this Feb 9, 2023
@abailly-iohk
Copy link
Contributor Author

Should I do something for this to be merged?

@dnadales
Copy link
Member

Should I do something for this to be merged?

I'd say let's merge this, announce it to other teams, and document it in ouroboros-consensus

@abailly-iohk
Copy link
Contributor Author

bors+

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.

2 participants