Bitcoin Forum
April 30, 2024, 11:50:17 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Are disabled OpCodes considered invalid or are they treated as NOP?  (Read 1644 times)
DeathAndTaxes (OP)
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
March 20, 2015, 03:59:11 PM
 #1

Are disabled OpCodes considered invalid or are they treated as NOP?  Link to where that is enforced in the code would be appreciated.
1714477817
Hero Member
*
Offline Offline

Posts: 1714477817

View Profile Personal Message (Offline)

Ignore
1714477817
Reply with quote  #2

1714477817
Report to moderator
1714477817
Hero Member
*
Offline Offline

Posts: 1714477817

View Profile Personal Message (Offline)

Ignore
1714477817
Reply with quote  #2

1714477817
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
March 20, 2015, 04:04:05 PM
 #2

Although not the latest source I see this:

Code:
if (opcode == OP_CAT ||
    opcode == OP_SUBSTR ||
    opcode == OP_LEFT ||
    opcode == OP_RIGHT ||
    opcode == OP_INVERT ||
    opcode == OP_AND ||
    opcode == OP_OR ||
    opcode == OP_XOR ||
    opcode == OP_2MUL ||
    opcode == OP_2DIV ||
    opcode == OP_MUL ||
    opcode == OP_DIV ||
    opcode == OP_MOD ||
    opcode == OP_LSHIFT ||
    opcode == OP_RSHIFT)
    return false; // Disabled opcodes.

in EvalScript (so assuming the return value is whether the script is valid then I guess not).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
March 20, 2015, 04:12:11 PM
 #3

The only way to re-enable them is to hard-fork.  At this point their only purpose is to taunt people Smiley.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
DeathAndTaxes (OP)
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
March 20, 2015, 05:29:24 PM
 #4

The only way to re-enable them is to hard-fork.  At this point their only purpose is to taunt people Smiley.

So why not remove them from the code and documentation?  Sure a  hard fork could enable them but it could also enable any other new functionality one could think of.  Why not simplify the code.  I am still bummed that XOR is disabled.  It has a lot of potential uses and no security implications.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
March 20, 2015, 05:32:33 PM
 #5

I am still bummed that XOR is disabled.  It has a lot of potential uses and no security implications.

It does seem strange to disable XOR - was there any reasoning stated for that?

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
cr1776
Legendary
*
Offline Offline

Activity: 4018
Merit: 1299


View Profile
March 20, 2015, 06:07:19 PM
 #6

I am still bummed that XOR is disabled.  It has a lot of potential uses and no security implications.

It does seem strange to disable XOR - was there any reasoning stated for that?


My digest version is that while they seemed to not have security implications, without extensive testing and documentation it was safer to disable them than not.

I think this deals with it a bit:
https://bitcointalk.org/index.php?topic=28861.msg363775#msg363775

And these two threads:

https://bitcointalk.org/index.php?topic=28861.0
https://bitcointalk.org/index.php?topic=37157.0
https://bitcointalk.org/index.php?topic=255110.0

They were just disabled without much information:
https://github.com/bitcoin/bitcoin/commit/4bd188c4383d6e614e18f79dc337fbabe8464c82#script.cpp

gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
March 20, 2015, 07:34:47 PM
 #7

It does seem strange to disable XOR - was there any reasoning stated for that?
It was insecure. Pretty much any of the operations which could allocate memory were.

They're handled in a slightly different way than generic unhandled opcodes, so they can't be completely removed (they are tested even when the machine is not executing due to an untaken branch). But they're 99.99% removed, I suppose the labels could be removed too.

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
March 20, 2015, 07:41:30 PM
 #8

It was insecure. Pretty much any of the operations which could allocate memory were.

XOR could allocate memory?

(that seems odd to me)

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
March 20, 2015, 08:27:16 PM
 #9

XOR could allocate memory?
Yes, the inputs first had to be coerced to the same size before they could be xored.  (I suppose OP_XOR could have been defined as narrowing instead of widening, but it wasn't).
DeathAndTaxes (OP)
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
March 21, 2015, 08:24:24 PM
 #10

XOR could allocate memory?
Yes, the inputs first had to be coerced to the same size before they could be xored.  (I suppose OP_XOR could have been defined as narrowing instead of widening, but it wasn't).

Thanks for the insight gmaxwell.  The simplest solution would have been to require that both values being XORed are the same byte length.  It would be easy to enforce have no edge cases, easy to test, and would have still preserved most use cases.
DeathAndTaxes (OP)
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
March 21, 2015, 08:26:06 PM
 #11

They're handled in a slightly different way than generic unhandled opcodes, so they can't be completely removed (they are tested even when the machine is not executing due to an untaken branch).

Oh cludge.  Really?  I need to take a closer look at the unexecuted branch portion of the script validator then.  That would make it tough to remove them from the code.  One way would be a soft fork tests for any undefined opcode in untaken branch.  Then the disabled ones could be undefined without any change in behavior.
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!