Commit 0fdba130 authored by Mark Lundeberg's avatar Mark Lundeberg

remove effect of SCRIPT_ENABLE_SCHNORR flag

Summary:
Originally, the SCRIPT_ENABLE_SCHNORR flag was added first without any
effect, then later diffs put in the functionality. This Diff removes the
effect of the SCRIPT_ENABLE_SCHNORR flag, but keeps the flag around.
Some tests have to be removed accordingly since they were specifically
testing flag-off behaviour that is no longer true.

(effectively this is a backing-out of D2455 and D2469)

Depends on D3253

Test Plan:
`make check`
`test_runner.py --extended`
[x] IBD with -checkpoints=0 and -assumevalid=0 on testnet
[x] IBD with -checkpoints=0 and -assumevalid=0 on mainnet

Reviewers: deadalnix, Mengerian, #bitcoin_abc

Reviewed By: deadalnix, Mengerian, #bitcoin_abc

Subscribers: jasonbcox

Maniphest Tasks: T653

Differential Revision: https://reviews.bitcoinabc.org/D3331
parent fbcfe01e
......@@ -1462,7 +1462,7 @@ bool BaseSignatureChecker::VerifySignature(const std::vector<uint8_t> &vchSig,
const CPubKey &pubkey,
const uint256 &sighash,
uint32_t flags) const {
if ((flags & SCRIPT_ENABLE_SCHNORR) && (vchSig.size() == 64)) {
if (vchSig.size() == 64) {
return pubkey.VerifySchnorr(sighash, vchSig);
} else {
return pubkey.VerifyECDSA(sighash, vchSig);
......
......@@ -156,9 +156,8 @@ static bool IsValidDERSignatureEncoding(const slicedvaltype &sig) {
static bool CheckRawECDSASignatureEncoding(const slicedvaltype &sig,
uint32_t flags,
ScriptError *serror) {
if ((flags & SCRIPT_ENABLE_SCHNORR) && (sig.size() == 64)) {
// In an ECDSA-only context, 64-byte signatures are banned when
// Schnorr flag set.
if (sig.size() == 64) {
// In an ECDSA-only context, 64-byte signatures are forbidden.
return set_error(serror, SCRIPT_ERR_SIG_BADLENGTH);
}
if ((flags & (SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_LOW_S |
......@@ -176,9 +175,9 @@ static bool CheckRawECDSASignatureEncoding(const slicedvaltype &sig,
static bool CheckRawSignatureEncoding(const slicedvaltype &sig, uint32_t flags,
ScriptError *serror) {
if ((flags & SCRIPT_ENABLE_SCHNORR) && (sig.size() == 64)) {
if (sig.size() == 64) {
// In a generic-signature context, 64-byte signatures are interpreted
// as Schnorr signatures (always correctly encoded) when flag set.
// as Schnorr signatures (always correctly encoded).
return true;
}
return CheckRawECDSASignatureEncoding(sig, flags, serror);
......
......@@ -1580,21 +1580,15 @@
["0x40 0x303e021d4444444444444444444444444444444444444444444444444444444444021d4444444444444444444444444444444444444444444444444444444444", "0 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKDATASIG NOT", "", "OK"],
["0x41 0x303e021d4444444444444444444444444444444444444444444444444444444444021d444444444444444444444444444444444444444444444444444444444401", " 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKSIG NOT", "SCHNORR", "OK"],
["0x40 0x303e021d4444444444444444444444444444444444444444444444444444444444021d4444444444444444444444444444444444444444444444444444444444", "0 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKDATASIG NOT", "SCHNORR", "OK"],
["0 0x41 0x303e021d4444444444444444444444444444444444444444444444444444444444021d444444444444444444444444444444444444444444444444444444444401", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "", "OK"],
["0 0x41 0x303e021d4444444444444444444444444444444444444444444444444444444444021d444444444444444444444444444444444444444444444444444444444401", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "STRICTENC", "OK"],
["0 0x41 0x303e021d4444444444444444444444444444444444444444444444444444444444021d444444444444444444444444444444444444444444444444444444444401", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "SCHNORR", "SIG_BADLENGTH"],
["0 0x41 0x303e021d4444444444444444444444444444444444444444444444444444444444021d444444444444444444444444444444444444444444444444444444444401", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "SCHNORR,STRICTENC,NULLFAIL", "SIG_BADLENGTH"],
["0 0x40 0x303d021d4444444444444444444444444444444444444444444444444444444444021c4444444444444444444444444444444444444444444444444444444401", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "SCHNORR", "OK"],
["0 0x42 0x303f021d4444444444444444444444444444444444444444444444444444444444021e44444444444444444444444444444444444444444444444444444444444401", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "SCHNORR", "OK"],
["0x41 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKSIG NOT", "", "OK"],
["0x41 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKSIG NOT", "STRICTENC", "SIG_DER"],
["0x41 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKSIG NOT", "STRICTENC,SCHNORR", "OK"],
["0x40 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "0 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKDATASIG NOT", "", "OK"],
["0x40 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "0 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKDATASIG NOT", "STRICTENC", "SIG_DER"],
["0x40 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "0 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 CHECKDATASIG NOT", "STRICTENC,SCHNORR", "OK"],
["0 0x41 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "", "OK"],
["0 0x41 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "STRICTENC", "SIG_DER"],
["0 0x41 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "STRICTENC,SCHNORR", "SIG_BADLENGTH"],
["0 0x41 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "1 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 1 CHECKMULTISIG NOT", "STRICTENC,NULLFAIL,SCHNORR", "SIG_BADLENGTH"],
......@@ -2687,13 +2681,6 @@
"PUBKEYTYPE",
"CHECKDATASIGVERIFY with invalid hybrid pubkey"
],
[
"0x41 0x0df4be7f5fe74b2855b92082720e889038e15d8d747334fa3f300ef4ab1db1eea56aa83d1d60809ff6703791736be87cfb6cbc5c4036aeed3b4ea4e6dab3509001",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG",
"",
"EVAL_FALSE",
"CHECKSIG Schnorr w/ neither STRICTENC,SCHNORR"
],
[
"0x47 0x3044022022127048516d473153d1f74e46e828496776752e3255f672f760a41e83f54e6f0220502956b739ed82aad916dc4a73e1fd55d02aad514b5211f1ba7d0dadf53c637901",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG",
......@@ -2715,13 +2702,6 @@
"OK",
"CHECKSIG ECDSA w/ SCHNORR"
],
[
"0x41 0x0df4be7f5fe74b2855b92082720e889038e15d8d747334fa3f300ef4ab1db1eea56aa83d1d60809ff6703791736be87cfb6cbc5c4036aeed3b4ea4e6dab3509001",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG",
"STRICTENC",
"SIG_DER",
"CHECKSIG Schnorr w/ STRICTENC"
],
[
"0x47 0x3044022022127048516d473153d1f74e46e828496776752e3255f672f760a41e83f54e6f0220502956b739ed82aad916dc4a73e1fd55d02aad514b5211f1ba7d0dadf53c637901",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG",
......@@ -2757,13 +2737,6 @@
"OK",
"CHECKSIG Schnorr mismatched key"
],
[
"0x41 0x8d37e95e36718d7fbc8ffd63b0b4ebb89dd5fb683510a95345869399f810a8724a00e5cbbb2190205ffabac601d80bf110a67013521b7a7c02b2a51e07d723eb01",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIGVERIFY 1",
"",
"CHECKSIGVERIFY",
"CHECKSIGVERIFY Schnorr w/ neither STRICTENC,SCHNORR"
],
[
"0x47 0x304402205d5a925acf881167da7850d838cd4f73d077d08aacf9d2885d10b7850c5a828602201f42383e317ec427dbd71f3a6031a0ff27e431b7089fbc80ebea31b5f8949be601",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIGVERIFY 1",
......@@ -2785,13 +2758,6 @@
"OK",
"CHECKSIGVERIFY ECDSA w/ SCHNORR"
],
[
"0x41 0x8d37e95e36718d7fbc8ffd63b0b4ebb89dd5fb683510a95345869399f810a8724a00e5cbbb2190205ffabac601d80bf110a67013521b7a7c02b2a51e07d723eb01",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIGVERIFY 1",
"STRICTENC",
"SIG_DER",
"CHECKSIGVERIFY Schnorr w/ STRICTENC"
],
[
"0x47 0x304402205d5a925acf881167da7850d838cd4f73d077d08aacf9d2885d10b7850c5a828602201f42383e317ec427dbd71f3a6031a0ff27e431b7089fbc80ebea31b5f8949be601",
"0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIGVERIFY 1",
......@@ -2827,13 +2793,6 @@
"CHECKSIGVERIFY",
"CHECKSIGVERIFY Schnorr mismatched key"
],
[
"0x40 0x9db0671f61f1fafa84aaab76ad2e070b27cf9ae85338bafc0b947ac9ad8c56ff7b24aa76c95ad86bb13cbff314742dbe1f545869d1a28efa54b411ccd37717e5",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIG",
"",
"EVAL_FALSE",
"CHECKDATASIG Schnorr w/ neither STRICTENC,SCHNORR"
],
[
"0x46 0x304402205ffea7d9fa4e0ce8058c96edfb721aaf2840912080ac4ae86a92d9462e69fde302203567149cb9c8c343523a87d7a64be304983899d2e2c6f267a7136c48ff21908d",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIG",
......@@ -2855,13 +2814,6 @@
"OK",
"CHECKDATASIG ECDSA w/ SCHNORR"
],
[
"0x40 0x9db0671f61f1fafa84aaab76ad2e070b27cf9ae85338bafc0b947ac9ad8c56ff7b24aa76c95ad86bb13cbff314742dbe1f545869d1a28efa54b411ccd37717e5",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIG",
"STRICTENC",
"SIG_DER",
"CHECKDATASIG Schnorr w/ STRICTENC"
],
[
"0x46 0x304402205ffea7d9fa4e0ce8058c96edfb721aaf2840912080ac4ae86a92d9462e69fde302203567149cb9c8c343523a87d7a64be304983899d2e2c6f267a7136c48ff21908d",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIG",
......@@ -2911,13 +2863,6 @@
"OK",
"CHECKDATASIG Schnorr wrong message"
],
[
"0x40 0x9db0671f61f1fafa84aaab76ad2e070b27cf9ae85338bafc0b947ac9ad8c56ff7b24aa76c95ad86bb13cbff314742dbe1f545869d1a28efa54b411ccd37717e5",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIGVERIFY 1",
"",
"CHECKDATASIGVERIFY",
"CHECKDATASIGVERIFY Schnorr w/ neither STRICTENC,SCHNORR"
],
[
"0x46 0x304402205ffea7d9fa4e0ce8058c96edfb721aaf2840912080ac4ae86a92d9462e69fde302203567149cb9c8c343523a87d7a64be304983899d2e2c6f267a7136c48ff21908d",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIGVERIFY 1",
......@@ -2939,13 +2884,6 @@
"OK",
"CHECKDATASIGVERIFY ECDSA w/ SCHNORR"
],
[
"0x40 0x9db0671f61f1fafa84aaab76ad2e070b27cf9ae85338bafc0b947ac9ad8c56ff7b24aa76c95ad86bb13cbff314742dbe1f545869d1a28efa54b411ccd37717e5",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIGVERIFY 1",
"STRICTENC",
"SIG_DER",
"CHECKDATASIGVERIFY Schnorr w/ STRICTENC"
],
[
"0x46 0x304402205ffea7d9fa4e0ce8058c96edfb721aaf2840912080ac4ae86a92d9462e69fde302203567149cb9c8c343523a87d7a64be304983899d2e2c6f267a7136c48ff21908d",
"0 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKDATASIGVERIFY 1",
......@@ -2995,13 +2933,6 @@
"CHECKDATASIGVERIFY",
"CHECKDATASIGVERIFY Schnorr wrong message"
],
[
"0 0x41 0x105e4fed395e64ca013ac1ce020ef69b9990a577fe4b74648faafb69e499f76dd53d5c64aa866924361dd3aadde9b7184bbcb4f79520396c9ed17c4d8489a59701",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIG",
"",
"EVAL_FALSE",
"CHECKMULTISIG Schnorr w/ neither STRICTENC,SCHNORR"
],
[
"0 0x47 0x304402204d0106d6babcaca95277692eaa566bdc89d9f44b1106c18423345c7e9ac40d79022033a3750421038d15f15101ffdca1147a0eb980bb1b809280cb5368c50c10c42c01",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIG",
......@@ -3023,13 +2954,6 @@
"OK",
"CHECKMULTISIG ECDSA w/ SCHNORR"
],
[
"0 0x41 0x105e4fed395e64ca013ac1ce020ef69b9990a577fe4b74648faafb69e499f76dd53d5c64aa866924361dd3aadde9b7184bbcb4f79520396c9ed17c4d8489a59701",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIG",
"STRICTENC",
"SIG_DER",
"CHECKMULTISIG Schnorr w/ STRICTENC"
],
[
"0 0x47 0x304402204d0106d6babcaca95277692eaa566bdc89d9f44b1106c18423345c7e9ac40d79022033a3750421038d15f15101ffdca1147a0eb980bb1b809280cb5368c50c10c42c01",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIG",
......@@ -3051,13 +2975,6 @@
"OK",
"CHECKMULTISIG ECDSA w/ STRICTENC,SCHNORR"
],
[
"0 0x41 0x833682d4f60cc916a22a2c263e658fa662c49badb1e2a8c6208987bf99b1abd740498371480069e7a7a6e7471bf78c27bd9a1fd04fb212a92017346250ac187b01 0x41 0xea4a8d20562a950f4695dc24804565482e9fa111704886179d0c348f2b8a15fe691a305cd599c59c131677146661d5b98cb935330989a85f33afc70d0a21add101 0x41 0xce9011d76a4df05d6280b2382b4d91490dbec7c3e72dc826be1fc9b4718f627955190745cac96521ea46d6d324c7376461e225310e6cd605b9f266d170769b7901",
"3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG",
"",
"EVAL_FALSE",
"Schnorr 3-of-3 without SCHNORR flag"
],
[
"0 0x41 0x833682d4f60cc916a22a2c263e658fa662c49badb1e2a8c6208987bf99b1abd740498371480069e7a7a6e7471bf78c27bd9a1fd04fb212a92017346250ac187b01 0x41 0xea4a8d20562a950f4695dc24804565482e9fa111704886179d0c348f2b8a15fe691a305cd599c59c131677146661d5b98cb935330989a85f33afc70d0a21add101 0x41 0xce9011d76a4df05d6280b2382b4d91490dbec7c3e72dc826be1fc9b4718f627955190745cac96521ea46d6d324c7376461e225310e6cd605b9f266d170769b7901",
"3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG",
......@@ -3072,13 +2989,6 @@
"SIG_BADLENGTH",
"Schnorr-ECDSA-mixed 3-of-3 with SCHNORR flag"
],
[
"0 0x41 0x17fa4dd3e62694cc7816d32b73d5646ea768072aea4926a09e159e5f57be8fd6523800b259fe2a12e27aa29a3719f19e9e4b99d7f8e465a6f19454f914ccb3ec01",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIGVERIFY 1",
"",
"CHECKMULTISIGVERIFY",
"CHECKMULTISIGVERIFY Schnorr w/ neither STRICTENC,SCHNORR"
],
[
"0 0x47 0x3044022050635b0b57b07eec8ebba4f5cad9ede25ada7ca1645367dcce8d4412290f00e4022037cf466f1498830d5476cd52e84ce4fd6dc4c7d70f985a6e9ff68a034faa5ea101",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIGVERIFY 1",
......@@ -3100,13 +3010,6 @@
"OK",
"CHECKMULTISIGVERIFY ECDSA w/ SCHNORR"
],
[
"0 0x41 0x17fa4dd3e62694cc7816d32b73d5646ea768072aea4926a09e159e5f57be8fd6523800b259fe2a12e27aa29a3719f19e9e4b99d7f8e465a6f19454f914ccb3ec01",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIGVERIFY 1",
"STRICTENC",
"SIG_DER",
"CHECKMULTISIGVERIFY Schnorr w/ STRICTENC"
],
[
"0 0x47 0x3044022050635b0b57b07eec8ebba4f5cad9ede25ada7ca1645367dcce8d4412290f00e4022037cf466f1498830d5476cd52e84ce4fd6dc4c7d70f985a6e9ff68a034faa5ea101",
"1 0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 1 CHECKMULTISIGVERIFY 1",
......@@ -3436,13 +3339,6 @@
"OK",
"recovered-pubkey CHECKSIG with 63-byte DER; schnorrflag"
],
[
"0x41 0x303e021d776879206d757374207765207375666665722077697468206563647361021d212121212121212121212121212121212121212121212121212121212101 0x21 0x03f5d556a48a11a677f1a8eb0771f6cd11b1bcf378478c586d54f18634521b833e",
"CHECKSIG",
"STRICTENC",
"OK",
"recovered-pubkey CHECKSIG with 64-byte DER"
],
[
"0x41 0x303e021d776879206d757374207765207375666665722077697468206563647361021d212121212121212121212121212121212121212121212121212121212101 0x21 0x03f5d556a48a11a677f1a8eb0771f6cd11b1bcf378478c586d54f18634521b833e",
"CHECKSIG",
......@@ -3464,13 +3360,6 @@
"OK",
"recovered-pubkey CHECKSIG with 65-byte DER; schnorrflag"
],
[
"0 0x41 0x303e021d776879206d757374207765207375666665722077697468206563647361021d212121212121212121212121212121212121212121212121212121212101 0x21 0x036cd1f91735dda2d984cfbc17ab0e9e7d754d7e4e1fceb691751cdd5c26b0aecc",
"1 SWAP 1 CHECKMULTISIG",
"STRICTENC",
"OK",
"recovered-pubkey CHECKMULTISIG with 64-byte DER"
],
[
"0 0x41 0x303e021d776879206d757374207765207375666665722077697468206563647361021d212121212121212121212121212121212121212121212121212121212101 0x21 0x036cd1f91735dda2d984cfbc17ab0e9e7d754d7e4e1fceb691751cdd5c26b0aecc",
"1 SWAP 1 CHECKMULTISIG",
......
......@@ -105,10 +105,6 @@ BOOST_AUTO_TEST_CASE(opcodes_random_flags) {
uint32_t flags = lcg.next();
const bool hasForkId = (flags & SCRIPT_ENABLE_SIGHASH_FORKID) != 0;
const bool hasSchnorr = (flags & SCRIPT_ENABLE_SCHNORR) != 0;
const bool hasStricts =
(flags & (SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_LOW_S |
SCRIPT_VERIFY_STRICTENC)) != 0;
const bool hasNullFail = (flags & SCRIPT_VERIFY_NULLFAIL) != 0;
// Prepare 65-byte transaction sigs with right hashtype byte.
......@@ -119,16 +115,7 @@ BOOST_AUTO_TEST_CASE(opcodes_random_flags) {
// Test CHECKSIG & CHECKDATASIG with he non-DER sig, which can fail from
// encoding, otherwise upon verification.
if (hasStricts && !hasSchnorr) {
CheckError(flags, {Zero64_with_hashtype, pubkeyC}, scriptCHECKSIG,
SCRIPT_ERR_SIG_DER);
CheckError(flags, {Zero64_with_hashtype, pubkeyC},
scriptCHECKSIGVERIFY, SCRIPT_ERR_SIG_DER);
CheckError(flags, {Zero64, {}, pubkeyC}, scriptCHECKDATASIG,
SCRIPT_ERR_SIG_DER);
CheckError(flags, {Zero64, {}, pubkeyC}, scriptCHECKDATASIGVERIFY,
SCRIPT_ERR_SIG_DER);
} else if (hasNullFail) {
if (hasNullFail) {
CheckError(flags, {Zero64_with_hashtype, pubkeyC}, scriptCHECKSIG,
SCRIPT_ERR_SIG_NULLFAIL);
CheckError(flags, {Zero64_with_hashtype, pubkeyC},
......@@ -169,52 +156,15 @@ BOOST_AUTO_TEST_CASE(opcodes_random_flags) {
}
// test OP_CHECKMULTISIG/VERIFY
if (hasSchnorr) {
// When Schnorr flag is on, we always fail with BADLENGTH no matter
// what.
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, SCRIPT_ERR_SIG_BADLENGTH);
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY, SCRIPT_ERR_SIG_BADLENGTH);
CheckError(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, SCRIPT_ERR_SIG_BADLENGTH);
CheckError(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY, SCRIPT_ERR_SIG_BADLENGTH);
} else {
// Otherwise, the failure depends on signature content.
// The non-DER sig can fail from encoding, otherwise upon
// verification.
if (hasStricts) {
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, SCRIPT_ERR_SIG_DER);
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY, SCRIPT_ERR_SIG_DER);
} else if (hasNullFail) {
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, SCRIPT_ERR_SIG_NULLFAIL);
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY, SCRIPT_ERR_SIG_NULLFAIL);
} else {
CheckPass(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, {});
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY,
SCRIPT_ERR_CHECKMULTISIGVERIFY);
}
// The DER sig fails upon verification.
if (hasNullFail) {
CheckError(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, SCRIPT_ERR_SIG_NULLFAIL);
CheckError(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY, SCRIPT_ERR_SIG_NULLFAIL);
} else {
CheckPass(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, {});
CheckError(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY,
SCRIPT_ERR_CHECKMULTISIGVERIFY);
}
}
// We fail with BADLENGTH no matter what.
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, SCRIPT_ERR_SIG_BADLENGTH);
CheckError(flags, {{}, Zero64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY, SCRIPT_ERR_SIG_BADLENGTH);
CheckError(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIG, SCRIPT_ERR_SIG_BADLENGTH);
CheckError(flags, {{}, DER64_with_hashtype, {1}, pubkeyC, {1}},
scriptCHECKMULTISIGVERIFY, SCRIPT_ERR_SIG_BADLENGTH);
}
}
......
......@@ -1647,11 +1647,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
// - test with different key / mismatching key
// CHECKSIG and Schnorr
tests.push_back(
TestBuilder(CScript() << ToByteVector(keys.pubkey0) << OP_CHECKSIG,
"CHECKSIG Schnorr w/ neither STRICTENC,SCHNORR", 0)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_EVAL_FALSE));
tests.push_back(
TestBuilder(CScript() << ToByteVector(keys.pubkey0) << OP_CHECKSIG,
"CHECKSIG ECDSA w/ neither STRICTENC,SCHNORR", 0)
......@@ -1664,11 +1659,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
TestBuilder(CScript() << ToByteVector(keys.pubkey0) << OP_CHECKSIG,
"CHECKSIG ECDSA w/ SCHNORR", SCRIPT_ENABLE_SCHNORR)
.PushSigECDSA(keys.key0));
tests.push_back(
TestBuilder(CScript() << ToByteVector(keys.pubkey0) << OP_CHECKSIG,
"CHECKSIG Schnorr w/ STRICTENC", SCRIPT_VERIFY_STRICTENC)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_SIG_DER));
tests.push_back(
TestBuilder(CScript() << ToByteVector(keys.pubkey0) << OP_CHECKSIG,
"CHECKSIG ECDSA w/ STRICTENC", SCRIPT_VERIFY_STRICTENC)
......@@ -1695,12 +1685,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
.PushSigSchnorr(keys.key1));
// CHECKSIGVERIFY and Schnorr
tests.push_back(
TestBuilder(CScript() << ToByteVector(keys.pubkey0) << OP_CHECKSIGVERIFY
<< OP_1,
"CHECKSIGVERIFY Schnorr w/ neither STRICTENC,SCHNORR", 0)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_CHECKSIGVERIFY));
tests.push_back(
TestBuilder(CScript() << ToByteVector(keys.pubkey0) << OP_CHECKSIGVERIFY
<< OP_1,
......@@ -1716,12 +1700,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
"CHECKSIGVERIFY ECDSA w/ SCHNORR",
SCRIPT_ENABLE_SCHNORR)
.PushSigECDSA(keys.key0));
tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0)
<< OP_CHECKSIGVERIFY << OP_1,
"CHECKSIGVERIFY Schnorr w/ STRICTENC",
SCRIPT_VERIFY_STRICTENC)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_SIG_DER));
tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0)
<< OP_CHECKSIGVERIFY << OP_1,
"CHECKSIGVERIFY ECDSA w/ STRICTENC",
......@@ -1750,12 +1728,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
.ScriptError(SCRIPT_ERR_CHECKSIGVERIFY));
// CHECKDATASIG and Schnorr
tests.push_back(
TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIG,
"CHECKDATASIG Schnorr w/ neither STRICTENC,SCHNORR", 0)
.PushDataSigSchnorr(keys.key0, {})
.ScriptError(SCRIPT_ERR_EVAL_FALSE));
tests.push_back(
TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIG,
......@@ -1771,12 +1743,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
"CHECKDATASIG ECDSA w/ SCHNORR",
SCRIPT_ENABLE_SCHNORR)
.PushDataSigECDSA(keys.key0, {}));
tests.push_back(TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIG,
"CHECKDATASIG Schnorr w/ STRICTENC",
SCRIPT_VERIFY_STRICTENC)
.PushDataSigSchnorr(keys.key0, {})
.ScriptError(SCRIPT_ERR_SIG_DER));
tests.push_back(TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIG,
"CHECKDATASIG ECDSA w/ STRICTENC",
......@@ -1814,13 +1780,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
.PushDataSigSchnorr(keys.key1, {1}));
// CHECKDATASIGVERIFY and Schnorr
tests.push_back(
TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIGVERIFY << OP_1,
"CHECKDATASIGVERIFY Schnorr w/ neither STRICTENC,SCHNORR",
0)
.PushDataSigSchnorr(keys.key0, {})
.ScriptError(SCRIPT_ERR_CHECKDATASIGVERIFY));
tests.push_back(
TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIGVERIFY << OP_1,
......@@ -1836,12 +1795,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
"CHECKDATASIGVERIFY ECDSA w/ SCHNORR",
SCRIPT_ENABLE_SCHNORR)
.PushDataSigECDSA(keys.key0, {}));
tests.push_back(TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIGVERIFY << OP_1,
"CHECKDATASIGVERIFY Schnorr w/ STRICTENC",
SCRIPT_VERIFY_STRICTENC)
.PushDataSigSchnorr(keys.key0, {})
.ScriptError(SCRIPT_ERR_SIG_DER));
tests.push_back(TestBuilder(CScript() << OP_0 << ToByteVector(keys.pubkey0)
<< OP_CHECKDATASIGVERIFY << OP_1,
"CHECKDATASIGVERIFY ECDSA w/ STRICTENC",
......@@ -1882,13 +1835,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
.ScriptError(SCRIPT_ERR_CHECKDATASIGVERIFY));
// CHECKMULTISIG 1-of-1 and Schnorr
tests.push_back(
TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0) << OP_1
<< OP_CHECKMULTISIG,
"CHECKMULTISIG Schnorr w/ neither STRICTENC,SCHNORR", 0)
.Num(0)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_EVAL_FALSE));
tests.push_back(
TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0) << OP_1
<< OP_CHECKMULTISIG,
......@@ -1908,13 +1854,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
SCRIPT_ENABLE_SCHNORR)
.Num(0)
.PushSigECDSA(keys.key0));
tests.push_back(TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0)
<< OP_1 << OP_CHECKMULTISIG,
"CHECKMULTISIG Schnorr w/ STRICTENC",
SCRIPT_VERIFY_STRICTENC)
.Num(0)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_SIG_DER));
tests.push_back(TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0)
<< OP_1 << OP_CHECKMULTISIG,
"CHECKMULTISIG ECDSA w/ STRICTENC",
......@@ -1936,17 +1875,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
.PushSigECDSA(keys.key0));
// Test multisig with multiple Schnorr signatures
tests.push_back(TestBuilder(CScript() << OP_3 << ToByteVector(keys.pubkey0C)
<< ToByteVector(keys.pubkey1C)
<< ToByteVector(keys.pubkey2C) << OP_3
<< OP_CHECKMULTISIG,
"Schnorr 3-of-3 without SCHNORR flag", 0)
.Num(0)
.PushSigSchnorr(keys.key0)
.PushSigSchnorr(keys.key1)
.PushSigSchnorr(keys.key2)
.ScriptError(SCRIPT_ERR_EVAL_FALSE));
tests.push_back(TestBuilder(CScript() << OP_3 << ToByteVector(keys.pubkey0C)
<< ToByteVector(keys.pubkey1C)
<< ToByteVector(keys.pubkey2C) << OP_3
......@@ -1972,14 +1900,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
.ScriptError(SCRIPT_ERR_SIG_BADLENGTH));
// CHECKMULTISIGVERIFY 1-of-1 and Schnorr
tests.push_back(
TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0) << OP_1
<< OP_CHECKMULTISIGVERIFY << OP_1,
"CHECKMULTISIGVERIFY Schnorr w/ neither STRICTENC,SCHNORR",
0)
.Num(0)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_CHECKMULTISIGVERIFY));
tests.push_back(
TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0) << OP_1
<< OP_CHECKMULTISIGVERIFY << OP_1,
......@@ -2001,14 +1921,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
SCRIPT_ENABLE_SCHNORR)
.Num(0)
.PushSigECDSA(keys.key0));
tests.push_back(TestBuilder(CScript()
<< OP_1 << ToByteVector(keys.pubkey0)
<< OP_1 << OP_CHECKMULTISIGVERIFY << OP_1,
"CHECKMULTISIGVERIFY Schnorr w/ STRICTENC",
SCRIPT_VERIFY_STRICTENC)
.Num(0)
.PushSigSchnorr(keys.key0)
.ScriptError(SCRIPT_ERR_SIG_DER));
tests.push_back(TestBuilder(CScript()
<< OP_1 << ToByteVector(keys.pubkey0)
<< OP_1 << OP_CHECKMULTISIGVERIFY << OP_1,
......@@ -2368,17 +2280,10 @@ BOOST_AUTO_TEST_CASE(script_build) {
.PushECDSARecoveredPubKey(rdata, sdata));
}
{
// 64-byte ECDSA sig works before schnorr flag activation, but
// not after.
// 64-byte ECDSA sig does not work.
std::vector<uint8_t> rdata = ParseHex(
"776879206d757374207765207375666665722077697468206563647361");
std::vector<uint8_t> sdata(58 - rdata.size(), 33);
tests.push_back(
TestBuilder(CScript() << OP_CHECKSIG,
"recovered-pubkey CHECKSIG with 64-byte DER",
SCRIPT_VERIFY_STRICTENC)
.PushECDSASigFromParts(rdata, sdata)
.PushECDSARecoveredPubKey(rdata, sdata));
tests.push_back(
TestBuilder(
CScript() << OP_CHECKSIG,
......@@ -2411,14 +2316,6 @@ BOOST_AUTO_TEST_CASE(script_build) {
std::vector<uint8_t> rdata = ParseHex(
"776879206d757374207765207375666665722077697468206563647361");
std::vector<uint8_t> sdata(58 - rdata.size(), 33);
tests.push_back(
TestBuilder(CScript()
<< OP_1 << OP_SWAP << OP_1 << OP_CHECKMULTISIG,
"recovered-pubkey CHECKMULTISIG with 64-byte DER",
SCRIPT_VERIFY_STRICTENC)
.Num(0)
.PushECDSASigFromParts(rdata, sdata)
.PushECDSARecoveredPubKey(rdata, sdata));
tests.push_back(
TestBuilder(
CScript() << OP_1 << OP_SWAP << OP_1 << OP_CHECKMULTISIG,
......
......@@ -395,10 +395,6 @@ BOOST_AUTO_TEST_CASE(checkschnorr_test) {
uint32_t flags = lcg.next();
const bool hasForkId = (flags & SCRIPT_ENABLE_SIGHASH_FORKID) != 0;
const bool hasSchnorr = (flags & SCRIPT_ENABLE_SCHNORR) != 0;
const bool hasStricts =
(flags & (SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_LOW_S |
SCRIPT_VERIFY_STRICTENC)) != 0;
ScriptError err = SCRIPT_ERR_OK;
valtype DER65_hb =
......@@ -408,39 +404,15 @@ BOOST_AUTO_TEST_CASE(checkschnorr_test) {
BOOST_CHECK(CheckDataSignatureEncoding(DER64, flags, &err));
BOOST_CHECK(CheckTransactionSignatureEncoding(DER65_hb, flags, &err));
BOOST_CHECK_EQUAL(
!CheckTransactionECDSASignatureEncoding(DER65_hb, flags, &err),
hasSchnorr);
if (hasSchnorr) {
BOOST_CHECK_EQUAL(err, SCRIPT_ERR_SIG_BADLENGTH);
}
BOOST_CHECK(
!CheckTransactionECDSASignatureEncoding(DER65_hb, flags, &err));
BOOST_CHECK_EQUAL(err, SCRIPT_ERR_SIG_BADLENGTH);
if (hasSchnorr) {
BOOST_CHECK(CheckDataSignatureEncoding(Zero64, flags, &err));
BOOST_CHECK(
CheckTransactionSignatureEncoding(Zero65_hb, flags, &err));
BOOST_CHECK(!CheckTransactionECDSASignatureEncoding(Zero65_hb,
flags, &err));
BOOST_CHECK_EQUAL(err, SCRIPT_ERR_SIG_BADLENGTH);
} else {
BOOST_CHECK_EQUAL(!CheckDataSignatureEncoding(Zero64, flags, &err),
hasStricts);
if (hasStricts) {