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

Exit with an error if state missing for chosen mapping block #3252

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

teor2345
Copy link
Member

@teor2345 teor2345 commented Nov 25, 2024

This PR handles an edge case where state is missing for a custom mapping start height:
#3242 (comment)

Code contributor checklist:

@teor2345 teor2345 added the bug Something isn't working label Nov 25, 2024
@teor2345 teor2345 self-assigned this Nov 25, 2024
@teor2345 teor2345 enabled auto-merge November 25, 2024 03:09
// Similarly, state can be pruned, even if the data is present.
client
.runtime_api()
.extract_block_object_mapping(*best_block_data.block.header().parent_hash(), best_block_data.block.clone())
Copy link
Member

Choose a reason for hiding this comment

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

We already have hash conveniently stored in a variable, no need to re-calculate it again:

Suggested change
.extract_block_object_mapping(*best_block_data.block.header().parent_hash(), best_block_data.block.clone())
.extract_block_object_mapping(best_block_to_archive_hash, best_block_data.block.clone())

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically it’s the hash if the block itself, not the parent block hash?
But in this case, if we haven’t pruned the parent block, we definitely haven’t pruned the block itself.

Copy link
Member

Choose a reason for hiding this comment

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

I see, I was not reading it correct and you're correct that this change is not equivalent.

nazar-pc
nazar-pc previously approved these changes Nov 25, 2024
@teor2345 teor2345 added this pull request to the merge queue Nov 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 25, 2024
@teor2345 teor2345 added this pull request to the merge queue Nov 25, 2024
@nazar-pc nazar-pc removed this pull request from the merge queue due to a manual request Nov 25, 2024
@nazar-pc nazar-pc enabled auto-merge November 25, 2024 09:24
@nazar-pc nazar-pc added this pull request to the merge queue Nov 25, 2024
Merged via the queue into main with commit eb24a91 Nov 25, 2024
10 of 16 checks passed
@nazar-pc nazar-pc deleted the map-check-state branch November 25, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants