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

script: give `Builder` ability to verify-ify opcodes #286

Merged
merged 1 commit into from Jul 3, 2019

Conversation

Projects
None yet
3 participants
@apoelstra
Copy link
Member

commented Jun 26, 2019

No description provided.

@stevenroose

This comment has been minimized.

Copy link
Collaborator

commented Jun 26, 2019

What do you envision this is useful for? It doesn't seem to be a good idea to encourage people to do operations on scripts they don't fully know beforehand.

@apoelstra

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2019

By definition a script::Builder is a script the user "doesn't fully know". If they fully knew it it would be a Script.

@stevenroose

This comment has been minimized.

Copy link
Collaborator

commented Jun 27, 2019

I don't think many people build a script if they don't know what script they are going to build beforehand.. I mean that almost all usage of Builder is with hard-coded opcodes and variable data pushes.

If you know all your script opcodes upfront, you can just as well manually verify-ify the last opcode and if you don't know all upcodes upfront, you're doing dangerous stuff.

@sgeisler
Copy link
Member

left a comment

I don't know the actual use case you had in mind, but that seems useful for dynamic script building like in miniscript (just a guess). Would be nice to know the actual motivation.

@apoelstra apoelstra force-pushed the apoelstra:2019-06-builder-ext branch from 6c9404d to 0361ef6 Jun 29, 2019

@apoelstra

This comment has been minimized.

Copy link
Member Author

commented Jun 29, 2019

Updated to fix bug where slices that ended in a CHECKSIG byte (or similar) would be modified by the function.

@stevenroose This function is semantically equivalent to .push_opcode(opcodes::all::OP_VERIFY) except that it saves a byte when possible, something that is subtle and difficult and tedious to do by hand. Similarly we have .push_int which finds the most efficient way to push a given integer, and push_key which deals with the different keysizes. (And these are easier/safer to do by hand than verify-compression.) I really don't understand how it's dangerous for the user not to want to deal with this accounting himself.

@apoelstra apoelstra force-pushed the apoelstra:2019-06-builder-ext branch from 0361ef6 to a114128 Jun 29, 2019

@apoelstra apoelstra merged commit 1a4bb37 into rust-bitcoin:master Jul 3, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@apoelstra apoelstra deleted the apoelstra:2019-06-builder-ext branch Jul 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.