zebra_test/vectors/
block.rs

1//! Block test vectors
2
3#![allow(missing_docs)]
4
5use hex::FromHex;
6use lazy_static::lazy_static;
7
8use std::collections::BTreeMap;
9
10trait ReverseCollection {
11    /// Return a reversed copy of this collection
12    fn rev(self) -> Self;
13}
14
15impl ReverseCollection for [u8; 32] {
16    fn rev(mut self) -> [u8; 32] {
17        self.reverse();
18        self
19    }
20}
21
22lazy_static! {
23    /// All block test vectors
24    pub static ref BLOCKS: Vec<&'static [u8]> = MAINNET_BLOCKS
25        .iter()
26        .chain(TESTNET_BLOCKS.iter())
27        .map(|(_height, block)| *block)
28        .collect();
29
30    /// Continuous mainnet blocks, indexed by height
31    ///
32    /// Contains the continuous blockchain from genesis onwards.  Stops at the
33    /// first gap in the chain.
34    pub static ref CONTINUOUS_MAINNET_BLOCKS: BTreeMap<u32, &'static [u8]> = MAINNET_BLOCKS
35        .iter()
36        .enumerate()
37        .take_while(|(i, (height, _block))| *i == **height as usize)
38        .map(|(_i, (height, block))| (*height, *block))
39        .collect();
40
41    /// Continuous testnet blocks, indexed by height
42    ///
43    /// Contains the continuous blockchain from genesis onwards.  Stops at the
44    /// first gap in the chain.
45    pub static ref CONTINUOUS_TESTNET_BLOCKS: BTreeMap<u32, &'static [u8]> = TESTNET_BLOCKS
46        .iter()
47        .enumerate()
48        .take_while(|(i, (height, _block))| *i == **height as usize)
49        .map(|(_i, (height, block))| (*height, *block))
50        .collect();
51
52    // Update these lists of blocks when you add new block test vectors to
53    // this file
54    //
55    // We use integer heights in these maps, to avoid a dependency on zebra_chain
56
57    /// Mainnet blocks, indexed by height
58    ///
59    /// This is actually a bijective map, the tests ensure that values are unique.
60    pub static ref MAINNET_BLOCKS: BTreeMap<u32, &'static [u8]> = [
61            // Genesis
62            (0, BLOCK_MAINNET_GENESIS_BYTES.as_ref()),
63
64            // BeforeOverwinter
65            (1, BLOCK_MAINNET_1_BYTES.as_ref()),
66            (2, BLOCK_MAINNET_2_BYTES.as_ref()),
67            (3, BLOCK_MAINNET_3_BYTES.as_ref()),
68            (4, BLOCK_MAINNET_4_BYTES.as_ref()),
69            (5, BLOCK_MAINNET_5_BYTES.as_ref()),
70            (6, BLOCK_MAINNET_6_BYTES.as_ref()),
71            (7, BLOCK_MAINNET_7_BYTES.as_ref()),
72            (8, BLOCK_MAINNET_8_BYTES.as_ref()),
73            (9, BLOCK_MAINNET_9_BYTES.as_ref()),
74            (10, BLOCK_MAINNET_10_BYTES.as_ref()),
75            (202, BLOCK_MAINNET_202_BYTES.as_ref()),
76            // The first block that contains a tx with a JoinSplit.
77            (396, BLOCK_MAINNET_396_BYTES.as_ref()),
78            (347_499, BLOCK_MAINNET_347499_BYTES.as_ref()),
79
80            // Overwinter
81            (347_500, BLOCK_MAINNET_347500_BYTES.as_ref()),
82            (347_501, BLOCK_MAINNET_347501_BYTES.as_ref()),
83            (415_000, BLOCK_MAINNET_415000_BYTES.as_ref()),
84            (419_199, BLOCK_MAINNET_419199_BYTES.as_ref()),
85
86            // Sapling
87            (419_200, BLOCK_MAINNET_419200_BYTES.as_ref()),
88            (419_201, BLOCK_MAINNET_419201_BYTES.as_ref()),
89            (419_202, BLOCK_MAINNET_419202_BYTES.as_ref()),
90
91            // A bad version field
92            (434_873, BLOCK_MAINNET_434873_BYTES.as_ref()),
93            (653_599, BLOCK_MAINNET_653599_BYTES.as_ref()),
94
95            // Blossom
96            (653_600, BLOCK_MAINNET_653600_BYTES.as_ref()),
97            (653_601, BLOCK_MAINNET_653601_BYTES.as_ref()),
98            (902_999, BLOCK_MAINNET_902999_BYTES.as_ref()),
99
100            // Heartwood
101            (903_000, BLOCK_MAINNET_903000_BYTES.as_ref()),
102            (903_001, BLOCK_MAINNET_903001_BYTES.as_ref()),
103
104            // Shielded coinbase x3
105            (949_496, BLOCK_MAINNET_949496_BYTES.as_ref()),
106            (975_066, BLOCK_MAINNET_975066_BYTES.as_ref()),
107            (982_681, BLOCK_MAINNET_982681_BYTES.as_ref()),
108
109            // Last Heartwood
110            (1_046_399, BLOCK_MAINNET_1046399_BYTES.as_ref()),
111
112            // Canopy and First Coinbase Halving
113            (1_046_400, BLOCK_MAINNET_1046400_BYTES.as_ref()),
114            (1_046_401, BLOCK_MAINNET_1046401_BYTES.as_ref()),
115            (1_180_900, BLOCK_MAINNET_1180900_BYTES.as_ref()),
116
117            // NU5
118            //
119            // Contains:
120            //
121            // - First Sapling to Sapling V5 txs.
122            // - First Sapling to Sapling V4 tx after NU5.
123            (1_687_106, BLOCK_MAINNET_1687106_BYTES.as_ref()),
124            // - First transparent to Sapling V5 tx.
125            // - First Sapling to Orchard tx.
126            (1_687_107, BLOCK_MAINNET_1687107_BYTES.as_ref()),
127            // - First transparent V5 txs.
128            // - First Sapling to transparent V5 txs.
129            (1_687_108, BLOCK_MAINNET_1687108_BYTES.as_ref()),
130            // - First transparent to (transparent + Sapling) V5 tx.
131            (1_687_113, BLOCK_MAINNET_1687113_BYTES.as_ref()),
132            // - First Sapling to (Sapling + Orchard) tx.
133            (1_687_118, BLOCK_MAINNET_1687118_BYTES.as_ref()),
134            // - First Orchard to Orchard tx.
135            (1_687_121, BLOCK_MAINNET_1687121_BYTES.as_ref()),
136        ].iter().cloned().collect();
137
138    /// Mainnet final Sprout roots, indexed by height.
139    ///
140    /// If there are no Sprout inputs or outputs in a block, the final Sprout root is the same as
141    /// the previous block.
142    pub static ref MAINNET_FINAL_SPROUT_ROOTS: BTreeMap<u32, &'static [u8; 32]> = [
143            // Genesis
144            (0, SPROUT_FINAL_ROOT_MAINNET_0_BYTES.as_ref().try_into().unwrap()),
145            // The first block that contains a tx with a JoinSplit.
146            (396, SPROUT_FINAL_ROOT_MAINNET_396_BYTES.as_ref().try_into().unwrap()),
147
148            // Overwinter
149            (347_499, SPROUT_FINAL_ROOT_MAINNET_347499_BYTES.as_ref().try_into().unwrap()),
150            (347_500, SPROUT_FINAL_ROOT_MAINNET_347500_BYTES.as_ref().try_into().unwrap()),
151            (347_501, SPROUT_FINAL_ROOT_MAINNET_347501_BYTES.as_ref().try_into().unwrap()),
152        ].iter().cloned().collect();
153
154    /// Mainnet final Sapling roots, indexed by height
155    ///
156    /// Pre-Sapling roots are all-zeroes.  If there are no Sapling Outputs in a block, the final
157    /// Sapling root is the same as the previous block.
158    pub static ref MAINNET_FINAL_SAPLING_ROOTS: BTreeMap<u32, &'static [u8; 32]> = [
159            // Sapling
160            (419_200, SAPLING_FINAL_ROOT_MAINNET_419200_BYTES.as_ref().try_into().unwrap()),
161            (419_201, SAPLING_FINAL_ROOT_MAINNET_419201_BYTES.as_ref().try_into().unwrap()),
162            (419_202, SAPLING_FINAL_ROOT_MAINNET_419202_BYTES.as_ref().try_into().unwrap()),
163            // A bad version field
164            (434_873, SAPLING_FINAL_ROOT_MAINNET_434873_BYTES.as_ref().try_into().unwrap()),
165            (653_599, SAPLING_FINAL_ROOT_MAINNET_653599_BYTES.as_ref().try_into().unwrap()),
166            // Blossom
167            (653_600, SAPLING_FINAL_ROOT_MAINNET_653600_BYTES.as_ref().try_into().unwrap()),
168            (653_601, SAPLING_FINAL_ROOT_MAINNET_653601_BYTES.as_ref().try_into().unwrap()),
169            (902_999, SAPLING_FINAL_ROOT_MAINNET_902999_BYTES.as_ref().try_into().unwrap()),
170            // Heartwood
171            (903_000, SAPLING_FINAL_ROOT_MAINNET_903000_BYTES.as_ref().try_into().unwrap()),
172            (903_001, SAPLING_FINAL_ROOT_MAINNET_903001_BYTES.as_ref().try_into().unwrap()),
173            // Shielded coinbase x3
174            (949_496, SAPLING_FINAL_ROOT_MAINNET_949496_BYTES.as_ref().try_into().unwrap()),
175            (975_066, SAPLING_FINAL_ROOT_MAINNET_975066_BYTES.as_ref().try_into().unwrap()),
176            (982_681, SAPLING_FINAL_ROOT_MAINNET_982681_BYTES.as_ref().try_into().unwrap()),
177            // Last Heartwood
178            (1_046_399, SAPLING_FINAL_ROOT_MAINNET_1046399_BYTES.as_ref().try_into().unwrap()),
179            // Canopy and First Coinbase Halving
180            (1_046_400, SAPLING_FINAL_ROOT_MAINNET_1046400_BYTES.as_ref().try_into().unwrap()),
181            (1_046_401, SAPLING_FINAL_ROOT_MAINNET_1046401_BYTES.as_ref().try_into().unwrap()),
182            (1_180_900, SAPLING_FINAL_ROOT_MAINNET_1180900_BYTES.as_ref().try_into().unwrap()),
183            // NU5
184            (1_687_106, SAPLING_FINAL_ROOT_MAINNET_1687106_BYTES.as_ref().try_into().unwrap()),
185            (1_687_107, SAPLING_FINAL_ROOT_MAINNET_1687107_BYTES.as_ref().try_into().unwrap()),
186            (1_687_108, SAPLING_FINAL_ROOT_MAINNET_1687108_BYTES.as_ref().try_into().unwrap()),
187            (1_687_113, SAPLING_FINAL_ROOT_MAINNET_1687113_BYTES.as_ref().try_into().unwrap()),
188            (1_687_118, SAPLING_FINAL_ROOT_MAINNET_1687118_BYTES.as_ref().try_into().unwrap()),
189            (1_687_121, SAPLING_FINAL_ROOT_MAINNET_1687121_BYTES.as_ref().try_into().unwrap()),
190        ].iter().cloned().collect();
191
192    /// Mainnet final Orchard roots (anchors), indexed by height.
193    ///
194    /// Pre-Orchard anchors are all-zeroes. If there are no Orchard actions in a block, the anchor
195    /// is the same as the one for the previous block.
196    pub static ref MAINNET_FINAL_ORCHARD_ROOTS: BTreeMap<u32, &'static [u8; 32]> = [
197            // NU5
198            (1_687_106, ORCHARD_FINAL_ROOT_MAINNET_1687106_BYTES.as_ref().try_into().unwrap()),
199            (1_687_107, ORCHARD_FINAL_ROOT_MAINNET_1687107_BYTES.as_ref().try_into().unwrap()),
200            (1_687_108, ORCHARD_FINAL_ROOT_MAINNET_1687108_BYTES.as_ref().try_into().unwrap()),
201            (1_687_113, ORCHARD_FINAL_ROOT_MAINNET_1687113_BYTES.as_ref().try_into().unwrap()),
202            (1_687_118, ORCHARD_FINAL_ROOT_MAINNET_1687118_BYTES.as_ref().try_into().unwrap()),
203            (1_687_121, ORCHARD_FINAL_ROOT_MAINNET_1687121_BYTES.as_ref().try_into().unwrap()),
204        ].iter().cloned().collect();
205
206    /// Testnet blocks, indexed by height
207    ///
208    /// This is actually a bijective map, the tests ensure that values are unique.
209    pub static ref TESTNET_BLOCKS: BTreeMap<u32, &'static [u8]> = [
210            // Genesis
211            (0, BLOCK_TESTNET_GENESIS_BYTES.as_ref()),
212            // BeforeOverwinter
213            (1, BLOCK_TESTNET_1_BYTES.as_ref()),
214            (2, BLOCK_TESTNET_2_BYTES.as_ref()),
215            (3, BLOCK_TESTNET_3_BYTES.as_ref()),
216            (4, BLOCK_TESTNET_4_BYTES.as_ref()),
217            (5, BLOCK_TESTNET_5_BYTES.as_ref()),
218            (6, BLOCK_TESTNET_6_BYTES.as_ref()),
219            (7, BLOCK_TESTNET_7_BYTES.as_ref()),
220            (8, BLOCK_TESTNET_8_BYTES.as_ref()),
221            (9, BLOCK_TESTNET_9_BYTES.as_ref()),
222            (10, BLOCK_TESTNET_10_BYTES.as_ref()),
223            // The first block that contains a tx with a JoinSplit.
224            (2_259, BLOCK_TESTNET_2259_BYTES.as_ref()),
225            // A large block
226            (141_042, BLOCK_TESTNET_141042_BYTES.as_ref()),
227            (207_499, BLOCK_TESTNET_207499_BYTES.as_ref()),
228            // Overwinter
229            (207_500, BLOCK_TESTNET_207500_BYTES.as_ref()),
230            (207_501, BLOCK_TESTNET_207501_BYTES.as_ref()),
231            (279_999, BLOCK_TESTNET_279999_BYTES.as_ref()),
232            // Sapling
233            (280_000, BLOCK_TESTNET_280000_BYTES.as_ref()),
234            (280_001, BLOCK_TESTNET_280001_BYTES.as_ref()),
235            (299_187, BLOCK_TESTNET_299187_BYTES.as_ref()),
236            // Minimum-difficulty blocks x2
237            // See zebra_chain's MINIMUM_DIFFICULTY_HEIGHTS for a full list
238            (299_188, BLOCK_TESTNET_299188_BYTES.as_ref()),
239            (299_189, BLOCK_TESTNET_299189_BYTES.as_ref()),
240            (299_201, BLOCK_TESTNET_299201_BYTES.as_ref()),
241            // Minimum-difficulty block
242            (299_202, BLOCK_TESTNET_299202_BYTES.as_ref()),
243            (583_999, BLOCK_TESTNET_583999_BYTES.as_ref()),
244            // Blossom
245            (584_000, BLOCK_TESTNET_584000_BYTES.as_ref()),
246            (584_001, BLOCK_TESTNET_584001_BYTES.as_ref()),
247            (903_799, BLOCK_TESTNET_903799_BYTES.as_ref()),
248            // Heartwood
249            (903_800, BLOCK_TESTNET_903800_BYTES.as_ref()),
250            (903_801, BLOCK_TESTNET_903801_BYTES.as_ref()),
251            // Shielded coinbase x2
252            (914_678, BLOCK_TESTNET_914678_BYTES.as_ref()),
253            (925_483, BLOCK_TESTNET_925483_BYTES.as_ref()),
254            (1_028_499, BLOCK_TESTNET_1028499_BYTES.as_ref()),
255            // Canopy
256            (1_028_500, BLOCK_TESTNET_1028500_BYTES.as_ref()),
257            (1_028_501, BLOCK_TESTNET_1028501_BYTES.as_ref()),
258            (1_095_000, BLOCK_TESTNET_1095000_BYTES.as_ref()),
259            // Shielded coinbase
260            (1_101_629, BLOCK_TESTNET_1101629_BYTES.as_ref()),
261            // Last Pre-Halving
262            (1_115_999, BLOCK_TESTNET_1115999_BYTES.as_ref()),
263            // First Coinbase Halving
264            (1_116_000, BLOCK_TESTNET_1116000_BYTES.as_ref()),
265            (1_116_001, BLOCK_TESTNET_1116001_BYTES.as_ref()),
266            (1_326_100, BLOCK_TESTNET_1326100_BYTES.as_ref()),
267
268            // NU5
269            //
270            // Contains:
271
272            // First V5 tx with:
273            //
274            // - 4 Sapling spends, and
275            // - 2 Orchard actions.
276            (1_842_421, BLOCK_TESTNET_1842421_BYTES.as_ref()),
277            // First V5 tx with:
278            //
279            // - 50 transparent inputs, and
280            // - 1 Sapling output.
281            (1_842_432, BLOCK_TESTNET_1842432_BYTES.as_ref()),
282            // First V5 tx with:
283            //
284            // - 2 transparent inputs, and
285            // - 2 Orchard actions.
286            (1_842_462, BLOCK_TESTNET_1842462_BYTES.as_ref()),
287            // First V5 tx with two Orchard actions and no other transfers.
288            (1_842_467, BLOCK_TESTNET_1842467_BYTES.as_ref()),
289            // First V5 tx with:
290            //
291            // - 1 transparent input,
292            // - 1 Sapling output, and
293            // - 2 Orchard actions.
294            (1_842_468, BLOCK_TESTNET_1842468_BYTES.as_ref()),
295        ].iter().cloned().collect();
296
297    /// Testnet final Sprout roots, indexed by height.
298    ///
299    /// If there are no Sprout inputs or outputs in a block, the final Sprout root is the same as
300    /// the previous block.
301    pub static ref TESTNET_FINAL_SPROUT_ROOTS: BTreeMap<u32, &'static [u8; 32]> = [
302        // Genesis
303        (0, SPROUT_FINAL_ROOT_TESTNET_0_BYTES.as_ref().try_into().unwrap()),
304        // The first block that contains a tx with a JoinSplit.
305        (2259, SPROUT_FINAL_ROOT_TESTNET_2259_BYTES.as_ref().try_into().unwrap()),
306    ].iter().cloned().collect();
307
308    /// Testnet final Sapling roots, indexed by height
309    ///
310    /// Pre-sapling roots are all-zeroes.  If there are no Sapling Outputs in a block, the final
311    /// sapling root is the same as the previous block.
312    pub static ref TESTNET_FINAL_SAPLING_ROOTS: BTreeMap<u32, &'static [u8; 32]> = [
313            // Sapling
314            (280_000, SAPLING_FINAL_ROOT_TESTNET_280000_BYTES.as_ref().try_into().unwrap()),
315            (280_001, SAPLING_FINAL_ROOT_TESTNET_280001_BYTES.as_ref().try_into().unwrap()),
316            (299_187, SAPLING_FINAL_ROOT_TESTNET_299187_BYTES.as_ref().try_into().unwrap()),
317            // Minimum-difficulty blocks x2
318            // See zebra_chain's MINIMUM_DIFFICULTY_HEIGHTS for a full list
319            (299_188, SAPLING_FINAL_ROOT_TESTNET_299188_BYTES.as_ref().try_into().unwrap()),
320            (299_189, SAPLING_FINAL_ROOT_TESTNET_299189_BYTES.as_ref().try_into().unwrap()),
321            (299_201, SAPLING_FINAL_ROOT_TESTNET_299201_BYTES.as_ref().try_into().unwrap()),
322            // Minimum-difficulty block
323            (299_202, SAPLING_FINAL_ROOT_TESTNET_299202_BYTES.as_ref().try_into().unwrap()),
324            (583_999, SAPLING_FINAL_ROOT_TESTNET_583999_BYTES.as_ref().try_into().unwrap()),
325            // Blossom
326            (584_000, SAPLING_FINAL_ROOT_TESTNET_584000_BYTES.as_ref().try_into().unwrap()),
327            (584_001, SAPLING_FINAL_ROOT_TESTNET_584001_BYTES.as_ref().try_into().unwrap()),
328            (903_799, SAPLING_FINAL_ROOT_TESTNET_903799_BYTES.as_ref().try_into().unwrap()),
329            // Heartwood
330            (903_800, SAPLING_FINAL_ROOT_TESTNET_903800_BYTES.as_ref().try_into().unwrap()),
331            (903_801, SAPLING_FINAL_ROOT_TESTNET_903801_BYTES.as_ref().try_into().unwrap()),
332            // Shielded coinbase x2
333            (914_678, SAPLING_FINAL_ROOT_TESTNET_914678_BYTES.as_ref().try_into().unwrap()),
334            (925_483, SAPLING_FINAL_ROOT_TESTNET_925483_BYTES.as_ref().try_into().unwrap()),
335            (1_028_499, SAPLING_FINAL_ROOT_TESTNET_1028499_BYTES.as_ref().try_into().unwrap()),
336            // Canopy
337            (1_028_500, SAPLING_FINAL_ROOT_TESTNET_1028500_BYTES.as_ref().try_into().unwrap()),
338            (1_028_501, SAPLING_FINAL_ROOT_TESTNET_1028501_BYTES.as_ref().try_into().unwrap()),
339            (1_095_000, SAPLING_FINAL_ROOT_TESTNET_1095000_BYTES.as_ref().try_into().unwrap()),
340            // Shielded coinbase
341            (1_101_629, SAPLING_FINAL_ROOT_TESTNET_1101629_BYTES.as_ref().try_into().unwrap()),
342            // Last Pre-Halving
343            (1_115_999, SAPLING_FINAL_ROOT_TESTNET_1115999_BYTES.as_ref().try_into().unwrap()),
344            // First Coinbase Halving
345            (1_116_000, SAPLING_FINAL_ROOT_TESTNET_1116000_BYTES.as_ref().try_into().unwrap()),
346            (1_116_001, SAPLING_FINAL_ROOT_TESTNET_1116001_BYTES.as_ref().try_into().unwrap()),
347            (1_326_100, SAPLING_FINAL_ROOT_TESTNET_1326100_BYTES.as_ref().try_into().unwrap()),
348            // NU5
349            (1_842_421, SAPLING_FINAL_ROOT_TESTNET_1842421_BYTES.as_ref().try_into().unwrap()),
350            (1_842_432, SAPLING_FINAL_ROOT_TESTNET_1842432_BYTES.as_ref().try_into().unwrap()),
351            (1_842_462, SAPLING_FINAL_ROOT_TESTNET_1842462_BYTES.as_ref().try_into().unwrap()),
352            (1_842_467, SAPLING_FINAL_ROOT_TESTNET_1842467_BYTES.as_ref().try_into().unwrap()),
353            (1_842_468, SAPLING_FINAL_ROOT_TESTNET_1842468_BYTES.as_ref().try_into().unwrap()),
354        ].iter().cloned().collect();
355
356    /// Testnet final Orchard roots (anchors), indexed by height.
357    ///
358    /// Pre-Orchard anchors are all-zeroes. If there are no Orchard actions in a block, the anchor
359    /// is the same as the one for the previous block.
360    pub static ref TESTNET_FINAL_ORCHARD_ROOTS: BTreeMap<u32, &'static [u8; 32]> = [
361            // NU5
362            (1_842_421, ORCHARD_FINAL_ROOT_TESTNET_1842421_BYTES.as_ref().try_into().unwrap()),
363            (1_842_432, ORCHARD_FINAL_ROOT_TESTNET_1842432_BYTES.as_ref().try_into().unwrap()),
364            (1_842_462, ORCHARD_FINAL_ROOT_TESTNET_1842462_BYTES.as_ref().try_into().unwrap()),
365            (1_842_467, ORCHARD_FINAL_ROOT_TESTNET_1842467_BYTES.as_ref().try_into().unwrap()),
366            (1_842_468, ORCHARD_FINAL_ROOT_TESTNET_1842468_BYTES.as_ref().try_into().unwrap()),
367        ].iter().cloned().collect();
368
369    // Mainnet
370
371    // Genesis/BeforeOverwinter
372    // for i in `seq 0 9`; do
373    //     zcash-cli getblock $i 0 > block-main--000-00$i.txt
374    // done
375    pub static ref BLOCK_MAINNET_GENESIS_BYTES: Vec<u8> =
376        <Vec<u8>>::from_hex(include_str!("block-main-0-000-000.txt").trim())
377        .expect("Block bytes are in valid hex representation");
378    pub static ref BLOCK_MAINNET_1_BYTES: Vec<u8> =
379        <Vec<u8>>::from_hex(include_str!("block-main-0-000-001.txt").trim())
380        .expect("Block bytes are in valid hex representation");
381    pub static ref BLOCK_MAINNET_2_BYTES: Vec<u8> =
382        <Vec<u8>>::from_hex(include_str!("block-main-0-000-002.txt").trim())
383        .expect("Block bytes are in valid hex representation");
384    pub static ref BLOCK_MAINNET_3_BYTES: Vec<u8> =
385        <Vec<u8>>::from_hex(include_str!("block-main-0-000-003.txt").trim())
386        .expect("Block bytes are in valid hex representation");
387    pub static ref BLOCK_MAINNET_4_BYTES: Vec<u8> =
388        <Vec<u8>>::from_hex(include_str!("block-main-0-000-004.txt").trim())
389        .expect("Block bytes are in valid hex representation");
390    pub static ref BLOCK_MAINNET_5_BYTES: Vec<u8> =
391        <Vec<u8>>::from_hex(include_str!("block-main-0-000-005.txt").trim())
392        .expect("Block bytes are in valid hex representation");
393    pub static ref BLOCK_MAINNET_6_BYTES: Vec<u8> =
394        <Vec<u8>>::from_hex(include_str!("block-main-0-000-006.txt").trim())
395        .expect("Block bytes are in valid hex representation");
396    pub static ref BLOCK_MAINNET_7_BYTES: Vec<u8> =
397        <Vec<u8>>::from_hex(include_str!("block-main-0-000-007.txt").trim())
398        .expect("Block bytes are in valid hex representation");
399    pub static ref BLOCK_MAINNET_8_BYTES: Vec<u8> =
400        <Vec<u8>>::from_hex(include_str!("block-main-0-000-008.txt").trim())
401        .expect("Block bytes are in valid hex representation");
402    pub static ref BLOCK_MAINNET_9_BYTES: Vec<u8> =
403        <Vec<u8>>::from_hex(include_str!("block-main-0-000-009.txt").trim())
404        .expect("Block bytes are in valid hex representation");
405    // zcash-cli getblock 10 0 > block-main-0-000-010.txt
406    pub static ref BLOCK_MAINNET_10_BYTES: Vec<u8> =
407        <Vec<u8>>::from_hex(include_str!("block-main-0-000-010.txt").trim())
408        .expect("Block bytes are in valid hex representation");
409    pub static ref BLOCK_MAINNET_202_BYTES: Vec<u8> =
410        <Vec<u8>>::from_hex(include_str!("block-main-0-000-202.txt").trim())
411        .expect("Block bytes are in valid hex representation");
412    // zcash-cli getblock 395 0 > block-main-0-000-395.txt
413    pub static ref BLOCK_MAINNET_395_BYTES: Vec<u8> =
414        <Vec<u8>>::from_hex(include_str!("block-main-0-000-395.txt").trim())
415        .expect("Block bytes are in valid hex representation");
416    // zcash-cli getblock 396 0 > block-main-0-000-396.txt
417    pub static ref BLOCK_MAINNET_396_BYTES: Vec<u8> =
418        <Vec<u8>>::from_hex(include_str!("block-main-0-000-396.txt").trim())
419        .expect("Block bytes are in valid hex representation");
420
421    /// This contains an encoding of block 202 but with an improperly encoded
422    /// coinbase height.
423    pub static ref BAD_BLOCK_MAINNET_202_BYTES: Vec<u8> =
424        <Vec<u8>>::from_hex(include_str!("block-main-0-000-202-bad.txt").trim())
425        .expect("Block bytes are in valid hex representation");
426
427
428    // # Anchors for Sprout, starting at Genesis.
429    //
430    // for i in 0 396; do
431    //     zcash-cli z_gettreestate "$i" | \
432    //     jq --arg i "$i" \
433    //     --raw-output \
434    //     '"pub static ref SPROUT_FINAL_ROOT_MAINNET_\($i)_BYTES: [u8; 32] = <[u8; 32]>::from_hex(\"\(.sprout.commitments.finalRoot)\").expect(\"final root bytes are in valid hex representation\").rev();"'
435    //     done
436    pub static ref SPROUT_FINAL_ROOT_MAINNET_0_BYTES: [u8; 32] =
437        <[u8; 32]>::from_hex("59d2cde5e65c1414c32ba54f0fe4bdb3d67618125286e6a191317917c812c6d7")
438        .expect("final root bytes are in valid hex representation").rev();
439    // The first block that contains a tx with a JoinSplit.
440    pub static ref SPROUT_FINAL_ROOT_MAINNET_396_BYTES: [u8; 32] =
441        <[u8; 32]>::from_hex("6a5710d1ca7d079baf1ce6ed1ea1b0756e219e9f3ebb9c0ec5b8ca1ff81c8f06")
442        .expect("final root bytes are in valid hex representation").rev();
443
444    // # Anchors for the Overwinter transition, which is still in the Sprout pool.
445    //
446    // for i in 347499 347500 347501; do
447    //     zcash-cli z_gettreestate "$i" | \
448    //     jq --arg i "$i" \
449    //     --raw-output \
450    //     '"pub static ref SPROUT_FINAL_ROOT_MAINNET_\($i)_BYTES: [u8; 32] = <[u8; 32]>::from_hex(\"\(.sprout.commitments.finalRoot)\").expect(\"final root bytes are in valid hex representation\").rev();"'
451    //     done
452    pub static ref SPROUT_FINAL_ROOT_MAINNET_347499_BYTES: [u8; 32] =
453        <[u8; 32]>::from_hex("ce01f64025aba7c0e30a29f239f0eecd3cc18e5b1e575ca018c789a99482724f")
454        .expect("final root bytes are in valid hex representation").rev();
455    pub static ref SPROUT_FINAL_ROOT_MAINNET_347500_BYTES: [u8; 32] =
456        <[u8; 32]>::from_hex("ce01f64025aba7c0e30a29f239f0eecd3cc18e5b1e575ca018c789a99482724f")
457        .expect("final root bytes are in valid hex representation").rev();
458    pub static ref SPROUT_FINAL_ROOT_MAINNET_347501_BYTES: [u8; 32] =
459        <[u8; 32]>::from_hex("db036e080299a7401fd816789b5ea1b092ba3dab21e0f1d44161fffa149c65c1")
460        .expect("final root bytes are in valid hex representation").rev();
461
462    // Overwinter transition
463    // for i in 347499 347500 347501; do
464    //     zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
465    // done
466    pub static ref BLOCK_MAINNET_347499_BYTES: Vec<u8> =
467        <Vec<u8>>::from_hex(include_str!("block-main-0-347-499.txt").trim())
468        .expect("Block bytes are in valid hex representation");
469    pub static ref BLOCK_MAINNET_347500_BYTES: Vec<u8> =
470        <Vec<u8>>::from_hex(include_str!("block-main-0-347-500.txt").trim())
471        .expect("Block bytes are in valid hex representation");
472    pub static ref BLOCK_MAINNET_347501_BYTES: Vec<u8> =
473        <Vec<u8>>::from_hex(include_str!("block-main-0-347-501.txt").trim())
474        .expect("Block bytes are in valid hex representation");
475    // zcash-cli getblock 415000 0 > block-main-0-415-000.txt
476    pub static ref BLOCK_MAINNET_415000_BYTES: Vec<u8> =
477        <Vec<u8>>::from_hex(include_str!("block-main-0-415-000.txt").trim())
478        .expect("Block bytes are in valid hex representation");
479
480    // Sapling transition
481    // for i in 419199 419200 419201 419202; do
482    //     zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
483    // done
484    //
485    // zcashd provides final sapling roots in big-endian order, but Zebra stores
486    // that field in block order internally.
487    //
488    // for i in `cat post_sapling_mainnet_heights`; do
489    //     zcash-cli z_gettreestate "$i" | \
490    //         jq --arg i "$i" \
491    //            --raw-output \
492    //            '"pub static ref SAPLING_FINAL_ROOT_MAINNET_\($i)_BYTES: [u8; 32] = <[u8; 32]>::from_hex(\"\(.sapling.commitments.finalRoot)\").expect(\"final root bytes are in valid hex representation\").rev();"'
493    // done
494    pub static ref BLOCK_MAINNET_419199_BYTES: Vec<u8> =
495        <Vec<u8>>::from_hex(include_str!("block-main-0-419-199.txt").trim())
496        .expect("Block bytes are in valid hex representation");
497    pub static ref BLOCK_MAINNET_419200_BYTES: Vec<u8> =
498        <Vec<u8>>::from_hex(include_str!("block-main-0-419-200.txt").trim())
499        .expect("Block bytes are in valid hex representation");
500    pub static ref BLOCK_MAINNET_419201_BYTES: Vec<u8> =
501        <Vec<u8>>::from_hex(include_str!("block-main-0-419-201.txt").trim())
502        .expect("Block bytes are in valid hex representation");
503    pub static ref BLOCK_MAINNET_419202_BYTES: Vec<u8> =
504        <Vec<u8>>::from_hex(include_str!("block-main-0-419-202.txt").trim())
505        .expect("Block bytes are in valid hex representation");
506    pub static ref SAPLING_FINAL_ROOT_MAINNET_419200_BYTES: [u8; 32] =
507        <[u8; 32]>::from_hex("3e49b5f954aa9d3545bc6c37744661eea48d7c34e3000d82b7f0010c30f4c2fb")
508        .expect("final root bytes are in valid hex representation").rev();
509    pub static ref SAPLING_FINAL_ROOT_MAINNET_419201_BYTES: [u8; 32] =
510        <[u8; 32]>::from_hex("638d7e5ba37ab7921c51a4f3ae1b32d71c605a0ed9be7477928111a637f7421b")
511        .expect("final root bytes are in valid hex representation").rev();
512    pub static ref SAPLING_FINAL_ROOT_MAINNET_419202_BYTES: [u8; 32] =
513        <[u8; 32]>::from_hex("54393f89293c8af01eb985398f5a984c446dd2974bf6ab63fdacbaf32d27a107")
514        .expect("final root bytes are in valid hex representation").rev();
515
516    // this one has a bad version field
517    // zcash-cli getblock 434873 0 > block-main-0-434-873.txt
518    pub static ref BLOCK_MAINNET_434873_BYTES: Vec<u8> =
519        <Vec<u8>>::from_hex(include_str!("block-main-0-434-873.txt").trim())
520        .expect("Block bytes are in valid hex representation");
521    pub static ref SAPLING_FINAL_ROOT_MAINNET_434873_BYTES: [u8; 32] =
522        <[u8; 32]>::from_hex("56e33199bc41d146cb24d24a65db35101248a1d12fff33affef56f90081a9517")
523        .expect("final root bytes are in valid hex representation").rev();
524
525    // Blossom transition
526    // for i in 653599 653600 653601; do
527    //     zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
528    // done
529    pub static ref BLOCK_MAINNET_653599_BYTES: Vec<u8> =
530        <Vec<u8>>::from_hex(include_str!("block-main-0-653-599.txt").trim())
531        .expect("Block bytes are in valid hex representation");
532    pub static ref BLOCK_MAINNET_653600_BYTES: Vec<u8> =
533        <Vec<u8>>::from_hex(include_str!("block-main-0-653-600.txt").trim())
534        .expect("Block bytes are in valid hex representation");
535    pub static ref BLOCK_MAINNET_653601_BYTES: Vec<u8> =
536        <Vec<u8>>::from_hex(include_str!("block-main-0-653-601.txt").trim())
537        .expect("Block bytes are in valid hex representation");
538    pub static ref SAPLING_FINAL_ROOT_MAINNET_653599_BYTES: [u8; 32] =
539        <[u8; 32]>::from_hex("3d532d101b9171769423a9f45a65b6312e28e7aa92b627cb81810f7a6fe21c6a")
540        .expect("final root bytes are in valid hex representation").rev();
541    pub static ref SAPLING_FINAL_ROOT_MAINNET_653600_BYTES: [u8; 32] =
542        <[u8; 32]>::from_hex("3d532d101b9171769423a9f45a65b6312e28e7aa92b627cb81810f7a6fe21c6a")
543        .expect("final root bytes are in valid hex representation").rev();
544    pub static ref SAPLING_FINAL_ROOT_MAINNET_653601_BYTES: [u8; 32] =
545        <[u8; 32]>::from_hex("612c62e54ef55f7bf8a60281debf1df904bf1fa6d1fa65d9656302b44ea98427")
546        .expect("final root bytes are in valid hex representation").rev();
547
548    // Heartwood transition
549    // i=902999
550    // zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
551    pub static ref BLOCK_MAINNET_902999_BYTES: Vec<u8> =
552        <Vec<u8>>::from_hex(include_str!("block-main-0-902-999.txt").trim())
553        .expect("Block bytes are in valid hex representation");
554    // for i in 903000 903001; do
555    //     zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-00$[i%1000].txt
556    // done
557    pub static ref BLOCK_MAINNET_903000_BYTES: Vec<u8> =
558        <Vec<u8>>::from_hex(include_str!("block-main-0-903-000.txt").trim())
559        .expect("Block bytes are in valid hex representation");
560    pub static ref BLOCK_MAINNET_903001_BYTES: Vec<u8> =
561        <Vec<u8>>::from_hex(include_str!("block-main-0-903-001.txt").trim())
562        .expect("Block bytes are in valid hex representation");
563    pub static ref SAPLING_FINAL_ROOT_MAINNET_902999_BYTES: [u8; 32] =
564        <[u8; 32]>::from_hex("49df1a6e62458b0226b9d6c0c28fb7e94d9ca840582878b10d0117fd028b4e91")
565        .expect("final root bytes are in valid hex representation").rev();
566    pub static ref SAPLING_FINAL_ROOT_MAINNET_903000_BYTES: [u8; 32] =
567        <[u8; 32]>::from_hex("11e48300f0e2296d5c413340b26426eddada1155155f4e959ebe307396976c79")
568        .expect("final root bytes are in valid hex representation").rev();
569    pub static ref SAPLING_FINAL_ROOT_MAINNET_903001_BYTES: [u8; 32] =
570        <[u8; 32]>::from_hex("14e3c2b8af239bc4e17486573c20824292d5e1a6670dedf58bf865159e389cce")
571        .expect("final root bytes are in valid hex representation").rev();
572
573    // Shielded coinbase
574    // for i in 949496 982681; do
575    //     zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
576    // done
577    // i=975066
578    // zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-0$[i%1000].txt
579    // First shielded coinbase block
580    pub static ref BLOCK_MAINNET_949496_BYTES: Vec<u8> =
581        <Vec<u8>>::from_hex(include_str!("block-main-0-949-496.txt").trim())
582        .expect("Block bytes are in valid hex representation");
583    // Largest shielded coinbase block so far (in bytes)
584    pub static ref BLOCK_MAINNET_975066_BYTES: Vec<u8> =
585        <Vec<u8>>::from_hex(include_str!("block-main-0-975-066.txt").trim())
586        .expect("Block bytes are in valid hex representation");
587    // Last shielded coinbase block so far
588    pub static ref BLOCK_MAINNET_982681_BYTES: Vec<u8> =
589        <Vec<u8>>::from_hex(include_str!("block-main-0-982-681.txt").trim())
590        .expect("Block bytes are in valid hex representation");
591    pub static ref SAPLING_FINAL_ROOT_MAINNET_949496_BYTES: [u8; 32] =
592        <[u8; 32]>::from_hex("4db238913a86284f5bddb9bcfe76f96a46d097ec681aad1da846cc276bfa7263")
593        .expect("final root bytes are in valid hex representation").rev();
594    pub static ref SAPLING_FINAL_ROOT_MAINNET_975066_BYTES: [u8; 32] =
595        <[u8; 32]>::from_hex("2f62381b6decd0e0f937f6aa23faa7d19444b784701be93ad7e4df31bd4da1f9")
596        .expect("final root bytes are in valid hex representation").rev();
597    pub static ref SAPLING_FINAL_ROOT_MAINNET_982681_BYTES: [u8; 32] =
598        <[u8; 32]>::from_hex("4fd1cb6d1e5c479baa44fcb7c3a1c6fafdaa54c0456d254918cd63839805848d")
599        .expect("final root bytes are in valid hex representation").rev();
600
601    // Canopy transition and Coinbase Halving
602    // (On mainnet, Canopy happens at the same block as the first coinbase halving)
603    // for i in 1046399 1046400; do
604    //     zcash-cli getblock $i 0 > block-main-$[i/1000000]-0$[i/1000%1000]-$[i%1000].txt
605    // done
606    pub static ref BLOCK_MAINNET_1046399_BYTES: Vec<u8> =
607        <Vec<u8>>::from_hex(include_str!("block-main-1-046-399.txt").trim())
608        .expect("Block bytes are in valid hex representation");
609    pub static ref BLOCK_MAINNET_1046400_BYTES: Vec<u8> =
610        <Vec<u8>>::from_hex(include_str!("block-main-1-046-400.txt").trim())
611        .expect("Block bytes are in valid hex representation");
612    // Block 1046401 is 72 kB in size (currently the second-largest test vector), so we store it in binary.
613    // i=1046401
614    // zcash-cli getblock $i 0 | xxd -revert -plain > block-main-$[i/1000000]-0$[i/1000%1000]-$[i%1000].bin
615    pub static ref BLOCK_MAINNET_1046401_BYTES: Vec<u8> =
616        include_bytes!("block-main-1-046-401.bin")
617        .to_vec();
618    pub static ref SAPLING_FINAL_ROOT_MAINNET_1046399_BYTES: [u8; 32] =
619        <[u8; 32]>::from_hex("0f12c92f737e84142792bddc82e36481de4a7679d5778a27389793933c8742e1")
620        .expect("final root bytes are in valid hex representation").rev();
621    pub static ref SAPLING_FINAL_ROOT_MAINNET_1046400_BYTES: [u8; 32] =
622        <[u8; 32]>::from_hex("0f12c92f737e84142792bddc82e36481de4a7679d5778a27389793933c8742e1")
623        .expect("final root bytes are in valid hex representation").rev();
624    pub static ref SAPLING_FINAL_ROOT_MAINNET_1046401_BYTES: [u8; 32] =
625        <[u8; 32]>::from_hex("1cb7a61a31354384957eea0b98661e1cf85a5de8e43f0e3bef522c8b375b26cb")
626        .expect("final root bytes are in valid hex representation").rev();
627
628    // One more Canopy/Post-Halving block
629    // (so that we have at least 3 blocks after canopy/halving)
630    // i=1180900
631    // zcash-cli getblock $i 0 > block-main-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
632    pub static ref BLOCK_MAINNET_1180900_BYTES: Vec<u8> =
633        <Vec<u8>>::from_hex(include_str!("block-main-1-180-900.txt").trim())
634        .expect("Block bytes are in valid hex representation");
635    pub static ref SAPLING_FINAL_ROOT_MAINNET_1180900_BYTES: [u8; 32] =
636        <[u8; 32]>::from_hex("4a51c1b879f49637873ac4b261e9c625e16d9400b22d8aa4f27cd6fd1138ddda")
637        .expect("final root bytes are in valid hex representation").rev();
638
639    // NU5
640    pub static ref BLOCK_MAINNET_1687106_BYTES: Vec<u8> =
641        <Vec<u8>>::from_hex(include_str!("block-main-1-687-106.txt").trim())
642        .expect("Block bytes are in valid hex representation");
643    pub static ref SAPLING_FINAL_ROOT_MAINNET_1687106_BYTES: [u8; 32] =
644        <[u8; 32]>::from_hex("41f3adfe94f336b6581923c9d20e07bccab0c47cd57ecb66cb9f35bb3e62066f")
645        .expect("final root bytes are in valid hex representation").rev();
646    pub static ref ORCHARD_FINAL_ROOT_MAINNET_1687106_BYTES: [u8; 32] =
647        <[u8; 32]>::from_hex("ae2935f1dfd8a24aed7c70df7de3a668eb7a49b1319880dde2bbd9031ae5d82f")
648        .expect("final root bytes are in valid hex representation").rev();
649    pub static ref BLOCK_MAINNET_1687107_BYTES: Vec<u8> =
650        <Vec<u8>>::from_hex(include_str!("block-main-1-687-107.txt").trim())
651        .expect("Block bytes are in valid hex representation");
652    pub static ref SAPLING_FINAL_ROOT_MAINNET_1687107_BYTES: [u8; 32] =
653        <[u8; 32]>::from_hex("4b013ee86a4a7b19871aa9b7a1dff0b29e0a737812c8970356c18340752957c7")
654        .expect("final root bytes are in valid hex representation").rev();
655    pub static ref ORCHARD_FINAL_ROOT_MAINNET_1687107_BYTES: [u8; 32] =
656        <[u8; 32]>::from_hex("7b61fc613cea5c2c84c5e2c64d4fd4afb8c8c9d10dce9bcad49431c9cf32f131")
657        .expect("final root bytes are in valid hex representation").rev();
658    pub static ref BLOCK_MAINNET_1687108_BYTES: Vec<u8> =
659        <Vec<u8>>::from_hex(include_str!("block-main-1-687-108.txt").trim())
660        .expect("Block bytes are in valid hex representation");
661    pub static ref SAPLING_FINAL_ROOT_MAINNET_1687108_BYTES: [u8; 32] =
662        <[u8; 32]>::from_hex("174d81c4d858ab7932c424ee44f5e47ceafc50fcc44fb39bfaf74258570eb9b2")
663        .expect("final root bytes are in valid hex representation").rev();
664    pub static ref ORCHARD_FINAL_ROOT_MAINNET_1687108_BYTES: [u8; 32] =
665        <[u8; 32]>::from_hex("7b61fc613cea5c2c84c5e2c64d4fd4afb8c8c9d10dce9bcad49431c9cf32f131")
666        .expect("final root bytes are in valid hex representation").rev();
667    pub static ref BLOCK_MAINNET_1687113_BYTES: Vec<u8> =
668        <Vec<u8>>::from_hex(include_str!("block-main-1-687-113.txt").trim())
669        .expect("Block bytes are in valid hex representation");
670    pub static ref SAPLING_FINAL_ROOT_MAINNET_1687113_BYTES: [u8; 32] =
671        <[u8; 32]>::from_hex("53189fd8855fb8d8f49a4cf505669ce6fd95e28abfe8f3def7c2493b1ae4fc1f")
672        .expect("final root bytes are in valid hex representation").rev();
673    pub static ref ORCHARD_FINAL_ROOT_MAINNET_1687113_BYTES: [u8; 32] =
674        <[u8; 32]>::from_hex("ed17182c783c649f53c0ecfe900a58cd818e89d2784f750df6c906999337dc10")
675        .expect("final root bytes are in valid hex representation").rev();
676    pub static ref BLOCK_MAINNET_1687118_BYTES: Vec<u8> =
677        <Vec<u8>>::from_hex(include_str!("block-main-1-687-118.txt").trim())
678        .expect("Block bytes are in valid hex representation");
679    pub static ref SAPLING_FINAL_ROOT_MAINNET_1687118_BYTES: [u8; 32] =
680        <[u8; 32]>::from_hex("50f2481034cb80ec7e3e56177981ab47739e5a0c650638b2ac29909468c5f225")
681        .expect("final root bytes are in valid hex representation").rev();
682    pub static ref ORCHARD_FINAL_ROOT_MAINNET_1687118_BYTES: [u8; 32] =
683        <[u8; 32]>::from_hex("d5226e91ca7f9275d7f62711fa52875cdbae6cfc689815c9872aebfe64b60f34")
684        .expect("final root bytes are in valid hex representation").rev();
685    pub static ref BLOCK_MAINNET_1687121_BYTES: Vec<u8> =
686        <Vec<u8>>::from_hex(include_str!("block-main-1-687-121.txt").trim())
687        .expect("Block bytes are in valid hex representation");
688    pub static ref SAPLING_FINAL_ROOT_MAINNET_1687121_BYTES: [u8; 32] =
689        <[u8; 32]>::from_hex("39e29473df7f0692ab6072d65389f6626611fea9f00aea14c0d80add9e9ef6e5")
690        .expect("final root bytes are in valid hex representation").rev();
691    pub static ref ORCHARD_FINAL_ROOT_MAINNET_1687121_BYTES: [u8; 32] =
692        <[u8; 32]>::from_hex("09b17d8907236adea12b83ed69054f4996686d7c4ca76db25c4c48b90e272b0f")
693        .expect("final root bytes are in valid hex representation").rev();
694
695    // Sapling treestate.
696    pub static ref SAPLING_TREESTATE_MAINNET_419201_STRING: String =
697        String::from(include_str!("sapling-treestate-main-0-419-201.txt"));
698
699    // Testnet
700
701    // Genesis/BeforeOverwinter
702    // for i in `seq 0 9`; do
703    //     zcash-cli -testnet getblock $i 0 > block-test-0-000-00$i.txt
704    // done
705    pub static ref BLOCK_TESTNET_GENESIS_BYTES: Vec<u8> =
706        <Vec<u8>>::from_hex(include_str!("block-test-0-000-000.txt").trim())
707        .expect("Block bytes are in valid hex representation");
708    pub static ref BLOCK_TESTNET_1_BYTES: Vec<u8> =
709        <Vec<u8>>::from_hex(include_str!("block-test-0-000-001.txt").trim())
710        .expect("Block bytes are in valid hex representation");
711    pub static ref BLOCK_TESTNET_2_BYTES: Vec<u8> =
712        <Vec<u8>>::from_hex(include_str!("block-test-0-000-002.txt").trim())
713        .expect("Block bytes are in valid hex representation");
714    pub static ref BLOCK_TESTNET_3_BYTES: Vec<u8> =
715        <Vec<u8>>::from_hex(include_str!("block-test-0-000-003.txt").trim())
716        .expect("Block bytes are in valid hex representation");
717    pub static ref BLOCK_TESTNET_4_BYTES: Vec<u8> =
718        <Vec<u8>>::from_hex(include_str!("block-test-0-000-004.txt").trim())
719        .expect("Block bytes are in valid hex representation");
720    pub static ref BLOCK_TESTNET_5_BYTES: Vec<u8> =
721        <Vec<u8>>::from_hex(include_str!("block-test-0-000-005.txt").trim())
722        .expect("Block bytes are in valid hex representation");
723    pub static ref BLOCK_TESTNET_6_BYTES: Vec<u8> =
724        <Vec<u8>>::from_hex(include_str!("block-test-0-000-006.txt").trim())
725        .expect("Block bytes are in valid hex representation");
726    pub static ref BLOCK_TESTNET_7_BYTES: Vec<u8> =
727        <Vec<u8>>::from_hex(include_str!("block-test-0-000-007.txt").trim())
728        .expect("Block bytes are in valid hex representation");
729    pub static ref BLOCK_TESTNET_8_BYTES: Vec<u8> =
730        <Vec<u8>>::from_hex(include_str!("block-test-0-000-008.txt").trim())
731        .expect("Block bytes are in valid hex representation");
732    pub static ref BLOCK_TESTNET_9_BYTES: Vec<u8> =
733        <Vec<u8>>::from_hex(include_str!("block-test-0-000-009.txt").trim())
734        .expect("Block bytes are in valid hex representation");
735    // zcash-cli -testnet getblock 10 0 > block-test-0-000-010.txt
736    pub static ref BLOCK_TESTNET_10_BYTES: Vec<u8> =
737        <Vec<u8>>::from_hex(include_str!("block-test-0-000-010.txt").trim())
738        .expect("Block bytes are in valid hex representation");
739    // zcash-cli -testnet getblock 2259 0 > block-test-0-002-259.txt
740    pub static ref BLOCK_TESTNET_2259_BYTES: Vec<u8> =
741        <Vec<u8>>::from_hex(include_str!("block-test-0-002-259.txt").trim())
742        .expect("Block bytes are in valid hex representation");
743    // A large block
744    // i=141042
745    // zcash-cli -testnet getblock $i 0 | xxd -revert -plain > block-test-$[i/1000000]-$[i/1000%1000]-0$[i%1000].bin
746    //
747    // Block 141042 is almost ~2 MB in size (the maximum size for a block),
748    // and contains 1 coinbase reward transaction and 20 transactions.
749    // In each transaction, there is one joinsplit, with 244 inputs and 0 outputs.
750    // https://zcash.readthedocs.io/en/latest/rtd_pages/shield_coinbase.html
751    //
752    // We store large blocks as binary, to reduce disk and network usage.
753    // (git compresses blocks in transit and in its index, so there is not much need for extra compression.)
754    pub static ref BLOCK_TESTNET_141042_BYTES: Vec<u8> = include_bytes!("block-test-0-141-042.bin").to_vec();
755
756    // # Anchors for Sprout, starting at Genesis.
757    //
758    // for i in 0 396; do
759    //     zcash-cli z_gettreestate "$i" | \
760    //     jq --arg i "$i" \
761    //     --raw-output \
762    //     '"pub static ref SPROUT_FINAL_ROOT_TESTNET_\($i)_BYTES: [u8; 32] = <[u8; 32]>::from_hex(\"\(.sprout.commitments.finalRoot)\").expect(\"final root bytes are in valid hex representation\").rev();"'
763    //     done
764    pub static ref SPROUT_FINAL_ROOT_TESTNET_0_BYTES: [u8; 32] =
765        <[u8; 32]>::from_hex("59d2cde5e65c1414c32ba54f0fe4bdb3d67618125286e6a191317917c812c6d7")
766        .expect("final root bytes are in valid hex representation").rev();
767    // The first block that contains a tx with a JoinSplit.
768    pub static ref SPROUT_FINAL_ROOT_TESTNET_2259_BYTES: [u8; 32] =
769        <[u8; 32]>::from_hex("2985231c8b3fb5624299fd7289c33667b0270a3fcde420c9047a6bad41f07733")
770        .expect("final root bytes are in valid hex representation").rev();
771
772    // Overwinter transition
773    // for i in 207499 207500 207501; do
774    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
775    // done
776    pub static ref BLOCK_TESTNET_207499_BYTES: Vec<u8> =
777        <Vec<u8>>::from_hex(include_str!("block-test-0-207-499.txt").trim())
778        .expect("Block bytes are in valid hex representation");
779    pub static ref BLOCK_TESTNET_207500_BYTES: Vec<u8> =
780        <Vec<u8>>::from_hex(include_str!("block-test-0-207-500.txt").trim())
781        .expect("Block bytes are in valid hex representation");
782    pub static ref BLOCK_TESTNET_207501_BYTES: Vec<u8> =
783        <Vec<u8>>::from_hex(include_str!("block-test-0-207-501.txt").trim())
784        .expect("Block bytes are in valid hex representation");
785
786    // Sapling transition
787    // i=279999
788    // zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
789    // for i in 280000 280001; do
790    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-00$[i%1000].txt
791    // done
792    //
793    // for i in `cat post_sapling_testnet_heights`; do
794    //     zcash-cli -testnet z_gettreestate "$i" | \
795    //         jq --arg i "$i" \
796    //            --raw-output \
797    //            '"pub static ref SAPLING_FINAL_ROOT_TESTNET_\($i)_BYTES: [u8; 32] = <[u8; 32]>::from_hex(\"\(.sapling.commitments.finalRoot)\").expect(\"final root bytes are in valid hex representation\").rev();"'
798    // done
799    pub static ref BLOCK_TESTNET_279999_BYTES: Vec<u8> =
800        <Vec<u8>>::from_hex(include_str!("block-test-0-279-999.txt").trim())
801        .expect("Block bytes are in valid hex representation");
802    pub static ref BLOCK_TESTNET_280000_BYTES: Vec<u8> =
803        <Vec<u8>>::from_hex(include_str!("block-test-0-280-000.txt").trim())
804        .expect("Block bytes are in valid hex representation");
805    pub static ref BLOCK_TESTNET_280001_BYTES: Vec<u8> =
806        <Vec<u8>>::from_hex(include_str!("block-test-0-280-001.txt").trim())
807        .expect("Block bytes are in valid hex representation");
808    pub static ref SAPLING_FINAL_ROOT_TESTNET_280000_BYTES: [u8; 32] =
809        <[u8; 32]>::from_hex("3e49b5f954aa9d3545bc6c37744661eea48d7c34e3000d82b7f0010c30f4c2fb")
810        .expect("final root bytes are in valid hex representation").rev();
811    pub static ref SAPLING_FINAL_ROOT_TESTNET_280001_BYTES: [u8; 32] =
812        <[u8; 32]>::from_hex("3e49b5f954aa9d3545bc6c37744661eea48d7c34e3000d82b7f0010c30f4c2fb")
813        .expect("final root bytes are in valid hex representation").rev();
814
815    // The first minimum difficulty blocks 299188, 299189, 299202 and their previous blocks for context
816    // (pre-Blossom minimum difficulty)
817    //
818    // for i in 299187 299188 299189 299201 299202; do
819    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
820    // done
821    pub static ref BLOCK_TESTNET_299187_BYTES: Vec<u8> =
822        <Vec<u8>>::from_hex(include_str!("block-test-0-299-187.txt").trim())
823        .expect("Block bytes are in valid hex representation");
824    pub static ref BLOCK_TESTNET_299188_BYTES: Vec<u8> =
825        <Vec<u8>>::from_hex(include_str!("block-test-0-299-188.txt").trim())
826        .expect("Block bytes are in valid hex representation");
827    pub static ref BLOCK_TESTNET_299189_BYTES: Vec<u8> =
828        <Vec<u8>>::from_hex(include_str!("block-test-0-299-189.txt").trim())
829        .expect("Block bytes are in valid hex representation");
830    pub static ref BLOCK_TESTNET_299201_BYTES: Vec<u8> =
831        <Vec<u8>>::from_hex(include_str!("block-test-0-299-201.txt").trim())
832        .expect("Block bytes are in valid hex representation");
833    pub static ref BLOCK_TESTNET_299202_BYTES: Vec<u8> =
834        <Vec<u8>>::from_hex(include_str!("block-test-0-299-202.txt").trim())
835        .expect("Block bytes are in valid hex representation");
836    pub static ref SAPLING_FINAL_ROOT_TESTNET_299187_BYTES: [u8; 32] =
837        <[u8; 32]>::from_hex("6815df99f9f7ec9486a0b3a4e992ff9348dba7101c2ac91be41ceab392aa5521")
838        .expect("final root bytes are in valid hex representation").rev();
839    pub static ref SAPLING_FINAL_ROOT_TESTNET_299188_BYTES: [u8; 32] =
840        <[u8; 32]>::from_hex("6815df99f9f7ec9486a0b3a4e992ff9348dba7101c2ac91be41ceab392aa5521")
841        .expect("final root bytes are in valid hex representation").rev();
842    pub static ref SAPLING_FINAL_ROOT_TESTNET_299189_BYTES: [u8; 32] =
843        <[u8; 32]>::from_hex("6815df99f9f7ec9486a0b3a4e992ff9348dba7101c2ac91be41ceab392aa5521")
844        .expect("final root bytes are in valid hex representation").rev();
845    pub static ref SAPLING_FINAL_ROOT_TESTNET_299201_BYTES: [u8; 32] =
846        <[u8; 32]>::from_hex("6815df99f9f7ec9486a0b3a4e992ff9348dba7101c2ac91be41ceab392aa5521")
847        .expect("final root bytes are in valid hex representation").rev();
848    pub static ref SAPLING_FINAL_ROOT_TESTNET_299202_BYTES: [u8; 32] =
849        <[u8; 32]>::from_hex("6815df99f9f7ec9486a0b3a4e992ff9348dba7101c2ac91be41ceab392aa5521")
850        .expect("final root bytes are in valid hex representation").rev();
851
852    // Blossom transition
853    // i=583999
854    // zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
855    // for i in 584000 584001; do
856    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-00$[i%1000].txt
857    // done
858    pub static ref BLOCK_TESTNET_583999_BYTES: Vec<u8> =
859        <Vec<u8>>::from_hex(include_str!("block-test-0-583-999.txt").trim())
860        .expect("Block bytes are in valid hex representation");
861    // The first post-Blossom minimum difficulty block is the activation block
862    pub static ref BLOCK_TESTNET_584000_BYTES: Vec<u8> =
863        <Vec<u8>>::from_hex(include_str!("block-test-0-584-000.txt").trim())
864        .expect("Block bytes are in valid hex representation");
865    pub static ref BLOCK_TESTNET_584001_BYTES: Vec<u8> =
866        <Vec<u8>>::from_hex(include_str!("block-test-0-584-001.txt").trim())
867        .expect("Block bytes are in valid hex representation");
868    pub static ref SAPLING_FINAL_ROOT_TESTNET_583999_BYTES: [u8; 32] =
869        <[u8; 32]>::from_hex("13746c0c426cdddd05f85d86231f8bc647f5b024277c606c309ef707d85fd652")
870        .expect("final root bytes are in valid hex representation").rev();
871    pub static ref SAPLING_FINAL_ROOT_TESTNET_584000_BYTES: [u8; 32] =
872        <[u8; 32]>::from_hex("13746c0c426cdddd05f85d86231f8bc647f5b024277c606c309ef707d85fd652")
873        .expect("final root bytes are in valid hex representation").rev();
874    pub static ref SAPLING_FINAL_ROOT_TESTNET_584001_BYTES: [u8; 32] =
875        <[u8; 32]>::from_hex("13746c0c426cdddd05f85d86231f8bc647f5b024277c606c309ef707d85fd652")
876        .expect("final root bytes are in valid hex representation").rev();
877
878    // Heartwood transition
879    // for i in 903799 903800 903801; do
880    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
881    // done
882    pub static ref BLOCK_TESTNET_903799_BYTES: Vec<u8> =
883        <Vec<u8>>::from_hex(include_str!("block-test-0-903-799.txt").trim())
884        .expect("Block bytes are in valid hex representation");
885    pub static ref BLOCK_TESTNET_903800_BYTES: Vec<u8> =
886        <Vec<u8>>::from_hex(include_str!("block-test-0-903-800.txt").trim())
887        .expect("Block bytes are in valid hex representation");
888    pub static ref BLOCK_TESTNET_903801_BYTES: Vec<u8> =
889        <Vec<u8>>::from_hex(include_str!("block-test-0-903-801.txt").trim())
890        .expect("Block bytes are in valid hex representation");
891    pub static ref SAPLING_FINAL_ROOT_TESTNET_903799_BYTES: [u8; 32] =
892        <[u8; 32]>::from_hex("626444395cd5963d3dba2652ee5bd73ef57555cca4d9f0d52e887a3bf44488e2")
893        .expect("final root bytes are in valid hex representation").rev();
894    pub static ref SAPLING_FINAL_ROOT_TESTNET_903800_BYTES: [u8; 32] =
895        <[u8; 32]>::from_hex("626444395cd5963d3dba2652ee5bd73ef57555cca4d9f0d52e887a3bf44488e2")
896        .expect("final root bytes are in valid hex representation").rev();
897    pub static ref SAPLING_FINAL_ROOT_TESTNET_903801_BYTES: [u8; 32] =
898        <[u8; 32]>::from_hex("626444395cd5963d3dba2652ee5bd73ef57555cca4d9f0d52e887a3bf44488e2")
899        .expect("final root bytes are in valid hex representation").rev();
900
901    // Shielded coinbase
902    // for i in 914678 925483; do
903    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
904    // done
905    // First shielded coinbase block
906    pub static ref BLOCK_TESTNET_914678_BYTES: Vec<u8> =
907        <Vec<u8>>::from_hex(include_str!("block-test-0-914-678.txt").trim())
908        .expect("Block bytes are in valid hex representation");
909    // Largest shielded coinbase block so far (in bytes)
910    pub static ref BLOCK_TESTNET_925483_BYTES: Vec<u8> =
911        <Vec<u8>>::from_hex(include_str!("block-test-0-925-483.txt").trim())
912        .expect("Block bytes are in valid hex representation");
913    pub static ref SAPLING_FINAL_ROOT_TESTNET_914678_BYTES: [u8; 32] =
914        <[u8; 32]>::from_hex("0ba286a3fb00d8a63b6ea52064bcc58ffb859aaa881745157d9a67d20afd7a8d")
915        .expect("final root bytes are in valid hex representation").rev();
916    pub static ref SAPLING_FINAL_ROOT_TESTNET_925483_BYTES: [u8; 32] =
917        <[u8; 32]>::from_hex("271370ff86c2a9cc452334098d3337cddffc478e66a356dc0c00aebb58a4b6ac")
918        .expect("final root bytes are in valid hex representation").rev();
919
920    // Canopy transition
921    // for i in 1028499 1028500 1028501; do
922    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-0$[i/1000%1000]-$[i%1000].txt
923    // done
924    pub static ref BLOCK_TESTNET_1028499_BYTES: Vec<u8> =
925        <Vec<u8>>::from_hex(include_str!("block-test-1-028-499.txt").trim())
926        .expect("Block bytes are in valid hex representation");
927    pub static ref BLOCK_TESTNET_1028500_BYTES: Vec<u8> =
928        <Vec<u8>>::from_hex(include_str!("block-test-1-028-500.txt").trim())
929        .expect("Block bytes are in valid hex representation");
930    pub static ref BLOCK_TESTNET_1028501_BYTES: Vec<u8> =
931        <Vec<u8>>::from_hex(include_str!("block-test-1-028-501.txt").trim())
932        .expect("Block bytes are in valid hex representation");
933    pub static ref SAPLING_FINAL_ROOT_TESTNET_1028499_BYTES: [u8; 32] =
934        <[u8; 32]>::from_hex("580adc0253cd0545250039267b7b49445ca0550df735920b7466bba1a64f7cf7")
935        .expect("final root bytes are in valid hex representation").rev();
936    pub static ref SAPLING_FINAL_ROOT_TESTNET_1028500_BYTES: [u8; 32] =
937        <[u8; 32]>::from_hex("580adc0253cd0545250039267b7b49445ca0550df735920b7466bba1a64f7cf7")
938        .expect("final root bytes are in valid hex representation").rev();
939    pub static ref SAPLING_FINAL_ROOT_TESTNET_1028501_BYTES: [u8; 32] =
940        <[u8; 32]>::from_hex("580adc0253cd0545250039267b7b49445ca0550df735920b7466bba1a64f7cf7")
941        .expect("final root bytes are in valid hex representation").rev();
942
943    // One more Canopy block
944    // (so that we have at least 3 blocks from Canopy)
945    // i=1095000
946    // zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-0$[i/1000%1000]-00$[i%1000].txt
947    pub static ref BLOCK_TESTNET_1095000_BYTES: Vec<u8> =
948        <Vec<u8>>::from_hex(include_str!("block-test-1-095-000.txt").trim())
949        .expect("Block bytes are in valid hex representation");
950    pub static ref SAPLING_FINAL_ROOT_TESTNET_1095000_BYTES: [u8; 32] =
951        <[u8; 32]>::from_hex("1781d73666ceb7675323130defd5fae426f1ee7d5fbb83adc9393aa8ff7e8a8d")
952        .expect("final root bytes are in valid hex representation").rev();
953
954    // Shielded coinbase + Canopy
955    // i=1101629
956    // zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-0$[i/1000%1000]-$[i%1000].txt
957    // Last shielded coinbase block so far
958    pub static ref BLOCK_TESTNET_1101629_BYTES: Vec<u8> =
959        <Vec<u8>>::from_hex(include_str!("block-test-1-101-629.txt").trim())
960        .expect("Block bytes are in valid hex representation");
961    pub static ref SAPLING_FINAL_ROOT_TESTNET_1101629_BYTES: [u8; 32] =
962        <[u8; 32]>::from_hex("14c7c827cd05c73c052c2a9faa6d7fc7b45ec2e386d8894eb65c420175c43745")
963        .expect("final root bytes are in valid hex representation").rev();
964
965    // Testnet Coinbase Halving
966    // i=1115999
967    // zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
968    // for i in 1116000 1116001; do
969    //     zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-00$[i%1000].txt
970    // done
971    pub static ref BLOCK_TESTNET_1115999_BYTES: Vec<u8> =
972        <Vec<u8>>::from_hex(include_str!("block-test-1-115-999.txt").trim())
973        .expect("Block bytes are in valid hex representation");
974    pub static ref BLOCK_TESTNET_1116000_BYTES: Vec<u8> =
975        <Vec<u8>>::from_hex(include_str!("block-test-1-116-000.txt").trim())
976        .expect("Block bytes are in valid hex representation");
977    pub static ref BLOCK_TESTNET_1116001_BYTES: Vec<u8> =
978        <Vec<u8>>::from_hex(include_str!("block-test-1-116-001.txt").trim())
979        .expect("Block bytes are in valid hex representation");
980    pub static ref SAPLING_FINAL_ROOT_TESTNET_1115999_BYTES: [u8; 32] =
981        <[u8; 32]>::from_hex("14b41a6dd7cd3c113d98f72543c4f57ff4e444bd5995366e0da420169c861f37")
982        .expect("final root bytes are in valid hex representation").rev();
983    pub static ref SAPLING_FINAL_ROOT_TESTNET_1116000_BYTES: [u8; 32] =
984        <[u8; 32]>::from_hex("14b41a6dd7cd3c113d98f72543c4f57ff4e444bd5995366e0da420169c861f37")
985        .expect("final root bytes are in valid hex representation").rev();
986    pub static ref SAPLING_FINAL_ROOT_TESTNET_1116001_BYTES: [u8; 32] =
987        <[u8; 32]>::from_hex("14b41a6dd7cd3c113d98f72543c4f57ff4e444bd5995366e0da420169c861f37")
988        .expect("final root bytes are in valid hex representation").rev();
989
990    // One more Post-Halving block
991    // (so that we have at least 3 blocks after the halving)
992    // i=1326100
993    // zcash-cli -testnet getblock $i 0 > block-test-$[i/1000000]-$[i/1000%1000]-$[i%1000].txt
994    pub static ref BLOCK_TESTNET_1326100_BYTES: Vec<u8> =
995        <Vec<u8>>::from_hex(include_str!("block-test-1-326-100.txt").trim())
996        .expect("Block bytes are in valid hex representation");
997    pub static ref SAPLING_FINAL_ROOT_TESTNET_1326100_BYTES: [u8; 32] =
998        <[u8; 32]>::from_hex("2b30b19f4254709fe365bd0b381b2e3d9d0c933eb4dba4dd1d07f0f6e196a183")
999        .expect("final root bytes are in valid hex representation").rev();
1000
1001    // NU5
1002    pub static ref BLOCK_TESTNET_1842421_BYTES: Vec<u8> =
1003        <Vec<u8>>::from_hex(include_str!("block-test-1-842-421.txt").trim())
1004        .expect("Block bytes are in valid hex representation");
1005    pub static ref SAPLING_FINAL_ROOT_TESTNET_1842421_BYTES: [u8; 32] =
1006        <[u8; 32]>::from_hex("5cad695f17ae06cc165e01938fe95cac3ea0fbd236dc9c806f3411e0929309a6")
1007        .expect("final root bytes are in valid hex representation").rev();
1008    pub static ref ORCHARD_FINAL_ROOT_TESTNET_1842421_BYTES: [u8; 32] =
1009        <[u8; 32]>::from_hex("28dfaa94b74670863beb1088ee3d97b38960c6c297c9dcf3d57d5a9259616523")
1010        .expect("final root bytes are in valid hex representation").rev();
1011    pub static ref BLOCK_TESTNET_1842432_BYTES: Vec<u8> =
1012        <Vec<u8>>::from_hex(include_str!("block-test-1-842-432.txt").trim())
1013        .expect("Block bytes are in valid hex representation");
1014    pub static ref SAPLING_FINAL_ROOT_TESTNET_1842432_BYTES: [u8; 32] =
1015        <[u8; 32]>::from_hex("68626c76ad774e3982450c20900415fd85b33d820627565d588c0c22437d8c62")
1016        .expect("final root bytes are in valid hex representation").rev();
1017    pub static ref ORCHARD_FINAL_ROOT_TESTNET_1842432_BYTES: [u8; 32] =
1018        <[u8; 32]>::from_hex("28dfaa94b74670863beb1088ee3d97b38960c6c297c9dcf3d57d5a9259616523")
1019        .expect("final root bytes are in valid hex representation").rev();
1020    pub static ref BLOCK_TESTNET_1842462_BYTES: Vec<u8> =
1021        <Vec<u8>>::from_hex(include_str!("block-test-1-842-462.txt").trim())
1022        .expect("Block bytes are in valid hex representation");
1023    pub static ref SAPLING_FINAL_ROOT_TESTNET_1842462_BYTES: [u8; 32] =
1024        <[u8; 32]>::from_hex("4c06beb18bb0cb22879f04c2c80aa33450d8e02ddd3d2cbc441f40f8cd8ea0a8")
1025        .expect("final root bytes are in valid hex representation").rev();
1026    pub static ref ORCHARD_FINAL_ROOT_TESTNET_1842462_BYTES: [u8; 32] =
1027        <[u8; 32]>::from_hex("7750114ca6b95e44197e30ec98cadfb0dec1f1fb1a416eb4ef87f1dffb0f5937")
1028        .expect("final root bytes are in valid hex representation").rev();
1029    pub static ref BLOCK_TESTNET_1842467_BYTES: Vec<u8> =
1030        <Vec<u8>>::from_hex(include_str!("block-test-1-842-467.txt").trim())
1031        .expect("Block bytes are in valid hex representation");
1032    pub static ref SAPLING_FINAL_ROOT_TESTNET_1842467_BYTES: [u8; 32] =
1033        <[u8; 32]>::from_hex("13a33099eb9b8dafc031271938f35b627eb0811f124847abbfb43b587c6e11ae")
1034        .expect("final root bytes are in valid hex representation").rev();
1035    pub static ref ORCHARD_FINAL_ROOT_TESTNET_1842467_BYTES: [u8; 32] =
1036        <[u8; 32]>::from_hex("580aceb586f30a5801a23414464aa8482add97b6d55c06483b4ffb725e0e793b")
1037        .expect("final root bytes are in valid hex representation").rev();
1038    pub static ref BLOCK_TESTNET_1842468_BYTES: Vec<u8> =
1039        <Vec<u8>>::from_hex(include_str!("block-test-1-842-468.txt").trim())
1040        .expect("Block bytes are in valid hex representation");
1041    pub static ref SAPLING_FINAL_ROOT_TESTNET_1842468_BYTES: [u8; 32] =
1042        <[u8; 32]>::from_hex("555af4b0b2fa18162d6280c942fae6cdc846b9c4a3126df682821db250dc2bb3")
1043        .expect("final root bytes are in valid hex representation").rev();
1044    pub static ref ORCHARD_FINAL_ROOT_TESTNET_1842468_BYTES: [u8; 32] =
1045        <[u8; 32]>::from_hex("66c47f2160474363948150cbb5d53f3c17efa7456bd843dd9b851ddbcb6fb002")
1046        .expect("final root bytes are in valid hex representation").rev();
1047}
1048
1049#[cfg(test)]
1050mod test {
1051    use super::*;
1052
1053    use std::collections::HashSet;
1054
1055    use crate::init;
1056
1057    #[test]
1058    fn block_test_vectors_unique() {
1059        let _init_guard = init();
1060
1061        let block_count = BLOCKS.len();
1062        let block_set: HashSet<_> = BLOCKS.iter().collect();
1063
1064        // putting the same block in two files is an easy mistake to make
1065        assert_eq!(
1066            block_count,
1067            block_set.len(),
1068            "block test vectors must be unique"
1069        );
1070
1071        // final sapling roots can be duplicated if a block has no sapling spends or outputs
1072    }
1073
1074    /// Make sure we use all the test vectors in the lists.
1075    ///
1076    /// We're using lazy_static! and combinators, so it would be easy to make this mistake.
1077    #[test]
1078    fn block_test_vectors_count() {
1079        let _init_guard = init();
1080
1081        assert!(
1082            MAINNET_BLOCKS.len() > 30,
1083            "there should be a reasonable number of mainnet block test vectors"
1084        );
1085
1086        assert!(
1087            TESTNET_BLOCKS.len() > 30,
1088            "there should be a reasonable number of testnet block test vectors"
1089        );
1090
1091        assert!(
1092            MAINNET_FINAL_SAPLING_ROOTS.len() > 10,
1093            "there should be a reasonable number of mainnet final sapling root test vectors"
1094        );
1095
1096        assert!(
1097            TESTNET_FINAL_SAPLING_ROOTS.len() > 10,
1098            "there should be a reasonable number of testnet final sapling root test vectors"
1099        );
1100    }
1101}