From f81796c12abb7bafc2166fa9c87aac73bfc3ae35 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Mon, 31 Jan 2022 20:56:20 +0000 Subject: [PATCH] Coinbase scripts generated by zcashd have an extra OP_0, and nSequence == 0xFFFFFFFF. Also, the height in coinbase needs to match nExpiryHeight. Co-authored-by: Jack Grigg Signed-off-by: Daira Hopwood --- test-vectors/rust/zip_0244.rs | 24 ++++++++++++------------ zcash_test_vectors/transaction.py | 28 +++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/test-vectors/rust/zip_0244.rs b/test-vectors/rust/zip_0244.rs index 0694206..e94fcaf 100644 --- a/test-vectors/rust/zip_0244.rs +++ b/test-vectors/rust/zip_0244.rs @@ -55,13 +55,13 @@ }, TestVector { tx: vec![ - 0x05, 0x00, 0x00, 0x80, 0x0a, 0x27, 0xa7, 0x26, 0x21, 0x96, 0x51, 0x37, 0x1f, 0xc9, 0x98, 0xc3, 0x1f, 0x4d, 0xd2, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x51, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x58, 0xe5, 0x75, 0x4c, 0x21, 0x04, 0x00, 0x07, 0x53, 0xac, 0x51, 0x53, 0x00, 0x51, 0x52, 0x00, 0x01, 0xe5, 0x84, 0x9f, 0x96, 0xba, 0xe6, 0xf2, 0x05, 0x6f, 0x33, 0xab, 0x1e, 0x69, 0x89, 0xd7, 0xd2, 0x64, 0xad, 0xc9, 0x78, 0x55, 0xa9, 0x90, 0x10, 0x3b, 0x4d, 0x1e, 0x63, 0x50, 0xd5, 0xc3, 0x1a, 0x39, 0xc3, 0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ed, 0x65, 0xb4, 0x09, 0xe1, 0xdd, 0x26, 0xb8, 0xdd, 0xdd, 0x68, 0x85, 0x8d, 0x6f, 0x51, 0x61, 0xf0, 0x73, 0xd9, 0x06, 0x36, 0x86, 0x0a, 0x9a, 0xae, 0xe1, 0x86, 0x29, 0xb0, 0x63, 0x30, 0xa8, 0xee, 0x30, 0x59, 0x1d, 0xeb, 0xfc, 0xef, 0x56, 0xa0, 0x26, 0xbb, 0x28, 0xc3, 0xb0, 0x6e, 0xc2, 0xcf, 0xaf, 0x5b, 0x79, 0xab, 0x72, 0x69, 0x4d, 0x1d, 0x01, 0x2a, 0x75, 0x94, 0xdd, 0x80, 0xae, 0x7d, 0xfa, 0x0c, 0x00 + 0x05, 0x00, 0x00, 0x80, 0x0a, 0x27, 0xa7, 0x26, 0x21, 0x96, 0x51, 0x37, 0x1f, 0xc9, 0x98, 0xc3, 0x1f, 0x4d, 0xd2, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x06, 0x04, 0x1f, 0x4d, 0xd2, 0x08, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x50, 0x58, 0xe5, 0x75, 0x4c, 0x21, 0x04, 0x00, 0x07, 0x53, 0xac, 0x51, 0x53, 0x00, 0x51, 0x52, 0x00, 0x01, 0xe5, 0x84, 0x9f, 0x96, 0xba, 0xe6, 0xf2, 0x05, 0x6f, 0x33, 0xab, 0x1e, 0x69, 0x89, 0xd7, 0xd2, 0x64, 0xad, 0xc9, 0x78, 0x55, 0xa9, 0x90, 0x10, 0x3b, 0x4d, 0x1e, 0x63, 0x50, 0xd5, 0xc3, 0x1a, 0x39, 0xc3, 0xca, 0xf6, 0x94, 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 0xd3, 0x54, 0x96, 0x12, 0x0e, 0xfc, 0x03, 0x89, 0x77, 0xe6, 0x86, 0x76 ], amounts: vec![ ], @@ -69,7 +69,7 @@ ], transparent_input: None, sighash_shielded: [ - 0x44, 0x72, 0x54, 0x1b, 0x1c, 0xe1, 0xfe, 0xd4, 0x57, 0x9a, 0xb9, 0x8a, 0xeb, 0x4e, 0x87, 0xb4, 0xc9, 0x1c, 0x1d, 0xfb, 0x92, 0xd8, 0x03, 0x8e, 0xbf, 0xc4, 0x3c, 0xbe, 0x73, 0x56, 0x1c, 0x5c + 0x13, 0x60, 0x15, 0x2a, 0x19, 0xea, 0x9e, 0x00, 0x44, 0x77, 0x3c, 0x91, 0xf9, 0xd5, 0x1f, 0xa6, 0xb4, 0x52, 0x50, 0x2f, 0xb6, 0xdf, 0xcd, 0x43, 0xfd, 0xd3, 0x0c, 0xa6, 0xfa, 0xde, 0x90, 0xf6 ], sighash_all: None, sighash_none: None, @@ -80,13 +80,13 @@ }, TestVector { tx: vec![ - 0x05, 0x00, 0x00, 0x80, 0x0a, 0x27, 0xa7, 0x26, 0x21, 0x96, 0x51, 0x37, 0xc2, 0xeb, 0x51, 0x8f, 0x68, 0x98, 0x4d, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x05, 0x00, 0x00, 0x80, 0x0a, 0x27, 0xa7, 0x26, 0x21, 0x96, 0x51, 0x37, 0xc2, 0xeb, 0x51, 0x8f, 0x68, 0x98, 0x4d, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x06, 0x04, 0x68, 0x98, 0x4d, 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 ], txid: [ - 0x7a, 0xf5, 0x65, 0x4b, 0xcb, 0x77, 0x42, 0x2c, 0xab, 0x10, 0x6c, 0x56, 0x8f, 0x05, 0x85, 0x7b, 0x56, 0x64, 0x33, 0x87, 0x9d, 0x55, 0xd4, 0xd4, 0x22, 0x48, 0xd2, 0x17, 0x62, 0xe5, 0x9f, 0x98 + 0x0f, 0xa0, 0x5d, 0x3f, 0x16, 0xf3, 0xe4, 0xde, 0xdf, 0x75, 0x42, 0xaa, 0xf4, 0xdd, 0x8a, 0x69, 0x9a, 0xd7, 0x2f, 0x1d, 0x71, 0xbc, 0x51, 0x2d, 0x65, 0xa1, 0xd5, 0x91, 0x00, 0xdb, 0xdb, 0x24 ], auth_digest: [ - 0x71, 0xc9, 0x19, 0x66, 0x0e, 0x31, 0x91, 0x49, 0x43, 0x63, 0x6c, 0x76, 0x7b, 0xc7, 0x04, 0x9f, 0x37, 0x2f, 0x92, 0x61, 0xcb, 0xe2, 0xae, 0x50, 0x3f, 0xb4, 0x76, 0x58, 0x75, 0xd1, 0xaa, 0x21 + 0xef, 0x06, 0x0b, 0x12, 0x13, 0xa9, 0xef, 0x93, 0x13, 0x1a, 0x8e, 0x1f, 0x15, 0x6e, 0x0c, 0xf6, 0xe4, 0x03, 0xc3, 0x62, 0x82, 0x7c, 0x6e, 0x8d, 0x9d, 0x60, 0x30, 0x33, 0xd0, 0xfe, 0x13, 0xbe ], amounts: vec![ ], @@ -94,7 +94,7 @@ ], transparent_input: None, sighash_shielded: [ - 0x7a, 0xf5, 0x65, 0x4b, 0xcb, 0x77, 0x42, 0x2c, 0xab, 0x10, 0x6c, 0x56, 0x8f, 0x05, 0x85, 0x7b, 0x56, 0x64, 0x33, 0x87, 0x9d, 0x55, 0xd4, 0xd4, 0x22, 0x48, 0xd2, 0x17, 0x62, 0xe5, 0x9f, 0x98 + 0x0f, 0xa0, 0x5d, 0x3f, 0x16, 0xf3, 0xe4, 0xde, 0xdf, 0x75, 0x42, 0xaa, 0xf4, 0xdd, 0x8a, 0x69, 0x9a, 0xd7, 0x2f, 0x1d, 0x71, 0xbc, 0x51, 0x2d, 0x65, 0xa1, 0xd5, 0x91, 0x00, 0xdb, 0xdb, 0x24 ], sighash_all: None, sighash_none: None, @@ -105,13 +105,13 @@ }, TestVector { tx: vec![ - 0x05, 0x00, 0x00, 0x80, 0x0a, 0x27, 0xa7, 0x26, 0x21, 0x96, 0x51, 0x37, 0x5e, 0x3d, 0xba, 0xf7, 0xae, 0x12, 0x67, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x51, 0x00, 0x00, 0x00, 0x00, 0x01, 0x51, 0x6c, 0xf4, 0xad, 0xec, 0x75, 0x07, 0x00, 0x03, 0x65, 0x65, 0x00, 0x00, 0x00, 0x00 + 0x05, 0x00, 0x00, 0x80, 0x0a, 0x27, 0xa7, 0x26, 0x21, 0x96, 0x51, 0x37, 0x5e, 0x3d, 0xba, 0xf7, 0xae, 0x12, 0x67, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x06, 0x04, 0xae, 0x12, 0x67, 0x0d, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x51, 0x6c, 0xf4, 0xad, 0xec, 0x75, 0x07, 0x00, 0x03, 0x65, 0x65, 0x00, 0x00, 0x00, 0x00 ], txid: [ - 0xb2, 0xeb, 0x8c, 0xc4, 0x5c, 0x1b, 0x3f, 0x8e, 0x02, 0x6a, 0x56, 0x13, 0xef, 0x3f, 0x6e, 0x3f, 0x8c, 0x92, 0xfd, 0xa2, 0x52, 0xb2, 0xc8, 0xae, 0x60, 0x9c, 0x15, 0x89, 0xc4, 0x2f, 0xa0, 0xe7 + 0x64, 0x44, 0x12, 0x8a, 0xd4, 0x2a, 0x3d, 0x73, 0x18, 0xb0, 0x6b, 0x2b, 0x94, 0x27, 0x66, 0x29, 0x63, 0x2f, 0x8b, 0xb7, 0xc0, 0x50, 0xe5, 0x02, 0xe4, 0xa8, 0x73, 0x02, 0x4e, 0xba, 0x3b, 0x79 ], auth_digest: [ - 0x71, 0xc9, 0x19, 0x66, 0x0e, 0x31, 0x91, 0x49, 0x43, 0x63, 0x6c, 0x76, 0x7b, 0xc7, 0x04, 0x9f, 0x37, 0x2f, 0x92, 0x61, 0xcb, 0xe2, 0xae, 0x50, 0x3f, 0xb4, 0x76, 0x58, 0x75, 0xd1, 0xaa, 0x21 + 0x91, 0xaa, 0xa9, 0x7f, 0xfe, 0x5d, 0x24, 0xf9, 0xa3, 0x54, 0xf9, 0x40, 0xfe, 0x9d, 0x1a, 0xe5, 0xb6, 0xd4, 0x59, 0x47, 0xb2, 0xc2, 0x0b, 0x00, 0x2d, 0xc2, 0x00, 0x42, 0xa1, 0x16, 0xad, 0xc7 ], amounts: vec![ ], @@ -119,7 +119,7 @@ ], transparent_input: None, sighash_shielded: [ - 0xb2, 0xeb, 0x8c, 0xc4, 0x5c, 0x1b, 0x3f, 0x8e, 0x02, 0x6a, 0x56, 0x13, 0xef, 0x3f, 0x6e, 0x3f, 0x8c, 0x92, 0xfd, 0xa2, 0x52, 0xb2, 0xc8, 0xae, 0x60, 0x9c, 0x15, 0x89, 0xc4, 0x2f, 0xa0, 0xe7 + 0x64, 0x44, 0x12, 0x8a, 0xd4, 0x2a, 0x3d, 0x73, 0x18, 0xb0, 0x6b, 0x2b, 0x94, 0x27, 0x66, 0x29, 0x63, 0x2f, 0x8b, 0xb7, 0xc0, 0x50, 0xe5, 0x02, 0xe4, 0xa8, 0x73, 0x02, 0x4e, 0xba, 0x3b, 0x79 ], sighash_all: None, sighash_none: None, diff --git a/zcash_test_vectors/transaction.py b/zcash_test_vectors/transaction.py index c4c1131..01c2d06 100644 --- a/zcash_test_vectors/transaction.py +++ b/zcash_test_vectors/transaction.py @@ -11,7 +11,7 @@ from .sapling.jubjub import ( Point, Fr as JubjubScalar, ) -from .utils import leos2ip +from .utils import leos2ip, i2leosp from .zc_utils import write_compact_size MAX_MONEY = 21000000 * 100000000 @@ -234,6 +234,28 @@ class Script(object): script._script = b return script + @staticmethod + def coinbase_from_height(height): + assert height >= 0 + if height == 0: + enc_height = b'\x00' + elif height <= 16: + enc_height = bytes([0x50 + height]) + elif height <= 0x7F: + enc_height = b'\x01' + i2leosp( 8, height) + elif height <= 0x7FFF: + enc_height = b'\x02' + i2leosp(16, height) + elif height <= 0x7FFFFF: + enc_height = b'\x03' + i2leosp(24, height) + elif height <= 0x7FFFFFFF: + enc_height = b'\x04' + i2leosp(32, height) + else: + assert height <= 0x7FFFFFFFFF + enc_height = b'\x05' + i2leosp(40, height) + + # zcashd adds an OP_0 + return Script.from_bytes(enc_height + b'\x00') + def raw(self): return self._script @@ -415,8 +437,8 @@ class TransactionV5(object): if is_coinbase: self.vin.append(TxIn.from_components( OutPoint.from_components(b'\x00' * 32, 0xFFFFFFFF), - Script.from_bytes(b"\x51"), - 0)) + Script.coinbase_from_height(self.nExpiryHeight), + 0xFFFFFFFF)) if have_transparent_out: for _ in range((rand.u8() % 3) + 1): self.vout.append(TxOut(rand))