-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OP_CODESEPARATOR bug fix #164
Conversation
Off by one bug, the subscript does not include the opcode separator itself, so the slice of the script should be from just after the op code separator - not before. This took about 16 hours to find 😫 Signed-off-by: Darren Kellenschwiler <deggen@kschw.com>
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #164 +/- ##
==========================================
+ Coverage 80.61% 80.63% +0.01%
==========================================
Files 38 38
Lines 4112 4115 +3
==========================================
+ Hits 3315 3318 +3
Misses 546 546
Partials 251 251
☔ View full report in Codecov by Sentry. |
Noticing this block here which conditionally removes the OPCODESEPARATOR afterwards but is conditional on NON-forkID sighashes: // Remove the signature since there is no way for a signature
// to sign itself.
if !t.hasFlag(scriptflag.EnableSighashForkID) || !shf.Has(sighash.ForkID) {
subScript = subScript.removeOpcodeByData(fullSigBytes)
subScript = subScript.removeOpcode(bscript.OpCODESEPARATOR)
} |
We find in the ABC documentation:
Therefore I would recommend that we keep the code as is within this PR. |
…arator-test BPAAS-875: unit test for failing script evaluation
Signed-off-by: Darren Kellenschwiler <deggen@kschw.com>
This took about 16 hours to find 😫
Problem
The problem is that when using ARC to broadcast transactions, go-bt interpreter is used. Therefore the tx below is rejected because the signature will not validate. This is caused by the preimage being wrong within the interpreter around OP_CODESEPARATOR. It should slice off the previous parts of the script including the OP_CODESEPARATOR itself.
Transactions like this will broadcast via WoC and the nodes accept it, but ARC thinks it invalid.
ARC responds:
Solution
Off by one bug, the subscript does not include the opcode separator itself, so the slice of the script should be from just after the op code separator - not before.