Zebra/zebra-test/src/vectors
Henry de Valence 4fa119dd1f chain: fix consensus-critical coinbase encoding bug
The `CoinbaseData` parses the block height separately from the rest of the
free-form coinbase data.  However, it had two bugs:

1. It did not require that the height was canonically encoded;
2. Its canonical encoding was incorrect relative to the BIP34-inherited encoding.

This meant that we computed some transaction hashes incorrectly, because when
we re-serialized the coinbase transaction, we would canonically serialize the
coinbase transaction (using the incorrect definition of canonical, bug 2).  And
we didn't notice that the wrong definition of canonical encoding was being used
because we accepted what we thought were non-canonically encoded heights.

The relevant rules are here: 877212414a/src/script/script.h (L307-L346)

This commit changes the encoding to reject non-canonically encoded heights, and
to match the correct encoding rules.  We check that at least one
non-canonically encoded height is correctly rejected using a new test vector.

The database format increments because we saved a bunch of wrongly encoded blocks.

This discrepancy was originally noticed by @teor2345, who pointed out that a
previous version of the block 202 test vector (now preserved as "bad block
202") did not match the block from zcashd.
2020-12-01 10:14:44 +10:00
..
block-main-0-000-000.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-001.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-002.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-003.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-004.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-005.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-006.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-007.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-008.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-009.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-010.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-000-202-bad.txt chain: fix consensus-critical coinbase encoding bug 2020-12-01 10:14:44 +10:00
block-main-0-000-202.txt test: add mainnet block 202 test vector 2020-12-01 10:14:44 +10:00
block-main-0-347-499.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-347-500.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-347-501.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-415-000.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-419-199.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-419-200.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-419-201.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-434-873.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-653-599.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-653-600.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-653-601.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-902-999.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-903-000.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-903-001.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-main-0-949-496.txt Shielded coinbase test blocks (#1116) 2020-10-06 16:35:41 -07:00
block-main-0-975-066.txt Shielded coinbase test blocks (#1116) 2020-10-06 16:35:41 -07:00
block-main-0-982-681.txt Shielded coinbase test blocks (#1116) 2020-10-06 16:35:41 -07:00
block-test-0-000-000.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-001.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-002.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-003.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-004.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-005.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-006.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-007.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-008.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-009.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-000-010.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-141-042.bin Shielded coinbase test blocks (#1116) 2020-10-06 16:35:41 -07:00
block-test-0-207-499.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-207-500.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-207-501.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-279-999.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-280-000.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-280-001.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-299-187.txt Add minimum difficulty testnet block vectors 2020-11-12 12:30:54 +10:00
block-test-0-299-188.txt Add minimum difficulty testnet block vectors 2020-11-12 12:30:54 +10:00
block-test-0-299-189.txt Add minimum difficulty testnet block vectors 2020-11-12 12:30:54 +10:00
block-test-0-299-201.txt Add minimum difficulty testnet block vectors 2020-11-12 12:30:54 +10:00
block-test-0-299-202.txt Add minimum difficulty testnet block vectors 2020-11-12 12:30:54 +10:00
block-test-0-583-999.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-584-000.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-584-001.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-903-799.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-903-800.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-903-801.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-0-914-678.txt Shielded coinbase test blocks (#1116) 2020-10-06 16:35:41 -07:00
block-test-0-925-483.txt Shielded coinbase test blocks (#1116) 2020-10-06 16:35:41 -07:00
block-test-1-028-499.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-1-028-500.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-1-028-501.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-1-095-000.txt Add block test vectors for each network upgrade (#1096) 2020-09-28 12:42:06 +10:00
block-test-1-101-629.txt Shielded coinbase test blocks (#1116) 2020-10-06 16:35:41 -07:00
block.rs chain: fix consensus-critical coinbase encoding bug 2020-12-01 10:14:44 +10:00