Author

Topic: Extending script and reserved opcodes (Read 1484 times)

legendary
Activity: 1232
Merit: 1094
June 30, 2011, 04:51:13 PM
#9
But why would you have a new opcode if there is already an existing "legacy" sequence of opcode that you can use to emulate it? The new code would either not be able to do something new or it would cause a split. This also smells like vulnerabilities like getting the two split nets to do different things. And as nobody is using scripts anyway this is currently not needed.

The idea is

Old Clients
Legacy code: Accepts
New code: Accepts, but only if in mined blocks

New Clients
Legacy code: Accepts
New code: Accepts if it is valid under old and new rules

If 99% of the nodes are new clients, then splits aren't likely and will correct automatically.

The old client won't incorporate transactions which contain the new code.  This means  that it will never create a bad block according to the new rules.

If a new client creates a block that meets the new rules, the old client will accept the block.

There is no conflict between the 2 and the chain stays unified.

If an intermediate old client was to try to incorporate a script that fails according to the new code, the all the new miners would refuse to accept it.  This fork would last only a short time.  Once the 99% of the process power has generated 2 more blocks, that will be the main chain again.

The key point is that any script which is valid under the new rules is also valid under the old rules.  However, the new nodes will reject some blocks that would have been valid under the old rules.  This is why it is important that they have > 50% of the processing power before the rule is used in general.
member
Activity: 91
Merit: 10
June 30, 2011, 04:08:03 PM
#8
But why would you have a new opcode if there is already an existing "legacy" sequence of opcode that you can use to emulate it? The new code would either not be able to do something new or it would cause a split. This also smells like vulnerabilities like getting the two split nets to do different things. And as nobody is using scripts anyway this is currently not needed.
administrator
Activity: 5222
Merit: 13032
June 30, 2011, 04:01:12 PM
#7
Do you mean the original post, or are their other proposals?

I mean that your method might be an improvement over incrementing the transaction version and doing a "phased rollout" for every script change.
legendary
Activity: 1232
Merit: 1094
June 30, 2011, 02:43:42 PM
#6
I updated the original post slightly.
legendary
Activity: 1232
Merit: 1094
June 30, 2011, 02:26:44 PM
#5
Actually, I think it would work if there was just one OP_OP_ENABLE that takes a list of many opcodes to enable. If the node can't understand any of these opcodes, then it stops here. If it does understand all of the opcodes, it also needs to verify the transaction again as though it doesn't understand them, and this "legacy" verification must also pass.

Sounds good.

The bootstrap needs to be changed slightly.

A script that uses the new protocol will have the following format

Code:
 OP_0 OP_IF  OP_ENDIF

Legacy clients will just process the legacy script.  As far as they are concerned the the rest of the script means the following.

Code:
push false onto the top of the stack

if the top value on the stack is true

 push a byte array onto the stack

endif

New nodes will verify the script as if they were legacy clients and then verify the script as if it was

Code: