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

fix(verification): avoid validation downgrade by not running it twice #853

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

jansegre
Copy link
Member

@jansegre jansegre commented Nov 8, 2023

Motivation

In new sync-v2 sync flow, a node can receive a transaction that it already has, but the node might run validate_basic before processing the transaction. Before this PR running validate_basic on an existing and fully verified transaction would run the validation and downgrade the validation state from FULL to BASIC.

Acceptance Criteria

  • Adjust both validate_basic to skip the validation if the given transaction has already been validated at the same or higher validation level.
  • Adjust both validate_full to skip the validation if the given transaction has already been validated at the same or higher validation level. Removed from this PR because it affects other tests which require changes to HathorManager.on_new_tx for a proper fix and this isn't needed for anything in sync-v2

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@jansegre jansegre self-assigned this Nov 8, 2023
@jansegre jansegre requested a review from msbrogli as a code owner November 8, 2023 22:32
@jansegre jansegre requested a review from glevco November 8, 2023 22:32
glevco
glevco previously approved these changes Nov 9, 2023
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d5be7b9) 85.36% compared to head (9f2a422) 85.32%.

❗ Current head 9f2a422 differs from pull request most recent head 27b07b1. Consider uploading reports for the commit 27b07b1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #853      +/-   ##
==========================================
- Coverage   85.36%   85.32%   -0.05%     
==========================================
  Files         282      282              
  Lines       22267    22271       +4     
  Branches     3366     3368       +2     
==========================================
- Hits        19009    19003       -6     
- Misses       2592     2599       +7     
- Partials      666      669       +3     
Files Coverage Δ
hathor/verification/verification_service.py 90.00% <100.00%> (+0.22%) ⬆️

... and 3 files with indirect coverage changes

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

@jansegre jansegre mentioned this pull request Nov 9, 2023
2 tasks
@jansegre jansegre force-pushed the fix/validation-downgrade branch from 9f2a422 to 27b07b1 Compare November 9, 2023 22:56
@jansegre jansegre merged commit bce9f71 into master Nov 9, 2023
8 checks passed
@jansegre jansegre deleted the fix/validation-downgrade branch November 9, 2023 23:02
This was referenced Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants