-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat(sighash): implement OP_MAX_SIGHASH_SUBSETS [part 5/7] #915
base: feat/sighash/multisig
Are you sure you want to change the base?
Conversation
7fff07d
to
92a19dc
Compare
bc45412
to
267c89a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feat/sighash/multisig #915 +/- ##
=========================================================
+ Coverage 84.31% 84.36% +0.04%
=========================================================
Files 321 321
Lines 24667 24705 +38
Branches 3785 3792 +7
=========================================================
+ Hits 20799 20843 +44
+ Misses 3126 3122 -4
+ Partials 742 740 -2 ☔ View full report in Codecov by Sentry. |
92a19dc
to
7f3180b
Compare
267c89a
to
645d9b8
Compare
7f3180b
to
2af28c2
Compare
645d9b8
to
fe3fb85
Compare
@@ -77,6 +77,14 @@ def push_sighash(self, sighash: SighashType) -> None: | |||
case _: | |||
assert_never(sighash) | |||
|
|||
def push_max_sighash_subsets(self, max_subsets: int | None) -> None: | |||
"""Push a maximum limit for custom sighash subsets.""" | |||
if max_subsets is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as in a previous PR. I don't know why we would accept None
and simply skip it when it happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 44f39cf
@@ -82,7 +82,8 @@ class Opcode(IntEnum): | |||
OP_DATA_MATCH_VALUE = 0xD1 | |||
OP_SIGHASH_BITMASK = 0xE0 | |||
OP_SIGHASH_RANGE = 0xE1 | |||
OP_MAX_INPUTS_OUTPUTS = 0xE2 | |||
OP_MAX_SIGHASH_SUBSETS = 0xE2 | |||
OP_MAX_INPUTS_OUTPUTS = 0xE3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check: It is safe to change the OPCODE because these opcodes haven't been activated in any network yet. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly.
tests/tx/test_tx.py
Outdated
@@ -184,6 +185,37 @@ def test_output_not_selected(self) -> None: | |||
|
|||
self.assertEqual(str(e.value), "Output at index 0 is not signed by any input.") | |||
|
|||
@patch('hathor.transaction.scripts.opcode.is_opcode_valid', lambda _: True) | |||
def test_too_many_sighash_subsets(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this test covers only the sighash all. What about other possible subsets? Or even subsets generated by different sighash strategies (e.g., bitmask vs range)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a new more complex test case in 44f39cf
2af28c2
to
bead555
Compare
fe3fb85
to
17df617
Compare
Depends on #914
Motivation
Implement new
OP_MAX_SIGHASH_SUBSETS
.Acceptance Criteria
OP_MAX_SIGHASH_SUBSETS
and implementop_max_sighash_subsets()
.OP_MAX_SIGHASH_SUBSETS
inHathorScript
, adding support in P2PKH and MultiSig.TooManySighashSubsets
verification inTransactionVerifier
.