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

Witness size worst case calculation #11

Open
darosior opened this issue Apr 21, 2022 · 1 comment
Open

Witness size worst case calculation #11

darosior opened this issue Apr 21, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@darosior
Copy link
Owner

We have this calculation for the number of executed OPs and the number of stack elements. It would be nice to implement it for the witness size as well, as it would allow to compute feerate of presigned transactions in advance.

@darosior darosior added the good first issue Good for newcomers label Apr 21, 2022
@darosior
Copy link
Owner Author

The relevant data structure where we track those:

class ExecutionInfo:
"""Information about the execution of a Miniscript."""
def __init__(self, stat_ops, _dyn_ops, sat_size, dissat_size):
# The *maximum* number of *always* executed non-PUSH Script OPs to satisfy this
# Miniscript fragment non-malleably.
self._static_ops_count = stat_ops
# The maximum possible number of counted-as-executed-by-interpreter OPs if this
# fragment is executed.
# It is only >0 for an executed multi() branch. That is, for a CHECKMULTISIG that
# is not part of an unexecuted branch of an IF .. ENDIF.
self._dyn_ops_count = _dyn_ops
# The *maximum* number of stack elements to satisfy this Miniscript fragment
# non-malleably.
self.sat_elems = sat_size
# The *maximum* number of stack elements to dissatisfy this Miniscript fragment
# non-malleably.
self.dissat_elems = dissat_size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant