Skip to content

Script Restoration BIPs: fix OP_RIGHT definition, clarify and adjust costing with wordspan notation, UPSHIFT, CLTV/CSV, final success-check#2204

Merged
murchandamus merged 2 commits into
bitcoin:masterfrom
jmoik:gsr
Jul 16, 2026

Conversation

@jmoik

@jmoik jmoik commented Jun 27, 2026

Copy link
Copy Markdown

BIP-0440: clarify wordspan costs

BIP-0441: update wordspan costs and fix OP_RIGHT

  • Apply BIP-0440 wordspan notation to numeric and bitvector costs.

  • Define OP_RIGHT as rightmost-byte extraction with bounded copying cost.

  • Clarify OP_UPSHIFT, CLTV/CSV, and final success-check costs.

julian added 2 commits June 27, 2026 16:16
- Apply BIP-0440 wordspan notation to numeric and bitvector costs.

- Define OP_RIGHT as rightmost-byte extraction with bounded copying cost.

- Clarify OP_UPSHIFT, CLTV/CSV, and final success-check costs.
@jmoik jmoik marked this pull request as ready for review June 27, 2026 14:44
@jonatack jonatack added BIP Update by Owner PR by Author or Deputy to modify their own BIP Bug fix labels Jun 28, 2026

@jonatack jonatack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see any obvious errors in this change.

Are you waiting for review from anyone, or do you plan to send a mail list post to discuss?

Comment thread bip-0440.mediawiki

==Changelog==

* 0.2.1: 2026-06-15: define wordspan notation and clarify byte-length versus word-span costs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It may not matter, but in both changelog additions in this pull, the date is two weeks ago.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for reviewing!

I don't think the changes are substantial enough to provide value for the mailing list, the OP_RIGHT definition was simply a mistake it seems, it now corresponds to the historical and the more natural semantics. I would give some time for @rustyrussell to take a look at the diff, but otherwise fine from my side.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you still waiting for @rustyrussell to take a look, or is this ready to go?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Well he seems to be unresponsive so good to merge from my side.

@murchandamus murchandamus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, the wordspan notation looks very helpful.

Given the triviality of the nit I commented on, I’ll merge this PR in a couple days if there is no update, but if you want to fix it or something else, please feel free to update.

Comment thread bip-0441.mediawiki
"((length(B) + 7) / 8) * 8", as the multiplication below makes the
difference of that from the simple "length(B)" significant.
We increase the operand lengths to the next word boundary for the word-span
loops, using <code>wordspan(n)</code> from [[bip-0440.mediawiki|BIP440]], as

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nano-consistency-nit: BIP440 speaks of <code>wordspan(X)</code>, while this line calls it <code>wordspan(n)</code>.

@murchandamus murchandamus merged commit ee34378 into bitcoin:master Jul 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BIP Update by Owner PR by Author or Deputy to modify their own BIP Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants