-
Notifications
You must be signed in to change notification settings - Fork 659
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
Partial witness validation: add height and epoch check #11301
Comments
marcelo-gonzalez
added a commit
to marcelo-gonzalez/nearcore
that referenced
this issue
May 26, 2024
This adds logic to `PartialWitnessActor::validate_partial_encoded_state_witness()` that checks that the height is greater than the current final head height (as is done in `Client::process_chunk_state_witness()`), and not more than five ahead of the current head height, similar to what's done in `EncodedChunksCache::height_within_horizon()` For now we read the head and final head heights directlly from the database, but in the future this should be changed so that we make a request to the client for this info Related issue: near#11301
github-merge-queue bot
pushed a commit
that referenced
this issue
May 30, 2024
) This adds logic to `PartialWitnessActor::validate_partial_encoded_state_witness()` that checks that the height is greater than the current final head height (as is done in `Client::process_chunk_state_witness()`), and not more than five ahead of the current head height, similar to what's done in `EncodedChunksCache::height_within_horizon()` For now we read the head and final head heights directlly from the database, but in the future this should be changed so that we make a request to the client for this info Related issue: #11301
github-merge-queue bot
pushed a commit
that referenced
this issue
May 31, 2024
This is mostly to prevent malicious chunk producer from sending a witness with a valid height and old epoch id. Part of #11301.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Part of #11193
Height check:
(last_final_height..chain_head_height + MAX_HEIGHTS_AHEAD]
, we can use the sameMAX_HEIGHTS_AHEAD
as we have currently have for chunk distribution.Epoch check: use
possible_epochs_of_height_around_tip
with the current chain head.Both checks above require accessing chain head from
PartialWitnessActor
.The easiest would be just reading it from the database:
store.get_ser::<Tip>(DBCol::BlockMisc, HEAD_KEY)
.We can also add a message from client notifying
PartialWitnessActor
about head updates, similar toShardsManagerActor
. Implementation draft: e186dc7The text was updated successfully, but these errors were encountered: