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

[stateless_validation] validate incoming partial witness heights #11398

Merged
merged 3 commits into from
May 30, 2024

Conversation

marcelo-gonzalez
Copy link
Contributor

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

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
Copy link

codecov bot commented May 26, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 71.35%. Comparing base (a8ff1d2) to head (4be1081).
Report is 13 commits behind head on master.

Files Patch % Lines
...alidation/partial_witness/partial_witness_actor.rs 34.78% 13 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11398      +/-   ##
==========================================
+ Coverage   71.27%   71.35%   +0.08%     
==========================================
  Files         784      784              
  Lines      157847   158134     +287     
  Branches   157847   158134     +287     
==========================================
+ Hits       112499   112843     +344     
+ Misses      40505    40417      -88     
- Partials     4843     4874      +31     
Flag Coverage Δ
backward-compatibility 0.24% <0.00%> (-0.01%) ⬇️
db-migration 0.24% <0.00%> (-0.01%) ⬇️
genesis-check 1.38% <0.00%> (-0.01%) ⬇️
integration-tests 37.48% <40.00%> (+0.13%) ⬆️
linux 68.84% <16.00%> (+0.04%) ⬆️
linux-nightly 70.80% <40.00%> (+0.07%) ⬆️
macos 52.41% <16.00%> (+0.04%) ⬆️
pytests 1.60% <0.00%> (-0.01%) ⬇️
sanity-checks 1.39% <0.00%> (-0.01%) ⬇️
unittests 65.72% <16.00%> (+0.02%) ⬆️
upgradability 0.28% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tayfunelmas
Copy link
Contributor

Are these checks duplicated (eg., you mentioned the same check happens in process_chunk_state_witness) or the existing checks belong to old code paths?

@marcelo-gonzalez
Copy link
Contributor Author

Are these checks duplicated (eg., you mentioned the same check happens in process_chunk_state_witness) or the existing checks belong to old code paths?

many of the existing checks were deleted in this PR: #11179

Copy link
Contributor

@pugachAG pugachAG left a comment

Choose a reason for hiding this comment

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

LGTM, but this makes the check introduced in #11081 redundant, so let's remove it as part of this PR

@marcelo-gonzalez
Copy link
Contributor Author

LGTM, but this makes the check introduced in #11081 redundant, so let's remove it as part of this PR

removed and moved the comment over

@marcelo-gonzalez marcelo-gonzalez added this pull request to the merge queue May 30, 2024
Merged via the queue into near:master with commit dfa392b May 30, 2024
27 of 29 checks passed
@marcelo-gonzalez marcelo-gonzalez deleted the witness-height branch May 30, 2024 02:27
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.

None yet

3 participants