Rusty Russell via bitcoin-dev

2018-01-09 11:22:18 UTC

I've just re-read BIP 117, and I'm concerned about its flexibility. It

seems to be doing too much.

The use of altstack is awkward, and makes me query this entire approach.

I understand that CLEANSTACK painted us into a corner here :(

The simplest implementation of tail recursion would be a single blob: if

a single element is left on the altstack, pop and execute it. That

seems trivial to specify. The treatment of concatenation seems like

trying to run before we can walk.

Note that if we restrict this for a specific tx version, we can gain

experience first and get fancier later.

BIP 117 also drops SIGOP and opcode limits. This requires more

justification, in particular, measurements and bounds on execution

times. If this analysis has been done, I'm not aware of it.

We could restore statically analyzability by rules like so:

1. Only applied for tx version 3 segwit txs.

2. For version 3, top element of stack is counted for limits (perhaps

with discount).

3. The blob popped off for tail recursion must be identical to that top

element of the stack (ie. the one counted above).

Again, future tx versions could drop such restrictions.

Cheers,

Rusty.

seems to be doing too much.

The use of altstack is awkward, and makes me query this entire approach.

I understand that CLEANSTACK painted us into a corner here :(

The simplest implementation of tail recursion would be a single blob: if

a single element is left on the altstack, pop and execute it. That

seems trivial to specify. The treatment of concatenation seems like

trying to run before we can walk.

Note that if we restrict this for a specific tx version, we can gain

experience first and get fancier later.

BIP 117 also drops SIGOP and opcode limits. This requires more

justification, in particular, measurements and bounds on execution

times. If this analysis has been done, I'm not aware of it.

We could restore statically analyzability by rules like so:

1. Only applied for tx version 3 segwit txs.

2. For version 3, top element of stack is counted for limits (perhaps

with discount).

3. The blob popped off for tail recursion must be identical to that top

element of the stack (ie. the one counted above).

Again, future tx versions could drop such restrictions.

Cheers,

Rusty.