-
Notifications
You must be signed in to change notification settings - Fork 27
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): organization and typing improvements [part 1/9] #830
Merged
glevco
merged 1 commit into
master
from
refactor/verification-inheritance/1-improvements
Nov 7, 2023
Merged
refactor(verification): organization and typing improvements [part 1/9] #830
glevco
merged 1 commit into
master
from
refactor/verification-inheritance/1-improvements
Nov 7, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
glevco
changed the title
refactor(verification): organization and typing improvements
refactor(verification): organization and typing improvements [part 1/9]
Oct 27, 2023
msbrogli
previously approved these changes
Nov 1, 2023
msbrogli
previously approved these changes
Nov 3, 2023
jansegre
previously approved these changes
Nov 6, 2023
glevco
force-pushed
the
refactor/verification-inheritance/1-improvements
branch
from
November 6, 2023 23:49
6d844b9
to
9c7038b
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #830 +/- ##
=======================================
Coverage 85.18% 85.19%
=======================================
Files 285 285
Lines 22655 22652 -3
Branches 3444 3443 -1
=======================================
- Hits 19299 19298 -1
- Misses 2671 2673 +2
+ Partials 685 681 -4
☔ View full report in Codecov by Sentry. |
glevco
force-pushed
the
refactor/verification-inheritance/1-improvements
branch
from
November 7, 2023 01:58
9c7038b
to
8d48b50
Compare
msbrogli
previously approved these changes
Nov 7, 2023
jansegre
previously approved these changes
Nov 7, 2023
jansegre
approved these changes
Nov 7, 2023
msbrogli
approved these changes
Nov 7, 2023
glevco
force-pushed
the
refactor/verification-inheritance/1-improvements
branch
from
November 7, 2023 16:22
99af497
to
50281e7
Compare
glevco
force-pushed
the
refactor/verification-inheritance/1-improvements
branch
from
November 7, 2023 21:31
50281e7
to
c632ffe
Compare
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This PR is the first one in a series of 9 PRs that finishes the vertex verification refactors. The objective is to completely remove all inheritance from the verification process, removing implicit dependencies between verifiers, streamlining the verification process and improving clarity on the scope/origin of each verification method, all to improve code readability, maintainability, and patching (for the simulator).
This is done incrementally. In previous PRs, we moved the verification out of the model classes. Now, in this series, we'll first change inheritance to composition, and then completely remove the composition too, leaving each verifier with the least possible amount of dependencies.
Also, in this PR, we install the typing_extensions dev dependency. This is a project from the official Python organization, and what it does is enable use of new type system features on older Python versions. In other words, it simply allows us to use features from the
typing
module that are not available in all Python versions we support.Specifically, for this refactor we'll use
assert_never()
, a function to be used were we would normally use something likeassert False
, but that can be correctly type-checked by mypy. This improves robustness ofmatch
statements for example, that can be made exhaustive with this. We also use the@override
annotation in next PRs, improving robustness and safety guarantees of inheritance. We may also find other useful typing features in the future that wouldn't be available otherwise.Acceptance Criteria
BaseTransaction
and all subclasses to useTxVersion
as theversion
type, instead ofint
.typing_extensions
dev dependency.verify_unsigned_skip_pow()
fromTransactionVerifier
tocreate_tx.py
. This resolves Moveverify_unsigned_skip_pow()
#825.VerificationService
:isinstance()
checks totype() is
, which is more restrictive.raise NotImplementedError
usages inmatch
statements toassert_never()
, which can be checked by the static type checker.validate_vertex_error()
, inlining itHathorManager
.self.verifiers
variable intest_verification
, updating all usages. This will be useful in the next PRs.Checklist
master
, confirm this code is production-ready and can be included in future releases as soon as it gets merged