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

Partial witness validation: add height and epoch check #11301

Closed
Tracked by #11193
pugachAG opened this issue May 14, 2024 · 0 comments · Fixed by #11430
Closed
Tracked by #11193

Partial witness validation: add height and epoch check #11301

pugachAG opened this issue May 14, 2024 · 0 comments · Fixed by #11430
Assignees

Comments

@pugachAG
Copy link
Contributor

Part of #11193

Height check: (last_final_height..chain_head_height + MAX_HEIGHTS_AHEAD], we can use the same MAX_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 to ShardsManagerActor. Implementation draft: e186dc7

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
@pugachAG pugachAG reopened this May 30, 2024
@pugachAG pugachAG linked a pull request May 30, 2024 that will close this issue
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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants