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

refactor: remove chunk header signature verification from epoch manager #12462

Merged
merged 12 commits into from
Dec 3, 2024

Conversation

stedfn
Copy link
Contributor

@stedfn stedfn commented Nov 14, 2024

The MR moves the chunk header signature verification outside of the epoch manager

@stedfn stedfn self-assigned this Nov 14, 2024
@stedfn stedfn changed the title . refactor: remove chunk header verification from epoch manager Nov 14, 2024
@stedfn stedfn changed the title refactor: remove chunk header verification from epoch manager refactor: remove chunk header signature verification from epoch manager Nov 14, 2024
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 88.52459% with 7 lines in your changes missing coverage. Please review.

Project coverage is 70.12%. Comparing base (e2d22c5) to head (e013756).
Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
chain/chain/src/signature_verification.rs 91.66% 1 Missing and 2 partials ⚠️
chain/chain/src/chain.rs 50.00% 0 Missing and 2 partials ⚠️
chain/chain/src/validate.rs 83.33% 0 Missing and 1 partial ⚠️
chain/chunks/src/shards_manager_actor.rs 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12462      +/-   ##
==========================================
+ Coverage   70.08%   70.12%   +0.03%     
==========================================
  Files         840      841       +1     
  Lines      170194   169720     -474     
  Branches   170194   169720     -474     
==========================================
- Hits       119277   119012     -265     
+ Misses      45753    45574     -179     
+ Partials     5164     5134      -30     
Flag Coverage Δ
backward-compatibility 0.16% <0.00%> (+<0.01%) ⬆️
db-migration 0.16% <0.00%> (+<0.01%) ⬆️
genesis-check 1.29% <0.00%> (+<0.01%) ⬆️
linux 69.35% <88.52%> (+0.04%) ⬆️
linux-nightly 69.71% <88.52%> (+0.04%) ⬆️
pytests 1.59% <0.00%> (+<0.01%) ⬆️
sanity-checks 1.40% <0.00%> (+<0.01%) ⬆️
unittests 69.94% <88.52%> (+0.03%) ⬆️
upgradability 0.20% <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.

@stedfn stedfn requested a review from pugachAG November 14, 2024 23:36
@stedfn stedfn marked this pull request as ready for review November 14, 2024 23:37
@stedfn stedfn requested a review from a team as a code owner November 14, 2024 23:37
Copy link
Contributor

@shreyan-gupta shreyan-gupta left a comment

Choose a reason for hiding this comment

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

I'm assuming we would be moving other verify functions to this file soon?

chain/chain/src/signature_verification.rs Show resolved Hide resolved
@stedfn
Copy link
Contributor Author

stedfn commented Nov 15, 2024

I'm assuming we would be moving other verify functions to this file soon?

Yes, that's what I plan

@stedfn stedfn added this pull request to the merge queue Nov 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 15, 2024
@stedfn stedfn added this pull request to the merge queue Nov 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 15, 2024
@stedfn stedfn added this pull request to the merge queue Nov 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 15, 2024
@stedfn stedfn added this pull request to the merge queue Nov 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 19, 2024
@pugachAG pugachAG added this pull request to the merge queue Nov 27, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 27, 2024
@pugachAG pugachAG enabled auto-merge November 28, 2024 14:16
@pugachAG pugachAG added this pull request to the merge queue Nov 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 28, 2024
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.

could you please add epoch_id as a parameter to verify_chunk_header_signature_with_epoch_manager as it was in the original epoch manager API, so we don't have to check should_verify_signature on the client in shards manager

@stedfn
Copy link
Contributor Author

stedfn commented Dec 3, 2024

@pugachAG I am not sure I understand. Do you mean adding the epoch manager as a parameter to verify_chunk_header_signature and checking there whether signatures should be verified?

@pugachAG
Copy link
Contributor

pugachAG commented Dec 3, 2024

@stedfn previously we had

fn verify_chunk_header_signature(
        &self,
        header: &ShardChunkHeader,
        epoch_id: &EpochId,
        last_known_hash: &CryptoHash,
    ) -> Result<bool, Error> {

and now we no longer pass epoch_id and instead get it from the previous block:

pub fn verify_chunk_header_signature_with_epoch_manager(
    epoch_manager: &dyn EpochManagerAdapter,
    chunk_header: &ShardChunkHeader,
    parent_hash: &CryptoHash,
) -> Result<bool, Error> {

What I suggest is to preserve passing epoch_id as a parameter. This way you can avoid let valid_signature = !self.epoch_manager.should_validate_signatures() || verify_chunk_header_signature( and use verify_chunk_header_signature_with_epoch_manager instead

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, please address the comment before merging

chain/chain/src/validate.rs Outdated Show resolved Hide resolved
Merged via the queue into master with commit 847caa9 Dec 3, 2024
27 checks passed
@stedfn stedfn deleted the stefan/remove_verify_chunk_header branch December 3, 2024 20:47
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.

3 participants