From 962abcc963f8819efb338fba2b43b471297bd3d8 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Fri, 26 Nov 2021 10:36:41 +1100 Subject: [PATCH] Add serde regression tests In order that we can safely change/maintain de/serialization code we need to have regression tests with hard coded serializations for each type that implements serde. It is enough to test a single serde data format, use JSON for `opcodes` and bincode for other types. Do regression testing in a newly added `tests` module. --- bitcoin/tests/data/serde/README.md | 12 + .../serde/absolute_lock_time_blocks_bincode | Bin 0 -> 8 bytes .../serde/absolute_lock_time_seconds_bincode | Bin 0 -> 8 bytes bitcoin/tests/data/serde/address_bincode | Bin 0 -> 42 bytes bitcoin/tests/data/serde/block_bincode | Bin 0 -> 5123 bytes bitcoin/tests/data/serde/child_number_bincode | 1 + .../tests/data/serde/control_block_bincode | Bin 0 -> 202 bytes bitcoin/tests/data/serde/control_block_hex | 1 + bitcoin/tests/data/serde/ecdsa_sig_bincode | Bin 0 -> 99 bytes bitcoin/tests/data/serde/ecdsa_sig_hex | 1 + bitcoin/tests/data/serde/extended_priv_key | 1 + .../data/serde/extended_priv_key_bincode | Bin 0 -> 119 bytes bitcoin/tests/data/serde/extended_pub_key | 1 + .../tests/data/serde/extended_pub_key_bincode | Bin 0 -> 119 bytes bitcoin/tests/data/serde/private_key_bincode | Bin 0 -> 60 bytes .../tests/data/serde/proprietary_key_bincode | Bin 0 -> 25 bytes bitcoin/tests/data/serde/psbt_bincode | Bin 0 -> 1341 bytes bitcoin/tests/data/serde/public_key_bincode | Bin 0 -> 73 bytes bitcoin/tests/data/serde/public_key_hex | 1 + bitcoin/tests/data/serde/raw_pair_bincode | Bin 0 -> 25 bytes .../serde/relative_lock_time_blocks_bincode | Bin 0 -> 6 bytes .../serde/relative_lock_time_seconds_bincode | Bin 0 -> 6 bytes bitcoin/tests/data/serde/schnorr_sig_bincode | Bin 0 -> 91 bytes bitcoin/tests/data/serde/schnorr_sig_hex | 1 + bitcoin/tests/data/serde/script_bincode | Bin 0 -> 11 bytes .../tests/data/serde/taproot_builder_bincode | Bin 0 -> 79 bytes .../data/serde/taproot_spend_info_bincode | Bin 0 -> 724 bytes bitcoin/tests/data/serde/transaction_bincode | Bin 0 -> 854 bytes bitcoin/tests/data/serde/transaction_ser | Bin 0 -> 706 bytes bitcoin/tests/data/serde/txin_bincode | Bin 0 -> 172 bytes bitcoin/tests/data/serde/txin_ser | Bin 0 -> 149 bytes bitcoin/tests/data/serde/txout_bincode | Bin 0 -> 19 bytes bitcoin/tests/data/serde/u256_bincode | Bin 0 -> 40 bytes bitcoin/tests/data/serde/uint128_bincode | Bin 0 -> 24 bytes bitcoin/tests/data/serde/uint256_bincode | Bin 0 -> 40 bytes bitcoin/tests/data/serde/witness_bincode | Bin 0 -> 60 bytes bitcoin/tests/serde.rs | 418 ++++++++++++++++++ bitcoin/tests/serde_opcodes.rs | 280 ++++++++++++ 38 files changed, 717 insertions(+) create mode 100644 bitcoin/tests/data/serde/README.md create mode 100644 bitcoin/tests/data/serde/absolute_lock_time_blocks_bincode create mode 100644 bitcoin/tests/data/serde/absolute_lock_time_seconds_bincode create mode 100644 bitcoin/tests/data/serde/address_bincode create mode 100644 bitcoin/tests/data/serde/block_bincode create mode 100644 bitcoin/tests/data/serde/child_number_bincode create mode 100644 bitcoin/tests/data/serde/control_block_bincode create mode 100644 bitcoin/tests/data/serde/control_block_hex create mode 100644 bitcoin/tests/data/serde/ecdsa_sig_bincode create mode 100644 bitcoin/tests/data/serde/ecdsa_sig_hex create mode 100644 bitcoin/tests/data/serde/extended_priv_key create mode 100644 bitcoin/tests/data/serde/extended_priv_key_bincode create mode 100644 bitcoin/tests/data/serde/extended_pub_key create mode 100644 bitcoin/tests/data/serde/extended_pub_key_bincode create mode 100644 bitcoin/tests/data/serde/private_key_bincode create mode 100644 bitcoin/tests/data/serde/proprietary_key_bincode create mode 100644 bitcoin/tests/data/serde/psbt_bincode create mode 100644 bitcoin/tests/data/serde/public_key_bincode create mode 100644 bitcoin/tests/data/serde/public_key_hex create mode 100644 bitcoin/tests/data/serde/raw_pair_bincode create mode 100644 bitcoin/tests/data/serde/relative_lock_time_blocks_bincode create mode 100644 bitcoin/tests/data/serde/relative_lock_time_seconds_bincode create mode 100644 bitcoin/tests/data/serde/schnorr_sig_bincode create mode 100644 bitcoin/tests/data/serde/schnorr_sig_hex create mode 100644 bitcoin/tests/data/serde/script_bincode create mode 100644 bitcoin/tests/data/serde/taproot_builder_bincode create mode 100644 bitcoin/tests/data/serde/taproot_spend_info_bincode create mode 100644 bitcoin/tests/data/serde/transaction_bincode create mode 100644 bitcoin/tests/data/serde/transaction_ser create mode 100644 bitcoin/tests/data/serde/txin_bincode create mode 100644 bitcoin/tests/data/serde/txin_ser create mode 100644 bitcoin/tests/data/serde/txout_bincode create mode 100644 bitcoin/tests/data/serde/u256_bincode create mode 100644 bitcoin/tests/data/serde/uint128_bincode create mode 100644 bitcoin/tests/data/serde/uint256_bincode create mode 100644 bitcoin/tests/data/serde/witness_bincode create mode 100644 bitcoin/tests/serde.rs create mode 100644 bitcoin/tests/serde_opcodes.rs diff --git a/bitcoin/tests/data/serde/README.md b/bitcoin/tests/data/serde/README.md new file mode 100644 index 00000000..a12793ba --- /dev/null +++ b/bitcoin/tests/data/serde/README.md @@ -0,0 +1,12 @@ +Serialization input/output +========================== + +Files here contain hex strings and binary data representing types used for +regression testing. + +- *_hex: consensus encoded types represented as hex strings +- *_ser: consensus encoded types represented as binary data +- *_bincode: types serialized with serde as bincode + +We consensus deserialize, serde serialize, then check against the expected data +to verify no serde regressions have been introduced. diff --git a/bitcoin/tests/data/serde/absolute_lock_time_blocks_bincode b/bitcoin/tests/data/serde/absolute_lock_time_blocks_bincode new file mode 100644 index 0000000000000000000000000000000000000000..5e969601a67a38dd20ea1c7a77d6584098aded10 GIT binary patch literal 8 PcmZQzU|^USz|8;v15yC( literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/absolute_lock_time_seconds_bincode b/bitcoin/tests/data/serde/absolute_lock_time_seconds_bincode new file mode 100644 index 0000000000000000000000000000000000000000..dc0370f52ca36040df100e18e084992bacf87acb GIT binary patch literal 8 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 literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/control_block_hex b/bitcoin/tests/data/serde/control_block_hex new file mode 100644 index 00000000..b1ddcda5 --- /dev/null +++ b/bitcoin/tests/data/serde/control_block_hex @@ -0,0 +1 @@ +c1a9d6f66cd4b25004f526bfa873e56942f98e8e492bd79ed6532b966104817c2bda584e7d32612381cf88edc1c02e28a296e807c16ad22f591ee113946e48a71e0641e660d1e5392fb79d64838c2b84faf04b7f5f283c9d8bf83e39e177b64372a0cd22eeab7e093873e851e247714eff762d8a30be699ba4456cfe6491b282e193a071350ae099005a5950d74f73ba13077a57bc478007fb0e4d1099ce9cf3d4 diff --git a/bitcoin/tests/data/serde/ecdsa_sig_bincode b/bitcoin/tests/data/serde/ecdsa_sig_bincode new file mode 100644 index 0000000000000000000000000000000000000000..3136dc701397f2d6080164f6ab51b71f3e9330f7 GIT binary patch literal 99 zcmeZZfB*wGCPjwkIr4jgS?*2o&#am6Ez5ZE*XzZ)r84|grxn+9@jGV~0hPR%eI*!|u`a<4Yr|6$Fp`Ij*4YtDp4iG=v~J#@}{_m@6C9v76|d`q$%7_?o* zbADY>eIREBE7cWpJ#xzCOSsFec+6m=oXvE4+DnXry(Ffo*I_KUtM_&=jS@mbhl45y OI$D73i_7F2Nv0nm)g@*C literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/extended_pub_key b/bitcoin/tests/data/serde/extended_pub_key new file mode 100644 index 00000000..da226876 --- /dev/null +++ b/bitcoin/tests/data/serde/extended_pub_key @@ -0,0 +1 @@ +xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8 diff --git a/bitcoin/tests/data/serde/extended_pub_key_bincode b/bitcoin/tests/data/serde/extended_pub_key_bincode new file mode 100644 index 0000000000000000000000000000000000000000..096623fda489e0731ec907809472fe55d88ab2c2 GIT binary patch literal 119 zcmXBB(GG$j6adhE36=zproiUH71WB}LW$<);{4I)2+ zsgmvLBY OwPK9qj<{5V&-4d*ZYAFU literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/private_key_bincode b/bitcoin/tests/data/serde/private_key_bincode new file mode 100644 index 0000000000000000000000000000000000000000..827f5d7ff817b88e8ab8e8ec40e6f4982738a452 GIT binary patch literal 60 zcmXqEfPmz%5|ey$CwIrpbi>ey%JOvg;9SR`j0)eBssPi%vcTdB@9f~>WWxy8>~iB0 KmykfWf=U4HCK9Fq literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/proprietary_key_bincode b/bitcoin/tests/data/serde/proprietary_key_bincode new file mode 100644 index 0000000000000000000000000000000000000000..24310775665f2a08ec0bcc1e19f415bdfbca0331 GIT binary patch literal 25 RcmZQ!fC5G)W=0ky4gdih02TlM literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/psbt_bincode b/bitcoin/tests/data/serde/psbt_bincode new file mode 100644 index 0000000000000000000000000000000000000000..e7293c1adbf7d23cc184d3ccfe30a0b6fcf3f399 GIT binary patch literal 1341 zcmZQ%fB;4)tpKGv7ax~f?W^#>TzdDCGnxI1rk-@O`lV-C-)ekjoBq`Fr!e&(<^O>I zs*M3AUi9yWpAJw^94fI=#CW>uF2(oPw2lX_+;buQ+VN$J=d!kgWMNwJp-L+XN|VgY z41Fto%N+}Yl9Js@BGQ9RizB@poeB%xEhBw$olOD_gHjR;EYpKsE&K{g$}5xHGg1R0 zjnboxEM0@$vI@QOol6aaN(-`5Eh0s(0Huiub69waF^KGwxEQo@gAnuF^|s6J`3IZKd$Y3@6csSz6`{s5 zUwRl;GDUi=*UaRi)9nvibIpPha%Y6;Kb{jeug=k45$-S|g8Nx?t;(faL)PFMWbMJ)1+HD2sE zca_>%-W?bGO@g)=b*|xOQV=N9n!l}X%9)t86V$%lnfbq-o!_bAGXI`hp0>G{d+MKa zLrn|zboX!!_K0`%@nLKRiZQ~%ClH?UmXbQxtxJ!- z{1cL>!7;t=#aE9_s=bDAZA>t23Q*OLHym-A@kd5v*6%MTX6ElyQD5iyBxUwwpCwag zN>>E!2*uP1vu8`uqO=QpI}e((EfLl^zcIhYdj4rl)i8Tvzdd+VCLDR0tErT=Pjmhm q=Eh)G*RL^O>>Ov<$NEeOL+FG$3>yV=JeBhbqI94nj^GZavMT`y{Wa(S literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/public_key_bincode b/bitcoin/tests/data/serde/public_key_bincode new file mode 100644 index 0000000000000000000000000000000000000000..472a282c1b2b274fa4812f4b02a1422addc2f124 GIT binary patch literal 73 zcmZ={fB+V~i1kn9=iOLqbG)-Y*|$Uf_LEtSVQ!lDZir^TzV!d%dPzy;Mbmu5>!Tx; b*9GvO@_adE(p8gH=8@MnMRlJn+-M8{FJ&ND literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/public_key_hex b/bitcoin/tests/data/serde/public_key_hex new file mode 100644 index 00000000..4c6541bc --- /dev/null +++ b/bitcoin/tests/data/serde/public_key_hex @@ -0,0 +1 @@ +042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133 diff --git a/bitcoin/tests/data/serde/raw_pair_bincode b/bitcoin/tests/data/serde/raw_pair_bincode new file mode 100644 index 0000000000000000000000000000000000000000..415afa7dcc805bf22eb9cf99028b1745e8bab265 GIT binary patch literal 25 QcmZQ%VSoZgCT3(d00ABV761SM literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/relative_lock_time_blocks_bincode b/bitcoin/tests/data/serde/relative_lock_time_blocks_bincode new file mode 100644 index 0000000000000000000000000000000000000000..4eb84bb45911c09de9bdc6e7ff57f8fa89090a80 GIT binary patch literal 6 NcmZQzU|{%n3IGDk0m%RW literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/relative_lock_time_seconds_bincode b/bitcoin/tests/data/serde/relative_lock_time_seconds_bincode new file mode 100644 index 0000000000000000000000000000000000000000..b6ed9a62a79422b1e6555e84e8d0a8830abcccae GIT binary patch literal 6 NcmZQ%U|=}+3jhM50m=XX literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/schnorr_sig_bincode b/bitcoin/tests/data/serde/schnorr_sig_bincode new file mode 100644 index 0000000000000000000000000000000000000000..01f28cee79d200606c3607eee49fcf483ae0eeba GIT binary patch literal 91 zcmZ=@fPj>OzrxISm;7BWzO%V7_>foLYV*S8KhFJ==kZ3jsJMJv%Ouk;U o(m$T}eq^7F`$6-clE&&jHFme|yx@kK6YS~k;TY@@@95(L0ONBcy#N3J literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/schnorr_sig_hex b/bitcoin/tests/data/serde/schnorr_sig_hex new file mode 100644 index 00000000..9ab24dd5 --- /dev/null +++ b/bitcoin/tests/data/serde/schnorr_sig_hex @@ -0,0 +1 @@ +6470FD1303DDA4FDA717B9837153C24A6EAB377183FC438F939E0ED2B620E9EE5077C4A8B8DCA28963D772A94F5F0DDF598E1C47C137F91933274C7C3EDADCE8 diff --git a/bitcoin/tests/data/serde/script_bincode b/bitcoin/tests/data/serde/script_bincode new file mode 100644 index 0000000000000000000000000000000000000000..5bf932f61b2edaeaa2a55a379da392a026987723 GIT binary patch literal 11 McmZQ(fC5G)001xm2LJ#7 literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/taproot_builder_bincode b/bitcoin/tests/data/serde/taproot_builder_bincode new file mode 100644 index 0000000000000000000000000000000000000000..91f3aff78b9e649a149acd46b6a254f69027df68 GIT binary patch literal 79 zcmZQ#fC5GZC}Z7%B}WYoUS9chd&SJc&c1&hOZHFQ>AUHA^^^6l+QdE0RW(e6h{C6 literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/taproot_spend_info_bincode b/bitcoin/tests/data/serde/taproot_spend_info_bincode new file mode 100644 index 0000000000000000000000000000000000000000..4ef6c98216e80a11f1cebe5a899e0c29cbea89c3 GIT binary patch literal 724 zcmbPy+`M;MU{|S2hvJd%C%)`@elFn$%LQ9`HjTTn7rx#LWK>{)fd8`7vrqm#X~I{s zzb zPW%|YHaer^cHdvV2k&ck_<5GCc?NSw5ZpyfP?x|=SRpxgN1XhWor25k|D9vh-m(6q zqT$n7iO!C<{Vo}5*?7RzO~|t}l4sb^(d;&}?OKY6)tkR_E02UmTsgljy3FRhO##fN zV4OA`D*N}*B4a}0?1qP2UPi4&H%lh3y_9)hN_6>;`CTvGaFS|M2u_;}H?@ZSe0uTt zkCWSY(tTcR-1Wi6+^U*wg^Zy2F-40x<}jOx4ZTpfP3ZBtB3hCC`@~IIEzcuzG|nAA aov5I9`GTa&4Wj^lGxMfvr7)YQ6`ug`7W;Pq literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/transaction_bincode b/bitcoin/tests/data/serde/transaction_bincode new file mode 100644 index 0000000000000000000000000000000000000000..82ffd66a7915f29015864c706a380a4b227966b2 GIT binary patch literal 854 zcmZQ#U|?v!%+A0Jq(MLdOfoRY{66v3fB%xjRt9Vxj^^?WxBrPH392XwOSEWwF?WfX z2vU{>RqJlx!laPD=S{D!UI}lLudUe`lW6ms-(u6EW`5lpGq2Z4or`$|lY;QnX-1yP zMhZNd9IjK{_xJ9fek^L^qTV;=wfVA+m#^6|Dl%VJpZj~lIq`qOvzKwzINtrnx+zYE zeaYR^bN_vLeyxz-cyd?4MI3!?rmQbmQ>W@s&DQx~*Fv6hkg-fqB_2@Pz?DgnVc#R~WJOKO z%eH}bW!1+gGqB26@jBbspO@pa{$M?C<8>y5h~6Vna~`j>6tH%QJm((3o$|xUMF88|Ljw`1b6C9Dxs!$HcB{8Jgraz@wR(1UlDxxh^O zy$u(f8Smrt&!ahYR&jp>ZY5ZCu(`@*#=Fn~cFYr4y2eRy^_p6-$r4Ui4=W-3GmX35Q8!O)zQIF9w!PmOl~(PZw@uzP zRKiG0VyD8A`zzR>{`vP^AIyTed8J6%-vZOKY9AMCMeVG75LRflMzu1deJKM!SeYbL zTiHsH9mcu=T0v6_kFEE9mOS&UvH66;qaADPZ?U2){3DyG-}{j3vC-5I6ZS3r=NVKx zJ*Hz#ke)QU!iE;Mt-b;-M>N-j9C+Bd;Rc&n`h$)&dD~hUK`N1~zP~!5_4A6~cIg5N tSy59b3m;AF_w87-dlA?`WQDH{)IxRZ>W6G5u7+zniq6!Q1H z>DARM;cfD@H9KPxZGQ7xY+BUJuX|(W^*X6@F|S}!5S}{C$Wz%!fk%_Wb*lUR-u=^$ zMQvQv`^LOBU)J&RH9JN{=IiQne@{3k{!e)JGOilOyWdzh#mTTQxqEuJa zXkW^}50;lKTPd=`ST{f`XlmiH_1@2tXPz}SpHO(TV~zbSR=A2kvYGn554j#2P5m%o z-_n1cLABFkI@Sc~NyAk%w6JaU6>vGCxhCYm!_Eyi*u>HwbgaqS*2)M{0V($M zD}LLh3n*koO`R-!G_l{eW6kbGU?adPUK^-|>eksC6uZ`Pzl(Jbzvm&w+p&g$$-}^v zNs(dSBkyEIP0P!+fp%rp$0swe%2)9^+t{C%AUQ$ZDg+{R1|0R@G+zG1_?y7$o!af4@3?M$gR zFS`UnlO6K}macJ9T)n1NY_f#Y)x%0ayQXosJL=|%%{O?c$hP-8qtdF~^R~&mhDsP| PN$gZua(_kpWp)Mt;6x+g literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/txin_bincode b/bitcoin/tests/data/serde/txin_bincode new file mode 100644 index 0000000000000000000000000000000000000000..92a61a1a26d9f28f0f10fd325f5a4810f2f8e4d8 GIT binary patch literal 172 zcmY#jfPjUu;hbK}7fETHR@gdgb^q~;BD1V-pS`{En9`H4-&W2$#|TuG16Av3;KroL z@Y8z3^BcFTujDxh>&iDdG3BwuGcS1mTzYq(y?fkr-b$d7$>wM4_~6D=QtLIQ3CUjv};=Nr3@KSy4d4S50~0FyV(e;<;c0L*Xj9|Llm2AX^! zwVM|<-Tvj))yO`_|rLW`F`lCIDo527dqm literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/u256_bincode b/bitcoin/tests/data/serde/u256_bincode new file mode 100644 index 0000000000000000000000000000000000000000..e91e8a928f21780821271b2c7f4e11c13d2e8ad1 GIT binary patch literal 40 dcmY#jfPho~?ycRmZ{K?ueQzy@y=xzg1^}?T8UX+R literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/uint128_bincode b/bitcoin/tests/data/serde/uint128_bincode new file mode 100644 index 0000000000000000000000000000000000000000..24087dd3ced3ea34f53be0c94aad7e6bc13d2598 GIT binary patch literal 24 QcmWe&Kn3^K?t2fy03J*RfdBvi literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/uint256_bincode b/bitcoin/tests/data/serde/uint256_bincode new file mode 100644 index 0000000000000000000000000000000000000000..6fe1e0320386f324e06481b3dc54603cf715fda8 GIT binary patch literal 40 QcmY#jzz^=N-S-}Z0U_K5kpKVy literal 0 HcmV?d00001 diff --git a/bitcoin/tests/data/serde/witness_bincode b/bitcoin/tests/data/serde/witness_bincode new file mode 100644 index 0000000000000000000000000000000000000000..e7d43be0ffce950f2900512e294d3c9159b91c2b GIT binary patch literal 60 zcmZQ#fB;1(&3x%$SjiOWwO%umi%z#cY|S+bO30lNrvG?O+`KwRdqq}es6rqG0Jr%L A@c;k- literal 0 HcmV?d00001 diff --git a/bitcoin/tests/serde.rs b/bitcoin/tests/serde.rs new file mode 100644 index 00000000..b7402626 --- /dev/null +++ b/bitcoin/tests/serde.rs @@ -0,0 +1,418 @@ +//! Regression tests for _most_ types that implement `serde::Serialize`. +//! +//! For remaining types see: ./serde_opcodes.rs +//! +//! If you find a type defined in `rust-bitcoin` that implements `Serialize` and does _not_ have a +//! regression test please add it. +//! +//! Types/tests were found using, and are ordered by, the output of: `git grep -l Serialize`. +//! + +// In tests below `deserialize` is consensus deserialize while `serialize` is serde serialize, that +// is why we have two different serialized data files for tests that use binary serialized input. +// +// To create a file with the expected serialized data do something like: +// +// use std::fs::File; +// use std::io::Write; +// let script = Script::from(vec![0u8, 1u8, 2u8]); +// let got = serialize(&script).unwrap(); +// let mut file = File::create("/tmp/script_bincode").unwrap(); +// file.write_all(&got).unwrap(); + +#![cfg(feature = "serde")] + +use std::collections::BTreeMap; +use std::str::FromStr; + +use bincode::serialize; +use bitcoin::blockdata::locktime::{absolute, relative}; +use bitcoin::blockdata::witness::Witness; +use bitcoin::consensus::encode::deserialize; +use bitcoin::hashes::hex::FromHex; +use bitcoin::hashes::{hash160, ripemd160, sha256, sha256d, Hash}; +use bitcoin::sighash::{EcdsaSighashType, SchnorrSighashType}; +use bitcoin::util::bip32::{ChildNumber, ExtendedPrivKey, ExtendedPubKey, KeySource}; +use bitcoin::util::psbt::raw::{self, Key, Pair, ProprietaryKey}; +use bitcoin::util::psbt::{Input, Output, Psbt, PsbtSighashType}; +use bitcoin::util::schnorr::UntweakedPublicKey; +use bitcoin::util::taproot::{ControlBlock, LeafVersion, TaprootBuilder, TaprootSpendInfo}; +use bitcoin::{ + Address, Block, EcdsaSig, Network, OutPoint, PrivateKey, PublicKey, SchnorrSig, Script, + Sequence, Target, Transaction, TxIn, TxOut, Txid, Work, +}; +use secp256k1::Secp256k1; + +/// Implicitly does regression test for `BlockHeader` also. +#[test] +fn serde_regression_block() { + let segwit = include_bytes!( + "data/testnet_block_000000000000045e0b1660b6445b5e5c5ab63c9a4f956be7e1e69be04fa4497b.raw" + ); + let block: Block = deserialize(segwit).unwrap(); + let got = serialize(&block).unwrap(); + // The cast is required because Rust 1.41.1 throws the following error without it: + // the trait `std::array::LengthAtMost32` is not implemented for `[u8; 5123]` + let want = include_bytes!("data/serde/block_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_absolute_lock_time_height() { + let t = absolute::LockTime::from_height(741521).expect("valid height"); + let got = serialize(&t).unwrap(); + let want = include_bytes!("data/serde/absolute_lock_time_blocks_bincode") as &[_]; + assert_eq!(got, want); +} + +#[test] +fn serde_regression_absolute_lock_time_time() { + let seconds: u32 = 1653195600; // May 22nd, 5am UTC. + let t = absolute::LockTime::from_time(seconds).expect("valid time"); + let got = serialize(&t).unwrap(); + + let want = include_bytes!("data/serde/absolute_lock_time_seconds_bincode") as &[_]; + assert_eq!(got, want); +} + +#[test] +fn serde_regression_relative_lock_time_height() { + let t = relative::LockTime::from(relative::Height::from(0xCAFE_u16)); + let got = serialize(&t).unwrap(); + + let want = include_bytes!("data/serde/relative_lock_time_blocks_bincode") as &[_]; + assert_eq!(got, want); +} + +#[test] +fn serde_regression_relative_lock_time_time() { + let t = relative::LockTime::from(relative::Time::from_512_second_intervals(0xFACE_u16)); + let got = serialize(&t).unwrap(); + + let want = include_bytes!("data/serde/relative_lock_time_seconds_bincode") as &[_]; + assert_eq!(got, want); +} + +#[test] +fn serde_regression_script() { + let script = Script::from(vec![0u8, 1u8, 2u8]); + let got = serialize(&script).unwrap(); + let want = include_bytes!("data/serde/script_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_txin() { + let ser = include_bytes!("data/serde/txin_ser"); + let txin: TxIn = deserialize(ser).unwrap(); + + let got = serialize(&txin).unwrap(); + let want = include_bytes!("data/serde/txin_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_txout() { + let txout = + TxOut { value: 0xDEADBEEFCAFEBABE, script_pubkey: Script::from(vec![0u8, 1u8, 2u8]) }; + let got = serialize(&txout).unwrap(); + let want = include_bytes!("data/serde/txout_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_transaction() { + let ser = include_bytes!("data/serde/transaction_ser"); + let tx: Transaction = deserialize(ser).unwrap(); + let got = serialize(&tx).unwrap(); + let want = include_bytes!("data/serde/transaction_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_witness() { + let w0 = Vec::from_hex("03d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e7e413f2105") + .unwrap(); + let w1 = Vec::from_hex("000000").unwrap(); + let vec = vec![w0, w1]; + let witness = Witness::from_vec(vec); + + let got = serialize(&witness).unwrap(); + let want = include_bytes!("data/serde/witness_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_address() { + let s = include_str!("data/serde/public_key_hex"); + let pk = PublicKey::from_str(s.trim()).unwrap(); + let addr = Address::p2pkh(&pk, Network::Bitcoin); + + let got = serialize(&addr).unwrap(); + let want = include_bytes!("data/serde/address_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_extended_priv_key() { + let s = include_str!("data/serde/extended_priv_key"); + let key = ExtendedPrivKey::from_str(s.trim()).unwrap(); + let got = serialize(&key).unwrap(); + let want = include_bytes!("data/serde/extended_priv_key_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_extended_pub_key() { + let s = include_str!("data/serde/extended_pub_key"); + let key = ExtendedPubKey::from_str(s.trim()).unwrap(); + let got = serialize(&key).unwrap(); + let want = include_bytes!("data/serde/extended_pub_key_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_ecdsa_sig() { + let s = include_str!("data/serde/ecdsa_sig_hex"); + let sig = EcdsaSig { + sig: secp256k1::ecdsa::Signature::from_str(s.trim()).unwrap(), + hash_ty: EcdsaSighashType::All, + }; + + let got = serialize(&sig).unwrap(); + let want = include_bytes!("data/serde/ecdsa_sig_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_control_block() { + let s = include_str!("data/serde/control_block_hex"); + let block = ControlBlock::from_slice(&Vec::::from_hex(s.trim()).unwrap()).unwrap(); + let got = serialize(&block).unwrap(); + + let want = include_bytes!("data/serde/control_block_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_child_number() { + let num = ChildNumber::Normal { index: 0xDEADBEEF }; + let got = serialize(&num).unwrap(); + let want = include_bytes!("data/serde/child_number_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_private_key() { + let sk = PrivateKey::from_wif("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy").unwrap(); + let got = serialize(&sk).unwrap(); + let want = include_bytes!("data/serde/private_key_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_public_key() { + let s = include_str!("data/serde/public_key_hex"); + let pk = PublicKey::from_str(s.trim()).unwrap(); + let got = serialize(&pk).unwrap(); + let want = include_bytes!("data/serde/public_key_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_psbt() { + let tx = Transaction { + version: 1, + lock_time: absolute::PackedLockTime::ZERO, + input: vec![TxIn { + previous_output: OutPoint { + txid: Txid::from_hex( + "e567952fb6cc33857f392efa3a46c995a28f69cca4bb1b37e0204dab1ec7a389", + ) + .unwrap(), + vout: 1, + }, + script_sig: Script::from_str("160014be18d152a9b012039daf3da7de4f53349eecb985").unwrap(), + sequence: Sequence::from_consensus(4294967295), + witness: Witness::from_vec(vec![Vec::from_hex( + "03d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e7e413f2105", + ) + .unwrap()]), + }], + output: vec![TxOut { + value: 190303501938, + script_pubkey: Script::from_str("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587") + .unwrap(), + }], + }; + let unknown: BTreeMap> = + vec![(raw::Key { type_value: 1, key: vec![0, 1] }, vec![3, 4, 5])].into_iter().collect(); + let key_source = ("deadbeef".parse().unwrap(), "m/0'/1".parse().unwrap()); + let keypaths: BTreeMap = vec![( + "0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(), + key_source.clone(), + )] + .into_iter() + .collect(); + + let proprietary: BTreeMap> = vec![( + raw::ProprietaryKey { + prefix: "prefx".as_bytes().to_vec(), + subtype: 42, + key: "test_key".as_bytes().to_vec(), + }, + vec![5, 6, 7], + )] + .into_iter() + .collect(); + + let psbt = Psbt { + version: 0, + xpub: { + let s = include_str!("data/serde/extended_pub_key"); + let xpub = ExtendedPubKey::from_str(s.trim()).unwrap(); + vec![(xpub, key_source)].into_iter().collect() + }, + unsigned_tx: { + let mut unsigned = tx.clone(); + unsigned.input[0].script_sig = Script::new(); + unsigned.input[0].witness = Witness::default(); + unsigned + }, + proprietary: proprietary.clone(), + unknown: unknown.clone(), + + inputs: vec![Input { + non_witness_utxo: Some(tx), + witness_utxo: Some(TxOut { + value: 190303501938, + script_pubkey: Script::from_str("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), + }), + sighash_type: Some(PsbtSighashType::from(EcdsaSighashType::from_str("SIGHASH_SINGLE|SIGHASH_ANYONECANPAY").unwrap())), + redeem_script: Some(vec![0x51].into()), + witness_script: None, + partial_sigs: vec![( + "0339880dc92394b7355e3d0439fa283c31de7590812ea011c4245c0674a685e883".parse().unwrap(), + "304402204f67e2afb76142d44fae58a2495d33a3419daa26cd0db8d04f3452b63289ac0f022010762a9fb67e94cc5cad9026f6dc99ff7f070f4278d30fbc7d0c869dd38c7fe701".parse().unwrap(), + )].into_iter().collect(), + bip32_derivation: keypaths.clone().into_iter().collect(), + final_script_witness: Some(Witness::from_vec(vec![vec![1, 3], vec![5]])), + ripemd160_preimages: vec![(ripemd160::Hash::hash(&[]), vec![1, 2])].into_iter().collect(), + sha256_preimages: vec![(sha256::Hash::hash(&[]), vec![1, 2])].into_iter().collect(), + hash160_preimages: vec![(hash160::Hash::hash(&[]), vec![1, 2])].into_iter().collect(), + hash256_preimages: vec![(sha256d::Hash::hash(&[]), vec![1, 2])].into_iter().collect(), + proprietary: proprietary.clone(), + unknown: unknown.clone(), + ..Default::default() + }], + outputs: vec![Output { + bip32_derivation: keypaths.into_iter().collect(), + proprietary, + unknown, + ..Default::default() + }], + }; + + let got = serialize(&psbt).unwrap(); + let want = include_bytes!("data/serde/psbt_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_raw_pair() { + let pair = Pair { + key: Key { type_value: 1u8, key: vec![0u8, 1u8, 2u8, 3u8] }, + value: vec![0u8, 1u8, 2u8, 3u8], + }; + let got = serialize(&pair).unwrap(); + let want = include_bytes!("data/serde/raw_pair_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_proprietary_key() { + let key = ProprietaryKey { + prefix: vec![0u8, 1u8, 2u8, 3u8], + subtype: 1u8, + key: vec![0u8, 1u8, 2u8, 3u8], + }; + let got = serialize(&key).unwrap(); + let want = include_bytes!("data/serde/proprietary_key_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_schnorr_sig() { + let s = include_str!("data/serde/schnorr_sig_hex"); + let sig = SchnorrSig { + sig: secp256k1::schnorr::Signature::from_str(s.trim()).unwrap(), + hash_ty: SchnorrSighashType::All, + }; + + let got = serialize(&sig).unwrap(); + let want = include_bytes!("data/serde/schnorr_sig_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_taproot_builder() { + let ver = LeafVersion::from_consensus(0).unwrap(); + let script = Script::from(vec![0u8, 1u8, 2u8]); + let builder = TaprootBuilder::new().add_leaf_with_ver(1, script, ver).unwrap(); + + let got = serialize(&builder).unwrap(); + let want = include_bytes!("data/serde/taproot_builder_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_taproot_spend_info() { + let secp = Secp256k1::verification_only(); + let internal_key = UntweakedPublicKey::from_str( + "93c7378d96518a75448821c4f7c8f4bae7ce60f804d03d1f0628dd5dd0f5de51", + ) + .unwrap(); + + let script_weights = vec![ + (10, Script::from_hex("51").unwrap()), // semantics of script don't matter for this test + (20, Script::from_hex("52").unwrap()), + (20, Script::from_hex("53").unwrap()), + (30, Script::from_hex("54").unwrap()), + (19, Script::from_hex("55").unwrap()), + ]; + let tree_info = + TaprootSpendInfo::with_huffman_tree(&secp, internal_key, script_weights).unwrap(); + + let got = serialize(&tree_info).unwrap(); + let want = include_bytes!("data/serde/taproot_spend_info_bincode") as &[_]; + assert_eq!(got, want) +} + +// Used to get a 256 bit integer as a byte array. +fn le_bytes() -> [u8; 32] { + let x: u128 = 0xDEAD_BEEF_CAFE_BABE_DEAD_BEEF_CAFE_BABE; + let y: u128 = 0xCAFE_DEAD_BABE_BEEF_CAFE_DEAD_BABE_BEEF; + + let mut bytes = [0_u8; 32]; + + bytes[..16].copy_from_slice(&x.to_le_bytes()); + bytes[16..].copy_from_slice(&y.to_le_bytes()); + + bytes +} + +#[test] +fn serde_regression_work() { + let work = Work::from_le_bytes(le_bytes()); + let got = serialize(&work).unwrap(); + let want = include_bytes!("data/serde/u256_bincode") as &[_]; + assert_eq!(got, want) +} + +#[test] +fn serde_regression_target() { + let target = Target::from_le_bytes(le_bytes()); + let got = serialize(&target).unwrap(); + let want = include_bytes!("data/serde/u256_bincode") as &[_]; + assert_eq!(got, want) +} diff --git a/bitcoin/tests/serde_opcodes.rs b/bitcoin/tests/serde_opcodes.rs new file mode 100644 index 00000000..3d73a84c --- /dev/null +++ b/bitcoin/tests/serde_opcodes.rs @@ -0,0 +1,280 @@ +//! serde regression tests for blockdata::opcodes module. +//! + +#![cfg(feature = "serde")] + +extern crate bitcoin; +extern crate serde_json; + +macro_rules! test_opcodes { + ($($op:ident),* $(,)+) => { + $( + let op = bitcoin::blockdata::opcodes::all::$op; + let want = concat!("\"", stringify!($op), "\""); + let got = ::serde_json::to_string(&op).unwrap(); + assert_eq!(got, want); + )* + } +} + +#[test] +fn serde_regression_opcodes() { + test_opcodes! { + OP_PUSHBYTES_0, + OP_PUSHBYTES_1, + OP_PUSHBYTES_2, + OP_PUSHBYTES_3, + OP_PUSHBYTES_4, + OP_PUSHBYTES_5, + OP_PUSHBYTES_6, + OP_PUSHBYTES_7, + OP_PUSHBYTES_8, + OP_PUSHBYTES_9, + OP_PUSHBYTES_10, + OP_PUSHBYTES_11, + OP_PUSHBYTES_12, + OP_PUSHBYTES_13, + OP_PUSHBYTES_14, + OP_PUSHBYTES_15, + OP_PUSHBYTES_16, + OP_PUSHBYTES_17, + OP_PUSHBYTES_18, + OP_PUSHBYTES_19, + OP_PUSHBYTES_20, + OP_PUSHBYTES_21, + OP_PUSHBYTES_22, + OP_PUSHBYTES_23, + OP_PUSHBYTES_24, + OP_PUSHBYTES_25, + OP_PUSHBYTES_26, + OP_PUSHBYTES_27, + OP_PUSHBYTES_28, + OP_PUSHBYTES_29, + OP_PUSHBYTES_30, + OP_PUSHBYTES_31, + OP_PUSHBYTES_32, + OP_PUSHBYTES_33, + OP_PUSHBYTES_34, + OP_PUSHBYTES_35, + OP_PUSHBYTES_36, + OP_PUSHBYTES_37, + OP_PUSHBYTES_38, + OP_PUSHBYTES_39, + OP_PUSHBYTES_40, + OP_PUSHBYTES_41, + OP_PUSHBYTES_42, + OP_PUSHBYTES_43, + OP_PUSHBYTES_44, + OP_PUSHBYTES_45, + OP_PUSHBYTES_46, + OP_PUSHBYTES_47, + OP_PUSHBYTES_48, + OP_PUSHBYTES_49, + OP_PUSHBYTES_50, + OP_PUSHBYTES_51, + OP_PUSHBYTES_52, + OP_PUSHBYTES_53, + OP_PUSHBYTES_54, + OP_PUSHBYTES_55, + OP_PUSHBYTES_56, + OP_PUSHBYTES_57, + OP_PUSHBYTES_58, + OP_PUSHBYTES_59, + OP_PUSHBYTES_60, + OP_PUSHBYTES_61, + OP_PUSHBYTES_62, + OP_PUSHBYTES_63, + OP_PUSHBYTES_64, + OP_PUSHBYTES_65, + OP_PUSHBYTES_66, + OP_PUSHBYTES_67, + OP_PUSHBYTES_68, + OP_PUSHBYTES_69, + OP_PUSHBYTES_70, + OP_PUSHBYTES_71, + OP_PUSHBYTES_72, + OP_PUSHBYTES_73, + OP_PUSHBYTES_74, + OP_PUSHBYTES_75, + OP_PUSHDATA1, + OP_PUSHDATA2, + OP_PUSHDATA4, + OP_PUSHNUM_NEG1, + OP_RESERVED, + OP_PUSHNUM_1, + OP_PUSHNUM_2, + OP_PUSHNUM_3, + OP_PUSHNUM_4, + OP_PUSHNUM_5, + OP_PUSHNUM_6, + OP_PUSHNUM_7, + OP_PUSHNUM_8, + OP_PUSHNUM_9, + OP_PUSHNUM_10, + OP_PUSHNUM_11, + OP_PUSHNUM_12, + OP_PUSHNUM_13, + OP_PUSHNUM_14, + OP_PUSHNUM_15, + OP_PUSHNUM_16, + OP_NOP, + OP_VER, + OP_IF, + OP_NOTIF, + OP_VERIF, + OP_VERNOTIF, + OP_ELSE, + OP_ENDIF, + OP_VERIFY, + OP_RETURN, + OP_TOALTSTACK, + OP_FROMALTSTACK, + OP_2DROP, + OP_2DUP, + OP_3DUP, + OP_2OVER, + OP_2ROT, + OP_2SWAP, + OP_IFDUP, + OP_DEPTH, + OP_DROP, + OP_DUP, + OP_NIP, + OP_OVER, + OP_PICK, + OP_ROLL, + OP_ROT, + OP_SWAP, + OP_TUCK, + OP_CAT, + OP_SUBSTR, + OP_LEFT, + OP_RIGHT, + OP_SIZE, + OP_INVERT, + OP_AND, + OP_OR, + OP_XOR, + OP_EQUAL, + OP_EQUALVERIFY, + OP_RESERVED1, + OP_RESERVED2, + OP_1ADD, + OP_1SUB, + OP_2MUL, + OP_2DIV, + OP_NEGATE, + OP_ABS, + OP_NOT, + OP_0NOTEQUAL, + OP_ADD, + OP_SUB, + OP_MUL, + OP_DIV, + OP_MOD, + OP_LSHIFT, + OP_RSHIFT, + OP_BOOLAND, + OP_BOOLOR, + OP_NUMEQUAL, + OP_NUMEQUALVERIFY, + OP_NUMNOTEQUAL, + OP_LESSTHAN , + OP_GREATERTHAN , + OP_LESSTHANOREQUAL , + OP_GREATERTHANOREQUAL , + OP_MIN, + OP_MAX, + OP_WITHIN, + OP_RIPEMD160, + OP_SHA1, + OP_SHA256, + OP_HASH160, + OP_HASH256, + OP_CODESEPARATOR, + OP_CHECKSIG, + OP_CHECKSIGVERIFY, + OP_CHECKMULTISIG, + OP_CHECKMULTISIGVERIFY, + OP_NOP1, + OP_CLTV, + OP_CSV, + OP_NOP4, + OP_NOP5, + OP_NOP6, + OP_NOP7, + OP_NOP8, + OP_NOP9, + OP_NOP10, + OP_CHECKSIGADD, + OP_RETURN_187, + OP_RETURN_188, + OP_RETURN_189, + OP_RETURN_190, + OP_RETURN_191, + OP_RETURN_192, + OP_RETURN_193, + OP_RETURN_194, + OP_RETURN_195, + OP_RETURN_196, + OP_RETURN_197, + OP_RETURN_198, + OP_RETURN_199, + OP_RETURN_200, + OP_RETURN_201, + OP_RETURN_202, + OP_RETURN_203, + OP_RETURN_204, + OP_RETURN_205, + OP_RETURN_206, + OP_RETURN_207, + OP_RETURN_208, + OP_RETURN_209, + OP_RETURN_210, + OP_RETURN_211, + OP_RETURN_212, + OP_RETURN_213, + OP_RETURN_214, + OP_RETURN_215, + OP_RETURN_216, + OP_RETURN_217, + OP_RETURN_218, + OP_RETURN_219, + OP_RETURN_220, + OP_RETURN_221, + OP_RETURN_222, + OP_RETURN_223, + OP_RETURN_224, + OP_RETURN_225, + OP_RETURN_226, + OP_RETURN_227, + OP_RETURN_228, + OP_RETURN_229, + OP_RETURN_230, + OP_RETURN_231, + OP_RETURN_232, + OP_RETURN_233, + OP_RETURN_234, + OP_RETURN_235, + OP_RETURN_236, + OP_RETURN_237, + OP_RETURN_238, + OP_RETURN_239, + OP_RETURN_240, + OP_RETURN_241, + OP_RETURN_242, + OP_RETURN_243, + OP_RETURN_244, + OP_RETURN_245, + OP_RETURN_246, + OP_RETURN_247, + OP_RETURN_248, + OP_RETURN_249, + OP_RETURN_250, + OP_RETURN_251, + OP_RETURN_252, + OP_RETURN_253, + OP_RETURN_254, + OP_INVALIDOPCODE, + } +}