Closed sirdeggen closed 1 year ago
Patch coverage: 100.00%
and project coverage change: +0.01%
:tada:
Comparison is base (
29189f4
) 80.61% compared to head (55d53b3
) 80.63%. Report is 1 commits behind head on master.:exclamation: Current head 55d53b3 differs from pull request most recent head 9ef4e75. Consider uploading reports for the commit 9ef4e75 to get more accurate results
:exclamation: 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.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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:
- If the
script
contains anyOP_CODESEPARATOR
, thescriptCode
is thescript
but removing everything up to
and including the last executedOP_CODESEPARATOR
- before the signature checking opcode being executed [...] Notes:
- Contrary to the original algorithm, this one does not use
FindAndDelete
to remove the signature from the script.
Therefore I would recommend that we keep the code as is within this PR.
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.