1macro_rules! const_block_blob {
16 (
17 name: $name:ident, height: $height:literal, hash: $hash:literal, data_path: $data_path:literal, major_version: $major_version:literal, minor_version: $minor_version:literal, timestamp: $timestamp:literal, nonce: $nonce:literal, tx_len: $tx_len:literal, ) => {
27 #[doc = concat!("Block with hash `", $hash, "`.")]
28 #[doc = concat!("Height: `", $height, "`.")]
30 #[doc = "# use cuprate_test_utils::data::*;"]
33 #[doc = "use monero_serai::{block::Block, transaction::Input};"]
34 #[doc = ""]
35 #[doc = concat!("let block = Block::read(&mut ", stringify!($name), ").unwrap();")]
36 #[doc = ""]
37 #[doc = concat!("assert_eq!(block.header.hardfork_version, ", $major_version, ");")]
38 #[doc = concat!("assert_eq!(block.header.hardfork_signal, ", $minor_version, ");")]
39 #[doc = concat!("assert_eq!(block.header.timestamp, ", $timestamp, ");")]
40 #[doc = concat!("assert_eq!(block.header.nonce, ", $nonce, ");")]
41 #[doc = concat!("assert!(matches!(block.miner_transaction.prefix().inputs[0], Input::Gen(", $height, ")));")]
42 #[doc = concat!("assert_eq!(block.transactions.len(), ", $tx_len, ");")]
43 #[doc = concat!("assert_eq!(hex::encode(block.hash()), \"", $hash, "\")")]
44 pub const $name: &[u8] = include_bytes!($data_path);
46 };
47}
48
49const_block_blob! {
50 name: BLOCK_BBD604,
51 height: 202_612,
52 hash: "bbd604d2ba11ba27935e006ed39c9bfdd99b76bf4a50654bc1e1e61217962698",
53 data_path: "block/bbd604d2ba11ba27935e006ed39c9bfdd99b76bf4a50654bc1e1e61217962698.bin",
54 major_version: 1,
55 minor_version: 0,
56 timestamp: 1409804570,
57 nonce: 1073744198,
58 tx_len: 513,
59}
60
61const_block_blob! {
62 name: BLOCK_5ECB7E,
63 height: 202_609,
64 hash: "5ecb7e663bbe947c734c8059e7d7d52dc7d6644bb82d81a6ad4057d127ee8eda",
65 data_path: "block/5ecb7e663bbe947c734c8059e7d7d52dc7d6644bb82d81a6ad4057d127ee8eda.bin",
66 major_version: 1,
67 minor_version: 0,
68 timestamp: 1409804315,
69 nonce: 48426,
70 tx_len: 2,
71}
72
73const_block_blob! {
74 name: BLOCK_F91043,
75 height: 1_731_606,
76 hash: "f910435a5477ca27be1986c080d5476aeab52d0c07cf3d9c72513213350d25d4",
77 data_path: "block/f910435a5477ca27be1986c080d5476aeab52d0c07cf3d9c72513213350d25d4.bin",
78 major_version: 9,
79 minor_version: 9,
80 timestamp: 1545423190,
81 nonce: 4123173351,
82 tx_len: 3,
83}
84
85const_block_blob! {
86 name: BLOCK_43BD1F,
87 height: 2_751_506,
88 hash: "43bd1f2b6556dcafa413d8372974af59e4e8f37dbf74dc6b2a9b7212d0577428",
89 data_path: "block/43bd1f2b6556dcafa413d8372974af59e4e8f37dbf74dc6b2a9b7212d0577428.bin",
90 major_version: 16,
91 minor_version: 16,
92 timestamp: 1667941829,
93 nonce: 4110909056,
94 tx_len: 0,
95}
96
97macro_rules! const_tx_blob {
102 (
103 name: $name:ident, hash: $hash:literal, data_path: $data_path:literal, version: $version:literal, timelock: $timelock:expr_2021, input_len: $input_len:literal, output_len: $output_len:literal, ) => {
111 #[doc = concat!("Transaction with hash `", $hash, "`.")]
112 #[doc = "# use cuprate_test_utils::data::*;"]
115 #[doc = "use monero_serai::transaction::{Transaction, Timelock};"]
116 #[doc = ""]
117 #[doc = concat!("let tx = Transaction::read(&mut ", stringify!($name), ").unwrap();")]
118 #[doc = ""]
119 #[doc = concat!("assert_eq!(tx.version(), ", $version, ");")]
120 #[doc = concat!("assert_eq!(tx.prefix().additional_timelock, ", stringify!($timelock), ");")]
121 #[doc = concat!("assert_eq!(tx.prefix().inputs.len(), ", $input_len, ");")]
122 #[doc = concat!("assert_eq!(tx.prefix().outputs.len(), ", $output_len, ");")]
123 #[doc = concat!("assert_eq!(hex::encode(tx.hash()), \"", $hash, "\")")]
124 pub const $name: &[u8] = include_bytes!($data_path);
126 };
127}
128
129const_tx_blob! {
130 name: TX_3BC7FF,
131 hash: "3bc7ff015b227e7313cc2e8668bfbb3f3acbee274a9c201d6211cf681b5f6bb1",
132 data_path: "tx/3bc7ff015b227e7313cc2e8668bfbb3f3acbee274a9c201d6211cf681b5f6bb1.bin",
133 version: 1,
134 timelock: Timelock::Block(100_081),
135 input_len: 1,
136 output_len: 5,
137}
138
139const_tx_blob! {
140 name: TX_2180A8,
141 hash: "2180a87f724702d37af087e22476297e818a73579ef7b7da947da963245202a3",
142 data_path: "tx/2180a87f724702d37af087e22476297e818a73579ef7b7da947da963245202a3.bin",
143 version: 1,
144 timelock: Timelock::None,
145 input_len: 19,
146 output_len: 61,
147}
148
149const_tx_blob! {
150 name: TX_D7FEBD,
151 hash: "d7febd16293799d9c6a8e0fe9199b8a0a3e0da5a8a165098937b60f0bbd582df",
152 data_path: "tx/d7febd16293799d9c6a8e0fe9199b8a0a3e0da5a8a165098937b60f0bbd582df.bin",
153 version: 1,
154 timelock: Timelock::None,
155 input_len: 46,
156 output_len: 46,
157}
158
159const_tx_blob! {
160 name: TX_E2D393,
161 hash: "e2d39395dd1625b2d707b98af789e7eab9d24c2bd2978ec38ef910961a8cdcee",
162 data_path: "tx/e2d39395dd1625b2d707b98af789e7eab9d24c2bd2978ec38ef910961a8cdcee.bin",
163 version: 2,
164 timelock: Timelock::None,
165 input_len: 1,
166 output_len: 2,
167}
168
169const_tx_blob! {
170 name: TX_E57440,
171 hash: "e57440ec66d2f3b2a5fa2081af40128868973e7c021bb3877290db3066317474",
172 data_path: "tx/e57440ec66d2f3b2a5fa2081af40128868973e7c021bb3877290db3066317474.bin",
173 version: 2,
174 timelock: Timelock::None,
175 input_len: 1,
176 output_len: 2,
177}
178
179const_tx_blob! {
180 name: TX_B6B439,
181 hash: "b6b4394d4ec5f08ad63267c07962550064caa8d225dd9ad6d739ebf60291c169",
182 data_path: "tx/b6b4394d4ec5f08ad63267c07962550064caa8d225dd9ad6d739ebf60291c169.bin",
183 version: 2,
184 timelock: Timelock::None,
185 input_len: 2,
186 output_len: 2,
187}
188
189const_tx_blob! {
190 name: TX_9E3F73,
191 hash: "9e3f73e66d7c7293af59c59c1ff5d6aae047289f49e5884c66caaf4aea49fb34",
192 data_path: "tx/9e3f73e66d7c7293af59c59c1ff5d6aae047289f49e5884c66caaf4aea49fb34.bin",
193 version: 1,
194 timelock: Timelock::None,
195 input_len: 2,
196 output_len: 5,
197}
198
199const_tx_blob! {
200 name: TX_84D48D,
201 hash: "84d48dc11ec91950f8b70a85af9db91fe0c8abef71ef5db08304f7344b99ea66",
202 data_path: "tx/84d48dc11ec91950f8b70a85af9db91fe0c8abef71ef5db08304f7344b99ea66.bin",
203 version: 2,
204 timelock: Timelock::None,
205 input_len: 2,
206 output_len: 2,
207}
208
209#[cfg(test)]
211mod test {}