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(verification): move feature activation dependency #896

Closed
wants to merge 1 commit into from

Conversation

glevco
Copy link
Contributor

@glevco glevco commented Dec 19, 2023

Depends on #983

Motivation

Move the Feature Activation verification dependency to outside the verification method. This will be useful for Multiprocess Verification.

Acceptance Criteria

  • Rename FeatureService.get_bits_description() to get_feature_info(), and FeatureDescription to FeatureInfo.
  • Change BlockVerifier.verify_mandatory_signaling() so it receives a pre-calculated signaling state, instead of calculating it itself with a FeatureService.
  • Change MergeMinedBlockVerifier.verify_aux_pow() so it receives a pre-calculated feature_info, instead of calculating it itself with a FeatureService.
  • IMPORTANT: move verify_aux_pow() verification from verify_without_storage() to verify().

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

@glevco glevco self-assigned this Dec 19, 2023
@glevco glevco changed the title refactor(feature-activation): improve usage check and signal verifica… refactor(feature-activation): improve usage check and signal verification Dec 19, 2023
Copy link

codecov bot commented Dec 19, 2023

Codecov Report

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

Project coverage is 84.96%. Comparing base (dc7071e) to head (3911dbf).

Files Patch % Lines
hathor/verification/block_verifier.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #896      +/-   ##
==========================================
+ Coverage   84.92%   84.96%   +0.04%     
==========================================
  Files         298      298              
  Lines       22952    22961       +9     
  Branches     3466     3467       +1     
==========================================
+ Hits        19492    19509      +17     
+ Misses       2774     2766       -8     
  Partials      686      686              

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

@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from 5f5d404 to cbc3dc1 Compare December 22, 2023 16:34
@glevco glevco marked this pull request as ready for review December 22, 2023 16:43
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from cbc3dc1 to 3e70c8c Compare December 22, 2023 17:24
@glevco glevco changed the base branch from master to refactor/daa-dependencies December 22, 2023 17:24
@@ -58,6 +58,9 @@ def start(self) -> None:
Log information related to bit signaling. Must be called after the storage is ready and migrations have
been applied.
"""
if not self._feature_service.is_usage_enabled():
Copy link
Member

Choose a reason for hiding this comment

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

I feel it should be done somewhere else. It seems error prone to call start() and get no exception because it just skipped initialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been removed from this PR.

@@ -473,24 +473,20 @@ def _get_or_create_bit_signaling_service(self) -> BitSignalingService:
def _get_or_create_verification_service(self) -> VerificationService:
if self._verification_service is None:
verifiers = self._get_or_create_vertex_verifiers()
self._verification_service = VerificationService(verifiers=verifiers)
feature_service = self._get_or_create_feature_service()
self._verification_service = VerificationService(verifiers=verifiers, feature_service=feature_service)

return self._verification_service

def _get_or_create_vertex_verifiers(self) -> VertexVerifiers:
Copy link
Member

Choose a reason for hiding this comment

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

Why not simply verify whether it is enabled or not here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been removed from this PR.

@glevco glevco force-pushed the refactor/daa-dependencies branch from 289059e to c4aa2b8 Compare December 27, 2023 18:19
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from 3e70c8c to 8f3d009 Compare December 27, 2023 18:19
hathor/builder/builder.py Show resolved Hide resolved
@glevco glevco force-pushed the refactor/daa-dependencies branch from c4aa2b8 to e2f823e Compare January 9, 2024 14:32
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from 8f3d009 to ac02106 Compare January 9, 2024 14:59
@glevco glevco force-pushed the refactor/daa-dependencies branch from e774d52 to 103162b Compare January 9, 2024 15:06
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch 4 times, most recently from 2527d3c to 1b24b0c Compare January 9, 2024 22:07
@glevco glevco changed the title refactor(feature-activation): improve usage check and signal verification refactor(verification): move feature activation dependency Jan 9, 2024
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from 1b24b0c to 0fc7e30 Compare January 9, 2024 22:12
@glevco
Copy link
Contributor Author

glevco commented Jan 9, 2024

@msbrogli this PR has been simplified, I recommend re-reviewing it. I've updated the Acceptance Criteria.

@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from 0fc7e30 to d0f339c Compare January 11, 2024 23:51
@glevco glevco force-pushed the refactor/daa-dependencies branch from 103162b to 204fa2c Compare January 23, 2024 02:58
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from d0f339c to a73d566 Compare January 23, 2024 03:00
jansegre
jansegre previously approved these changes Jan 26, 2024
@glevco glevco force-pushed the refactor/daa-dependencies branch from 204fa2c to b895832 Compare March 5, 2024 16:03
@glevco glevco force-pushed the refactor/daa-dependencies branch 3 times, most recently from 7eb1d79 to ae05d01 Compare March 22, 2024 15:57
Base automatically changed from refactor/daa-dependencies to master March 22, 2024 17:05
@glevco glevco dismissed jansegre’s stale review March 22, 2024 17:05

The base branch was changed.

@glevco glevco changed the base branch from master to tests/fix-verification-test March 25, 2024 18:36
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch 4 times, most recently from 4540afe to d82a5db Compare March 25, 2024 21:38
@glevco glevco requested review from msbrogli and jansegre March 27, 2024 16:00
@glevco
Copy link
Contributor Author

glevco commented Apr 1, 2024

@jansegre @msbrogli requested re-review after rebase with conflicts.

Base automatically changed from tests/fix-verification-test to master April 2, 2024 16:48
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch 2 times, most recently from a12297b to eb0f05d Compare April 9, 2024 15:55
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from eb0f05d to 43d2174 Compare April 17, 2024 00:33
@glevco glevco force-pushed the refactor/feature-activation/enable-usage branch from 43d2174 to 3911dbf Compare May 2, 2024 22:47
@glevco
Copy link
Contributor Author

glevco commented May 3, 2024

Changes in this PR were either canceled or moved to those other PRs: #1016, #1017, #1018.

@glevco glevco closed this May 3, 2024
@glevco glevco deleted the refactor/feature-activation/enable-usage branch May 3, 2024 20:43
@glevco glevco restored the refactor/feature-activation/enable-usage branch May 6, 2024 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants