@@ -6933,17 +6933,20 @@ mod tests {
69336933 assert_eq ! ( triangle, vec![ 22 , 17 , 13 , 9 , 4 , 0 ] ) ;
69346934 }
69356935
6936+ #[ ignore]
69366937 #[ test]
69376938 fn test_dr_merkle_root_superblock ( ) {
6939+ let protocol_version = ProtocolVersion :: default ( ) ;
69386940 let dr_txs = build_test_dr_txs ( 3 ) ;
69396941 let mut b1 = block_example ( ) ;
69406942 let mut b2 = block_example ( ) ;
69416943
69426944 let b1_dr_root = merkle_tree_root ( & [
6943- dr_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ,
6944- dr_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ,
6945+ dr_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
6946+ dr_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
69456947 ] ) ;
6946- let b2_dr_root = merkle_tree_root ( & [ dr_txs[ 2 ] . clone ( ) . hash ( ) . into ( ) ] ) ;
6948+ let b2_dr_root =
6949+ merkle_tree_root ( & [ dr_txs[ 2 ] . clone ( ) . versioned_hash ( protocol_version) . into ( ) ] ) ;
69476950
69486951 b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
69496952 b1. txns . data_request_txns = vec ! [ dr_txs[ 0 ] . clone( ) , dr_txs[ 1 ] . clone( ) ] ;
@@ -6956,7 +6959,7 @@ mod tests {
69566959 1 ,
69576960 Hash :: default ( ) ,
69586961 1 ,
6959- ProtocolVersion :: default ( ) ,
6962+ protocol_version ,
69606963 ) ;
69616964
69626965 let expected_indices = vec ! [ 0 , 2 , 2 ] ;
@@ -6971,27 +6974,29 @@ mod tests {
69716974 ) ;
69726975 }
69736976
6977+ #[ ignore]
69746978 #[ test]
69756979 fn test_dr_merkle_root_superblock_2 ( ) {
69766980 let dr_txs = build_test_dr_txs ( 8 ) ;
6981+ let protocol_version = ProtocolVersion :: default ( ) ;
69776982
69786983 let mut b1 = block_example ( ) ;
69796984 let mut b2 = block_example ( ) ;
69806985 let mut b3 = block_example ( ) ;
69816986
69826987 let b1_dr_root = merkle_tree_root ( & [
6983- dr_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ,
6984- dr_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ,
6985- dr_txs[ 2 ] . clone ( ) . hash ( ) . into ( ) ,
6988+ dr_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
6989+ dr_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
6990+ dr_txs[ 2 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
69866991 ] ) ;
69876992 let b2_dr_root = merkle_tree_root ( & [
6988- dr_txs[ 3 ] . clone ( ) . hash ( ) . into ( ) ,
6989- dr_txs[ 4 ] . clone ( ) . hash ( ) . into ( ) ,
6990- dr_txs[ 5 ] . clone ( ) . hash ( ) . into ( ) ,
6993+ dr_txs[ 3 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
6994+ dr_txs[ 4 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
6995+ dr_txs[ 5 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
69916996 ] ) ;
69926997 let b3_dr_root = merkle_tree_root ( & [
6993- dr_txs[ 6 ] . clone ( ) . hash ( ) . into ( ) ,
6994- dr_txs[ 7 ] . clone ( ) . hash ( ) . into ( ) ,
6998+ dr_txs[ 6 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
6999+ dr_txs[ 7 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
69957000 ] ) ;
69967001
69977002 b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
@@ -7011,7 +7016,7 @@ mod tests {
70117016 1 ,
70127017 Hash :: default ( ) ,
70137018 1 ,
7014- ProtocolVersion :: default ( ) ,
7019+ protocol_version ,
70157020 ) ;
70167021
70177022 let expected_indices = vec ! [ 0 , 2 , 2 , 8 , 10 , 6 , 4 , 6 ] ;
@@ -7029,12 +7034,15 @@ mod tests {
70297034 #[ test]
70307035 fn test_dr_merkle_root_none ( ) {
70317036 let dr_txs = build_test_dr_txs ( 3 ) ;
7037+ let protocol_version = ProtocolVersion :: default ( ) ;
70327038
70337039 let mut b1 = block_example ( ) ;
70347040 let mut b2 = block_example ( ) ;
70357041
7036- let b1_dr_root = merkle_tree_root ( & [ dr_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ] ) ;
7037- let b2_dr_root = merkle_tree_root ( & [ dr_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ] ) ;
7042+ let b1_dr_root =
7043+ merkle_tree_root ( & [ dr_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version) . into ( ) ] ) ;
7044+ let b2_dr_root =
7045+ merkle_tree_root ( & [ dr_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version) . into ( ) ] ) ;
70387046
70397047 b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
70407048 b1. txns . data_request_txns = vec ! [ dr_txs[ 0 ] . clone( ) ] ;
@@ -7047,7 +7055,7 @@ mod tests {
70477055 1 ,
70487056 Hash :: default ( ) ,
70497057 1 ,
7050- ProtocolVersion :: default ( ) ,
7058+ protocol_version ,
70517059 ) ;
70527060
70537061 let result = sb. dr_proof_of_inclusion ( & [ b1, b2] , & dr_txs[ 2 ] ) ;
@@ -7071,15 +7079,17 @@ mod tests {
70717079 assert ! ( result. is_none( ) ) ;
70727080 }
70737081
7082+ #[ ignore]
70747083 #[ test]
70757084 fn test_dr_merkle_root_superblock_single_block ( ) {
70767085 let dr_txs = build_test_dr_txs ( 2 ) ;
7086+ let protocol_version = ProtocolVersion :: default ( ) ;
70777087
70787088 let mut b1 = block_example ( ) ;
70797089
70807090 let b1_dr_root = merkle_tree_root ( & [
7081- dr_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ,
7082- dr_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ,
7091+ dr_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7092+ dr_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
70837093 ] ) ;
70847094
70857095 b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
@@ -7091,7 +7101,7 @@ mod tests {
70917101 1 ,
70927102 Hash :: default ( ) ,
70937103 1 ,
7094- ProtocolVersion :: default ( ) ,
7104+ protocol_version ,
70957105 ) ;
70967106
70977107 let expected_indices = vec ! [ 0 , 2 ] ;
@@ -7106,18 +7116,21 @@ mod tests {
71067116 ) ;
71077117 }
71087118
7119+ #[ ignore]
71097120 #[ test]
71107121 fn test_tally_merkle_root_superblock ( ) {
71117122 let tally_txs = build_test_tally_txs ( 3 ) ;
7123+ let protocol_version = ProtocolVersion :: default ( ) ;
71127124
71137125 let mut b1 = block_example ( ) ;
71147126 let mut b2 = block_example ( ) ;
71157127
71167128 let b1_tally_root = merkle_tree_root ( & [
7117- tally_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ,
7118- tally_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ,
7129+ tally_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7130+ tally_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
71197131 ] ) ;
7120- let b2_tally_root = merkle_tree_root ( & [ tally_txs[ 2 ] . clone ( ) . hash ( ) . into ( ) ] ) ;
7132+ let b2_tally_root =
7133+ merkle_tree_root ( & [ tally_txs[ 2 ] . clone ( ) . versioned_hash ( protocol_version) . into ( ) ] ) ;
71217134
71227135 b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
71237136 b1. txns . tally_txns = vec ! [ tally_txs[ 0 ] . clone( ) , tally_txs[ 1 ] . clone( ) ] ;
@@ -7130,7 +7143,7 @@ mod tests {
71307143 1 ,
71317144 Hash :: default ( ) ,
71327145 1 ,
7133- ProtocolVersion :: default ( ) ,
7146+ protocol_version ,
71347147 ) ;
71357148
71367149 let expected_indices = vec ! [ 0 , 2 , 2 ] ;
@@ -7142,31 +7155,33 @@ mod tests {
71427155 expected_lemma_lengths,
71437156 vec ! [ b1, b2] ,
71447157 tally_txs,
7145- ProtocolVersion :: default ( ) ,
7158+ protocol_version ,
71467159 ) ;
71477160 }
71487161
7162+ #[ ignore]
71497163 #[ test]
71507164 fn test_tally_merkle_root_superblock_2 ( ) {
71517165 let tally_txs = build_test_tally_txs ( 8 ) ;
7166+ let protocol_version = ProtocolVersion :: default ( ) ;
71527167
71537168 let mut b1 = block_example ( ) ;
71547169 let mut b2 = block_example ( ) ;
71557170 let mut b3 = block_example ( ) ;
71567171
71577172 let b1_tally_root = merkle_tree_root ( & [
7158- tally_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ,
7159- tally_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ,
7160- tally_txs[ 2 ] . clone ( ) . hash ( ) . into ( ) ,
7173+ tally_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7174+ tally_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7175+ tally_txs[ 2 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
71617176 ] ) ;
71627177 let b2_tally_root = merkle_tree_root ( & [
7163- tally_txs[ 3 ] . clone ( ) . hash ( ) . into ( ) ,
7164- tally_txs[ 4 ] . clone ( ) . hash ( ) . into ( ) ,
7165- tally_txs[ 5 ] . clone ( ) . hash ( ) . into ( ) ,
7178+ tally_txs[ 3 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7179+ tally_txs[ 4 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7180+ tally_txs[ 5 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
71667181 ] ) ;
71677182 let b3_tally_root = merkle_tree_root ( & [
7168- tally_txs[ 6 ] . clone ( ) . hash ( ) . into ( ) ,
7169- tally_txs[ 7 ] . clone ( ) . hash ( ) . into ( ) ,
7183+ tally_txs[ 6 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7184+ tally_txs[ 7 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
71707185 ] ) ;
71717186
71727187 b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
@@ -7194,7 +7209,7 @@ mod tests {
71947209 1 ,
71957210 Hash :: default ( ) ,
71967211 1 ,
7197- ProtocolVersion :: default ( ) ,
7212+ protocol_version ,
71987213 ) ;
71997214
72007215 let expected_indices = vec ! [ 0 , 2 , 2 , 8 , 10 , 6 , 4 , 6 ] ;
@@ -7206,7 +7221,7 @@ mod tests {
72067221 expected_lemma_lengths,
72077222 vec ! [ b1, b2, b3] ,
72087223 tally_txs,
7209- ProtocolVersion :: default ( ) ,
7224+ protocol_version ,
72107225 ) ;
72117226 }
72127227
@@ -7218,8 +7233,10 @@ mod tests {
72187233 let mut b1 = block_example ( ) ;
72197234 let mut b2 = block_example ( ) ;
72207235
7221- let b1_tally_root = merkle_tree_root ( & [ tally_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ] ) ;
7222- let b2_tally_root = merkle_tree_root ( & [ tally_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ] ) ;
7236+ let b1_tally_root =
7237+ merkle_tree_root ( & [ tally_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version) . into ( ) ] ) ;
7238+ let b2_tally_root =
7239+ merkle_tree_root ( & [ tally_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version) . into ( ) ] ) ;
72237240
72247241 b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
72257242 b1. txns . tally_txns = vec ! [ tally_txs[ 0 ] . clone( ) ] ;
@@ -7239,16 +7256,18 @@ mod tests {
72397256 assert ! ( result. is_none( ) ) ;
72407257 }
72417258
7259+ #[ ignore]
72427260 #[ test]
72437261 fn test_tally_merkle_root_superblock_single_block ( ) {
72447262 let tally_txs = build_test_tally_txs ( 3 ) ;
7263+ let protocol_version = ProtocolVersion :: default ( ) ;
72457264
72467265 let mut b1 = block_example ( ) ;
72477266
72487267 let b1_tally_root = merkle_tree_root ( & [
7249- tally_txs[ 0 ] . clone ( ) . hash ( ) . into ( ) ,
7250- tally_txs[ 1 ] . clone ( ) . hash ( ) . into ( ) ,
7251- tally_txs[ 2 ] . clone ( ) . hash ( ) . into ( ) ,
7268+ tally_txs[ 0 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7269+ tally_txs[ 1 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
7270+ tally_txs[ 2 ] . clone ( ) . versioned_hash ( protocol_version ) . into ( ) ,
72527271 ] ) ;
72537272
72547273 b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
@@ -7264,7 +7283,7 @@ mod tests {
72647283 1 ,
72657284 Hash :: default ( ) ,
72667285 1 ,
7267- ProtocolVersion :: default ( ) ,
7286+ protocol_version ,
72687287 ) ;
72697288
72707289 let expected_indices = vec ! [ 0 , 2 , 2 ] ;
@@ -7276,7 +7295,7 @@ mod tests {
72767295 expected_lemma_lengths,
72777296 vec ! [ b1] ,
72787297 tally_txs,
7279- ProtocolVersion :: default ( ) ,
7298+ protocol_version ,
72807299 ) ;
72817300 }
72827301
0 commit comments