near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.31k stars 615 forks source link

feat: Update view-genesis command to view genesis in store #11809

Closed tayfunelmas closed 1 month ago

tayfunelmas commented 1 month ago

We previously added the neard view-state view-genesis command to display the genesis block generated from code using the genesis json file. We used this command to debug the reason for the blockhash-mismatches between the genesis in the store/DB and the genesis computed from the config files using code.

We extend the command to also display the genesis block stored in the DB.

Example usage to see the genesis in config and store and compare their hashes:

./target/debug/neard --home ~/.near/localnet/node4 view-state view-genesis --config --store --compare

Also shorten the flag names to remove view- prefix since it is already as part of main command and sub command.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 37 lines in your changes missing coverage. Please review.

Project coverage is 71.75%. Comparing base (0557fa4) to head (a2686da). Report is 2 commits behind head on master.

Files Patch % Lines
tools/state-viewer/src/commands.rs 0.00% 34 Missing :warning:
tools/state-viewer/src/cli.rs 0.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #11809 +/- ## ========================================== + Coverage 71.72% 71.75% +0.03% ========================================== Files 796 796 Lines 162984 163196 +212 Branches 162984 163196 +212 ========================================== + Hits 116897 117100 +203 - Misses 41037 41043 +6 - Partials 5050 5053 +3 ``` | [Flag](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | Coverage Δ | | |---|---|---| | [backward-compatibility](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.23% <0.00%> (-0.01%)` | :arrow_down: | | [db-migration](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.23% <0.00%> (-0.01%)` | :arrow_down: | | [genesis-check](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.35% <0.00%> (-0.01%)` | :arrow_down: | | [integration-tests](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `37.81% <0.00%> (+<0.01%)` | :arrow_up: | | [linux](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.36% <0.00%> (+0.01%)` | :arrow_up: | | [linux-nightly](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.33% <0.00%> (+<0.01%)` | :arrow_up: | | [macos](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `54.59% <0.00%> (+1.63%)` | :arrow_up: | | [pytests](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.62% <0.00%> (+0.03%)` | :arrow_up: | | [sanity-checks](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.42% <0.00%> (+0.03%)` | :arrow_up: | | [unittests](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `66.21% <0.00%> (+0.05%)` | :arrow_up: | | [upgradability](https://app.codecov.io/gh/near/nearcore/pull/11809/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.28% <0.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.