Skip to content

Conversation

@sanket1729
Copy link
Member

Satisfy can fail if the resource limits are exceeded

@sanket1729 sanket1729 mentioned this pull request Nov 18, 2020
@sanket1729 sanket1729 force-pushed the satisfy_fail branch 2 times, most recently from ef367e3 to 8776e7b Compare November 19, 2020 01:52
@sanket1729 sanket1729 changed the title Satisfy fail Fail satisfy when resource limits exceed Nov 19, 2020
honggfuzz = { version = "0.5", optional = true }
afl = { version = "0.8", optional = true }
regex = { version = "1.4"}
miniscript = { path = "..", features = ["fuzztarget", "compiler"] }
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 we changing this? The fuzzer won't be able to come up with hash preimages or signatures without the fuzztarget on.

Copy link
Member Author

Choose a reason for hiding this comment

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

What does the fuzztarget feature do in rust-bitcoin? I think the only use we have in rust-miniscript is pass through for rust-bitcoin.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I disabled them because I was not able to come up with secp Signature required for satisfier.

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ack 70b987f

@apoelstra apoelstra merged commit c8cd42b into rust-bitcoin:master Nov 23, 2020
Comment on lines +324 to +325
if witness_size(witness) > MAX_STANDARD_P2WSH_SCRIPT_SIZE {
return Err(ScriptContextError::MaxScriptSigSizeExceeded);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm shouldn't it return a MaxWitnessSizeExceeded Error instead ?

apoelstra added a commit to apoelstra/rust-miniscript that referenced this pull request Oct 20, 2025
This is a weird function. Its role is to double-check a witness after it
has been produced to ensure that it falls within limits. If you are
working with a sane miniscript this is impossible to fail, and if you're
working with an insane miniscript then the checks are too strong -- it
verifies standardness rules rather than consensus.

This was introduced in rust-bitcoin#189 without much discussion. It had no tests
then and has no tests now -- everything continues to pass.

I am removing it for now. I will later replace it with an API where you
call Plan::validate if you want to do checks like this. If the user wants
to do something oddball like "parse a miniscript without checking satisfaction
limits, then produce a satisfaction and see if the result is nonetheless
within limits" the workflow will be:

1. Parse an insane Miniscript
2. Produce a Plan
3. Run Plan::validate with tighter validation params than were used in
   step 1.

This gives the user a fair bit more flexibility. It is an awkward and
hard to discover workflow, but IMO it's better than we have now.
apoelstra added a commit to apoelstra/rust-miniscript that referenced this pull request Oct 26, 2025
This is a weird function. Its role is to double-check a witness after it
has been produced to ensure that it falls within limits. If you are
working with a sane miniscript this is impossible to fail, and if you're
working with an insane miniscript then the checks are too strong -- it
verifies standardness rules rather than consensus.

This was introduced in rust-bitcoin#189 without much discussion. It had no tests
then and has no tests now -- everything continues to pass.

I am removing it for now. I will later replace it with an API where you
call Plan::validate if you want to do checks like this. If the user wants
to do something oddball like "parse a miniscript without checking satisfaction
limits, then produce a satisfaction and see if the result is nonetheless
within limits" the workflow will be:

1. Parse an insane Miniscript
2. Produce a Plan
3. Run Plan::validate with tighter validation params than were used in
   step 1.

This gives the user a fair bit more flexibility. It is an awkward and
hard to discover workflow, but IMO it's better than we have now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants