-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sequencer-utils): add subcommand to parse Celestia blob data (#1059
) ## Summary This provides a new subcommand in the `astria-sequencer-utils` tool to allow for decoding Celestia base-64 blobs containing Astria data. ## Background It would be helpful to be able to visualize the data contained in the blobs as available in [the Celenium blob viewer](https://mocha.celenium.io/block/1726074?tab=transactions) (found by expanding a blob on that page). ## Changes - The tool was restructured to make the existing command into a subcommand `copy-genesis-state`. The existing functionality was not changed. - A new subcommand `parse-blob` was added, best explained via the help output: ``` Parse blob data from an arg, a file, or stdin Usage: astria-sequencer-utils parse-blob [OPTIONS] <BLOB|PATH> Arguments: <BLOB|PATH> Base64-encoded blob data, or a file containing this, or stdin if `-` Options: -f, --format <FORMAT> Configure formatting of output [default: display] [possible values: display, json] -v, --verbose Display verbose output (e.g. displays full contents of transactions in rollup data) -h, --help Print help ``` - The input data can be of the form of the new batched blob, or the old single-entry blob, and each can be either sequencer metadata or rollup data. I don't think there's a way to know in advance of attempting to parse which of the four flavours we're dealing with, so the tool just tries each case until one successfully parses or fails if it can't parse as any of them. I pretty strongly dislike this trial-and-error parsing approach - if there's a way to avoid it (other than embedding more data in the blobs themselves) I'd be happy to implement it! - All binary fields in the output data (e.g. sequencer block hash, proposer address) are base-64 encoded. It would be trivial to hex-encode any of these instead of, or as well as, base-64 encoding them. - I added the `deprecated` feature to `clap` so it emits deprecation warnings, and fixed up the places where we were using deprecated functionality. ## Testing There are happy-path integration tests for the CLI using [`assert_cmd`](https://lib.rs/crates/assert_cmd) and [`predicates`](https://lib.rs/crates/predicates). These test the four possible types of input, and for each case assert that the various CLI option combos generate expected output. The input and expected output data for these tests live in files in a new `tests/resources` folder to avoid cluttering the test source code with lengthy string literals. ## Related Issues Closes #1050.
- Loading branch information
Showing
35 changed files
with
1,692 additions
and
181 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.