Skip to content

spring-util command to print snapshot info #1237

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

Merged
merged 6 commits into from
Mar 15, 2025
Merged

Conversation

spoonincode
Copy link
Member

@spoonincode spoonincode commented Mar 5, 2025

Adds a command to spring-util that prints basic information about a snapshot in JSON.

spring-util snapshot info ../217214268.bin
{
  "version": 3,
  "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
  "head_block_id": "0cf26d3cf1bf39f8c3701b2deb5381d4679ae6286de1f94bfea3cdfa0ccf307b",
  "head_block_num": 217214268,
  "head_block_time": "2021-11-24T16:00:01.000"
}


spring-util snapshot info ~/snapshot-0c1620e34d4c49381b66639ad14b892f566e02d86eb0642770060b2973d1de11.bin
{
  "version": 5,
  "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
  "head_block_id": "0c1620e34d4c49381b66639ad14b892f566e02d86eb0642770060b2973d1de11",
  "head_block_num": 202776803,
  "head_block_time": "2021-09-02T02:22:19.000"
}

spring-util snapshot info /mnt/eos/eos/snapshots/snapshot-192f82e68109654011291f2fc8588c5eb22f0941756a888da74c0fbfba830b2f.bin
{
  "version": 8,
  "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
  "head_block_id": "192f82e68109654011291f2fc8588c5eb22f0941756a888da74c0fbfba830b2f",
  "head_block_num": 422544102,
  "head_block_time": "2025-02-25T23:04:38.500"
}

("head_block_id", head_block)
("head_block_num", block_header::num_from_id(head_block))
("head_block_time", head_block_time))
<< std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that code should be in snapshot.hpp or snapshot_detail.hpp so that the snapshot format details are not spread out in too many places.

Copy link
Member Author

Choose a reason for hiding this comment

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

It won't be too hard to create a get_snapshot_info() call in those files returning some sort of snapshot_info struct. Any more commonization between snapshot loading and getting snapshot info might be rather invasive.

Copy link
Member

Choose a reason for hiding this comment

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

Or even just return a mutable_variant to keep it flexible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's exactly what I was thinking of.

Copy link
Member Author

Choose a reason for hiding this comment

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

okay I've moved the stuff that generates the MVO in to snapshot.hpp/cpp. Also added tests a few days ago. Moving out of draft.

@spoonincode spoonincode marked this pull request as ready for review March 15, 2025 03:35
@spoonincode spoonincode merged commit 5f32d7d into main Mar 15, 2025
36 checks passed
@spoonincode spoonincode deleted the springutil-snapinfo branch March 15, 2025 18:35
@ericpassmore
Copy link
Contributor

Note:start
category: Other
component: Spring-Util
summary: Print snapshot information using spring-util command.
Note:end

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.

5 participants