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

feat(sighash): implement sighash range [part 3/7] #913

Open
wants to merge 1 commit into
base: tests/sighash/bitmask
Choose a base branch
from

Conversation

glevco
Copy link
Contributor

@glevco glevco commented Jan 8, 2024

Depends on #912

Motivation

Implement the new sighash range opcode.

Acceptance Criteria

  • Implement SighashRange model.
  • Implement op_sighash_range() function.
  • Add sighash range support for P2PKH input scripts.

@glevco glevco self-assigned this Jan 8, 2024
@glevco glevco marked this pull request as ready for review January 8, 2024 02:10
Copy link

codecov bot commented Jan 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (tests/sighash/bitmask@fc82733). Click here to learn what that means.

Additional details and impacted files
@@                   Coverage Diff                    @@
##             tests/sighash/bitmask     #913   +/-   ##
========================================================
  Coverage                         ?   85.43%           
========================================================
  Files                            ?      289           
  Lines                            ?    22584           
  Branches                         ?     3410           
========================================================
  Hits                             ?    19295           
  Misses                           ?     2614           
  Partials                         ?      675           

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

@glevco glevco force-pushed the tests/sighash/bitmask branch from 78b027b to 1b44d48 Compare January 8, 2024 20:10
@glevco glevco force-pushed the feat/sighash/range branch from c3467a9 to 479cb8a Compare January 8, 2024 20:10
@glevco glevco force-pushed the tests/sighash/bitmask branch from 1b44d48 to fc82733 Compare January 19, 2024 22:15
@glevco glevco force-pushed the feat/sighash/range branch from 479cb8a to b815b65 Compare January 19, 2024 22:16
@glevco glevco force-pushed the tests/sighash/bitmask branch from 2bf7549 to ad1def9 Compare December 9, 2024 23:16
@glevco glevco force-pushed the feat/sighash/range branch from b815b65 to e2a9b75 Compare December 9, 2024 23:18
output_start=bytes_to_int(output_start),
output_end=bytes_to_int(output_end),
)
except Exception as e:
Copy link
Member

Choose a reason for hiding this comment

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

Why are you capturing Exception instead of the specific exception types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it as explained in #911 (comment)

@@ -60,7 +60,37 @@ def _get_indexes(bitmask: int) -> list[int]:
return [index for index in range(8) if (bitmask >> index) & 1]


SighashType: TypeAlias = SighashAll | SighashBitmask
class SighashRange(CustomSighash):
"""A model representing the sighash range type config. Range ends are not inclusive."""
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't range ends be included? I feel it's more intuitive than not including them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's intuitive like this when you include the whole range, which would be from 0 to 255, which is the max number of inputs/outputs. If we do it inclusive, the user would have to set 254 to include the whole range. I can change it if you want.

@glevco glevco force-pushed the tests/sighash/bitmask branch from ad1def9 to 890c630 Compare February 25, 2025 21:04
@glevco glevco force-pushed the feat/sighash/range branch from e2a9b75 to d7aa643 Compare February 25, 2025 21:57
@glevco glevco force-pushed the feat/sighash/range branch from d7aa643 to 887a8a7 Compare February 25, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review (WIP)
Development

Successfully merging this pull request may close these issues.

2 participants