I suspect that your conjecture is true. And given that it is plausible that we would want to add an opcode to tweak public keys, it seems like a reason design to avoid accidental covenants. (That said, I strongly prefer that the SECURETHEBAG data be the 32-bytes immediately following the opcode rather than a OP_PUSHDATA, and I'd be willing to help code this up (see below)).
On Mon, Jun 24, 2019 at 2:07 PM Jeremy <jlru...@mit.edu> wrote: > Do you think the following hypothesis is more or less true: > > H: There is no set of pure extensions* to script E such that enabling E > and OP_SECURETHEBAG as proposed enables recursive covenants, but E alone > does not enable recursive covenants? > > * Of course there are things that specifically are specifically designed > to switch on if OP_SECURETHEBAG, so pure means normal things like OP_CAT > that are a function of the arguments on the stack or hashed txn data. > > This is the main draw of the design I proposed, it should be highly > improbable or impossible to accidentally introduce more behavior than > intended with a new opcode. > > I think that given that H is not true for the stack reading version of the > opcode, we should avoid doing it unless strongly motivated, so as to permit > more flexibility for which opcodes we can add in the future without > introducing recursion unless it is explicitly intended. > On Sat, Jun 1, 2019 at 12:47 PM Jeremy via bitcoin-dev < email@example.com> wrote: > A particularly useful topic of discussion is how best to eliminate the > PUSHDATA and treat OP_SECURETHEBAG like a pushdata directly. I thought > about how the interpreter works and is implemented and couldn't come up > with something noninvasive. > We shouldn't be using the complexity of the changes to the Bitcoin Core a measure of the complexity of a proposal. That is looking the issue from the wrong side. If we measure the complexity of Script proposals by how hard it is to change Bitcoin Core, what will happen is more and more of the incidental details of Bitcoin Core's implementation will be pulled into the semantics of Script (e.g. the fact that surrounding opcode values are readily available in Bitcoin Core's particular implementation of its Script interpreter). Instead we should use the complexity of how hard it is to reason about the new Script semantics. The peeking semantics of OP_SECURETHEBAG is particularly awful because it more-or-less breaks the fact that Bitcoin Script can be decomposed into individual units of "opcodes" whose semantics and be individually described, and it harms the composability of Bitcoin Script where you can divide the script between any opcodes and the semantics of the concatenation of those two scripts is simply the composition of the semantics of the two halves. (For those interested in formal semantics, what we have here is a monoid homomorphism from list of opcodes (syntax) to stack transformation functions (with side-effects) under (Kleisli) composition (semantics).) Being able to decompose a Bitcoin Script this way and reasoning about components is how one would reason about Bitcoin Script in practice. (Technically the structure is more involved than a list of opcodes due to OP_IF, and instead you get a railroad diagram <https://en.wikipedia.org/wiki/Syntax_diagram>). Putting the 32 bytes of data required by OP_SECURETHEBAG immediately after the opcode, like how OP_PUSHDATA* works, is a superior design choice. It lets us treat the opcodes and its immediate data as an atomic unit when reasoning about Script and removes the need to define what happens when OP_SECURETHEBAG is not followed by an OP_PUSDATA.
_______________________________________________ bitcoin-dev mailing list firstname.lastname@example.org https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev