Bitcoin Forum
September 19, 2021, 03:24:12 AM *
News: Latest Bitcoin Core release: 22.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What's the reason for not being strict about Taproot witness program size?  (Read 76 times)
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 985
Merit: 1990


Bitcoin and C♯ Enthusiast


View Profile WWW
May 30, 2021, 11:28:17 AM
 #1

Witness version 0 is strict and will fail if the program size is not 20 or 32 bytes but witness version 1 will simply assume the program is undefined and passes on verification. What's the rational for keeping this loose?
https://github.com/bitcoin/bitcoin/blob/55a156fca08713b020aafef91f40df8ce4bc3cae/src/script/interpreter.cpp#L1878
Code:
if (witversion == 0)
{
  if (program.size() == WITNESS_V0_SCRIPTHASH_SIZE){}
  else if (program.size() == WITNESS_V0_KEYHASH_SIZE){}
  else { set_error (...) }
}
else if (witversion == 1 && program.size() == WITNESS_V1_TAPROOT_SIZE && !is_p2sh)
{...}
else
   return true;

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.12.1)Ann-git
Denovo(0.1.0)Ann-git
Bitcoin.Net(0.14.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.11.0)Ann-git
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1632021852
Hero Member
*
Offline Offline

Posts: 1632021852

View Profile Personal Message (Offline)

Ignore
1632021852
Reply with quote  #2

1632021852
Report to moderator
1632021852
Hero Member
*
Offline Offline

Posts: 1632021852

View Profile Personal Message (Offline)

Ignore
1632021852
Reply with quote  #2

1632021852
Report to moderator
j2002ba2
Full Member
***
Offline Offline

Activity: 142
Merit: 139


View Profile
May 30, 2021, 01:54:30 PM
 #2


Taproot is upgradable itself. From the announcement https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2019-May/016914.html

Quote
* Extensibility through leaf versions, OP_SUCCESS opcodes, and upgradable pubkey types.

Coding Enthusiast
Legendary
*
Offline Offline

Activity: 985
Merit: 1990


Bitcoin and C♯ Enthusiast


View Profile WWW
May 30, 2021, 02:34:26 PM
 #3

But isn't that about the "spending" script put in the witness not the pubkey script where the program is?

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.12.1)Ann-git
Denovo(0.1.0)Ann-git
Bitcoin.Net(0.14.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.11.0)Ann-git
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 3542
Merit: 5622



View Profile
May 30, 2021, 04:17:46 PM
 #4

It just leaves more of the witness V1 space open for other usages that have different sizes.  No need to needlessly close off extensibility.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!