-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add chain-info
Subcommand
#11250
Add chain-info
Subcommand
#11250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea, I was looking for something like this!
I think for the future we should think of a structure similar to the benchmark commands, instead of having dashed commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one nitpick, feel free to ignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me.
Maybe I would use just chain-info
instead of blockchain-info
for the command (we got purge-chain
in existing command and it is shorter to type).
CI seems in need of a cargo +nightly --fmt all
.
Co-authored-by: Bastian Köcher <[email protected]>
bot merge |
Error: Github API says "Allow edits from maintainers" is not enabled for paritytech/polkadot#5370. The bot would use that permission to push the lockfile update after merging this PR. Please check https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork. |
* Add `blockchain-info` Subcommand * Update comment * Cleanup * Cleanup * Use `sync_run` * Use `sc_client_db` utility fns instead service backend * Use service `Backend` builder * Impl `From<sp_blockchain::Info>` * Rename to `chain-info` * fmt * Copyright year Co-authored-by: Bastian Köcher <[email protected]> * Expose `DatabaseParams` Co-authored-by: Bastian Köcher <[email protected]>
* Add `blockchain-info` Subcommand * Update comment * Cleanup * Cleanup * Use `sync_run` * Use `sc_client_db` utility fns instead service backend * Use service `Backend` builder * Impl `From<sp_blockchain::Info>` * Rename to `chain-info` * fmt * Copyright year Co-authored-by: Bastian Köcher <[email protected]> * Expose `DatabaseParams` Co-authored-by: Bastian Köcher <[email protected]>
* Add `blockchain-info` Subcommand * Update comment * Cleanup * Cleanup * Use `sync_run` * Use `sc_client_db` utility fns instead service backend * Use service `Backend` builder * Impl `From<sp_blockchain::Info>` * Rename to `chain-info` * fmt * Copyright year Co-authored-by: Bastian Köcher <[email protected]> * Expose `DatabaseParams` Co-authored-by: Bastian Köcher <[email protected]>
Adds a
chain-info
Subcommand to stdout DB meta column information serialized as JSON, including:best_hash
best_number
genesis_hash
finalized_hash
finalized_number
Usage and output example
./binary chain-info --base-path=PATH_TO_DB --chain=CHAIN --pruning=PRUNING
Rel https://substrate.stackexchange.com/questions/1949/get-block-height-from-database-snapshot-without-running-a-node
polkadot companion: paritytech/polkadot#5370