Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: CodesInChaos on July 06, 2012, 01:03:25 PM



Title: Purpose of IsStandard
Post by: CodesInChaos on July 06, 2012, 01:03:25 PM
My understanding of `IsStandard` is that non standard transactions:

* are considered valid when they're part of the block-chain.
* don't get relayed, and many miners won't mine them.

See https://en.bitcoin.it/wiki/Nonstandard_block

This means that clients must be able to handle non standard blocks correctly, and bugs in the handling of non standard transactions are still problematic. So see no security gain, and it doesn't simplify clients either.

Quote from: Gavin
You're right, I think even without blockexplorer Satoshi would've added the IsStandard() check.  There were a series of "oops, didn't think of that" moments that pushed him to disable a bunch, tighten up some requirements on existing opcodes, and add IsStandard().

In general, I believe in "whitelisting" instead of "blacklisting" to try to prevent harm. Enable functionality that you can prove (or convince yourself beyond a reasonable doubt) will not cause problems. I'm strongly influenced from watching web content systems that fail repeatedly trying to detect malicious HTML or CSS.
https://bitcointalk.org/index.php?topic=38932.msg476436#msg476436
I don't understand this quote. Since those block can and do occasionally occur in the blockchain, what is the security gain he's talking about?

So what's the purpose of `IsStandard`? It hinders innovation at no gain I can see.


Title: Re: Purpose of IsStandard
Post by: DeathAndTaxes on July 06, 2012, 01:46:52 PM
There is a reason that the quote function creates a back link.  Context would be useful.

The network "could" probably operate just fine without the IsStandard check BUT IsStandard is a sanity check of sort.  Bitcoin is complex, very complex and the number of people who understand it completely is probably less than ten (I would argue it is zero).  Bugs and unanticipated side effects are rare but do happen.  

IsStandard provides the ability to unit test at least "standard transactions" (a definition which is continually evolving).  If a non-standard transaction can be clearly defined and gains popularity it can be added to the IsStandard check in future versions.  

The purpose of not relaying standard transactions is to limit the effect of unpatched clients on the network.  Pools, miners, major exchanges/merchants/service providers, and developers tend to be good at upgrading to patch vulnerabilities.  Many "casual users" tend to be very bad (look at the version breakdown charts if you need proof).  By making default action to not relay non-standard transactions the threat from these unpatched nodes is reduced.

Eventually IsStandard will likely go away but I don't see any rush.  Bitcoin is BETA v0.6.x right now.  Having sanity checks in place is a good idea.  The codebase is still very young and portions of it cumbersome which makes producing bug free updates more difficult.


Title: Re: Purpose of IsStandard
Post by: CodesInChaos on July 06, 2012, 01:56:24 PM
I can't hit quote on threads I can't post in, so I used copy&paste for quoting. I've added a link.

My point is that the sanity check is at a point where it doesn't really help. Clients will receive non standard transactions once they're in the block-chain. So I don't see how IsStandard protects them from bugs in handling non-standard transactions.


Title: Re: Purpose of IsStandard
Post by: davout on July 06, 2012, 07:35:12 PM
There is a reason that the quote function creates a back link.  Context would be useful.

[...]

Eventually IsStandard will likely go away but I don't see any rush.  Bitcoin is BETA v0.6.x right now.  Having sanity checks in place is a good idea.  The codebase is still very young and portions of it cumbersome which makes producing bug free updates more difficult.
Wrong.

IsStandard is not a sanity check, it's a DOS protection.
A transaction is either valid or not, it has nothing to do with being "standard" in the IsStandard check semantics.


Title: Re: Purpose of IsStandard
Post by: Mike Hearn on July 11, 2012, 08:58:13 AM
It raises the difficulty of doing things like flooding the network with ultra-expensive transactions and hitting other weird unexpected edge cases. It's not the case that the only bugs you need to consider are "see tx in block -> crash".


Title: Re: Purpose of IsStandard
Post by: Sergio_Demian_Lerner on July 11, 2012, 03:28:01 PM
When I analyzed and found the DoS vulnerabilities in 0.6.2, I remember having also found potential DoS vectors that were prevented by the IsStandard() check. The attack surface is a lot greater if the check is absent, so I think the check is completely necessary right now.