@@ -6933,17 +6933,20 @@ mod tests {
6933
6933
assert_eq ! ( triangle, vec![ 22 , 17 , 13 , 9 , 4 , 0 ] ) ;
6934
6934
}
6935
6935
6936
+ #[ ignore]
6936
6937
#[ test]
6937
6938
fn test_dr_merkle_root_superblock ( ) {
6939
+ let protocol_version = ProtocolVersion :: default ( ) ;
6938
6940
let dr_txs = build_test_dr_txs ( 3 ) ;
6939
6941
let mut b1 = block_example ( ) ;
6940
6942
let mut b2 = block_example ( ) ;
6941
6943
6942
6944
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 ( ) ,
6945
6947
] ) ;
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 ( ) ] ) ;
6947
6950
6948
6951
b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
6949
6952
b1. txns . data_request_txns = vec ! [ dr_txs[ 0 ] . clone( ) , dr_txs[ 1 ] . clone( ) ] ;
@@ -6956,7 +6959,7 @@ mod tests {
6956
6959
1 ,
6957
6960
Hash :: default ( ) ,
6958
6961
1 ,
6959
- ProtocolVersion :: default ( ) ,
6962
+ protocol_version ,
6960
6963
) ;
6961
6964
6962
6965
let expected_indices = vec ! [ 0 , 2 , 2 ] ;
@@ -6971,27 +6974,29 @@ mod tests {
6971
6974
) ;
6972
6975
}
6973
6976
6977
+ #[ ignore]
6974
6978
#[ test]
6975
6979
fn test_dr_merkle_root_superblock_2 ( ) {
6976
6980
let dr_txs = build_test_dr_txs ( 8 ) ;
6981
+ let protocol_version = ProtocolVersion :: default ( ) ;
6977
6982
6978
6983
let mut b1 = block_example ( ) ;
6979
6984
let mut b2 = block_example ( ) ;
6980
6985
let mut b3 = block_example ( ) ;
6981
6986
6982
6987
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 ( ) ,
6986
6991
] ) ;
6987
6992
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 ( ) ,
6991
6996
] ) ;
6992
6997
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 ( ) ,
6995
7000
] ) ;
6996
7001
6997
7002
b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
@@ -7011,7 +7016,7 @@ mod tests {
7011
7016
1 ,
7012
7017
Hash :: default ( ) ,
7013
7018
1 ,
7014
- ProtocolVersion :: default ( ) ,
7019
+ protocol_version ,
7015
7020
) ;
7016
7021
7017
7022
let expected_indices = vec ! [ 0 , 2 , 2 , 8 , 10 , 6 , 4 , 6 ] ;
@@ -7029,12 +7034,15 @@ mod tests {
7029
7034
#[ test]
7030
7035
fn test_dr_merkle_root_none ( ) {
7031
7036
let dr_txs = build_test_dr_txs ( 3 ) ;
7037
+ let protocol_version = ProtocolVersion :: default ( ) ;
7032
7038
7033
7039
let mut b1 = block_example ( ) ;
7034
7040
let mut b2 = block_example ( ) ;
7035
7041
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 ( ) ] ) ;
7038
7046
7039
7047
b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
7040
7048
b1. txns . data_request_txns = vec ! [ dr_txs[ 0 ] . clone( ) ] ;
@@ -7047,7 +7055,7 @@ mod tests {
7047
7055
1 ,
7048
7056
Hash :: default ( ) ,
7049
7057
1 ,
7050
- ProtocolVersion :: default ( ) ,
7058
+ protocol_version ,
7051
7059
) ;
7052
7060
7053
7061
let result = sb. dr_proof_of_inclusion ( & [ b1, b2] , & dr_txs[ 2 ] ) ;
@@ -7071,15 +7079,17 @@ mod tests {
7071
7079
assert ! ( result. is_none( ) ) ;
7072
7080
}
7073
7081
7082
+ #[ ignore]
7074
7083
#[ test]
7075
7084
fn test_dr_merkle_root_superblock_single_block ( ) {
7076
7085
let dr_txs = build_test_dr_txs ( 2 ) ;
7086
+ let protocol_version = ProtocolVersion :: default ( ) ;
7077
7087
7078
7088
let mut b1 = block_example ( ) ;
7079
7089
7080
7090
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 ( ) ,
7083
7093
] ) ;
7084
7094
7085
7095
b1. block_header . merkle_roots . dr_hash_merkle_root = b1_dr_root. into ( ) ;
@@ -7091,7 +7101,7 @@ mod tests {
7091
7101
1 ,
7092
7102
Hash :: default ( ) ,
7093
7103
1 ,
7094
- ProtocolVersion :: default ( ) ,
7104
+ protocol_version ,
7095
7105
) ;
7096
7106
7097
7107
let expected_indices = vec ! [ 0 , 2 ] ;
@@ -7106,18 +7116,21 @@ mod tests {
7106
7116
) ;
7107
7117
}
7108
7118
7119
+ #[ ignore]
7109
7120
#[ test]
7110
7121
fn test_tally_merkle_root_superblock ( ) {
7111
7122
let tally_txs = build_test_tally_txs ( 3 ) ;
7123
+ let protocol_version = ProtocolVersion :: default ( ) ;
7112
7124
7113
7125
let mut b1 = block_example ( ) ;
7114
7126
let mut b2 = block_example ( ) ;
7115
7127
7116
7128
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 ( ) ,
7119
7131
] ) ;
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 ( ) ] ) ;
7121
7134
7122
7135
b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
7123
7136
b1. txns . tally_txns = vec ! [ tally_txs[ 0 ] . clone( ) , tally_txs[ 1 ] . clone( ) ] ;
@@ -7130,7 +7143,7 @@ mod tests {
7130
7143
1 ,
7131
7144
Hash :: default ( ) ,
7132
7145
1 ,
7133
- ProtocolVersion :: default ( ) ,
7146
+ protocol_version ,
7134
7147
) ;
7135
7148
7136
7149
let expected_indices = vec ! [ 0 , 2 , 2 ] ;
@@ -7142,31 +7155,33 @@ mod tests {
7142
7155
expected_lemma_lengths,
7143
7156
vec ! [ b1, b2] ,
7144
7157
tally_txs,
7145
- ProtocolVersion :: default ( ) ,
7158
+ protocol_version ,
7146
7159
) ;
7147
7160
}
7148
7161
7162
+ #[ ignore]
7149
7163
#[ test]
7150
7164
fn test_tally_merkle_root_superblock_2 ( ) {
7151
7165
let tally_txs = build_test_tally_txs ( 8 ) ;
7166
+ let protocol_version = ProtocolVersion :: default ( ) ;
7152
7167
7153
7168
let mut b1 = block_example ( ) ;
7154
7169
let mut b2 = block_example ( ) ;
7155
7170
let mut b3 = block_example ( ) ;
7156
7171
7157
7172
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 ( ) ,
7161
7176
] ) ;
7162
7177
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 ( ) ,
7166
7181
] ) ;
7167
7182
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 ( ) ,
7170
7185
] ) ;
7171
7186
7172
7187
b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
@@ -7194,7 +7209,7 @@ mod tests {
7194
7209
1 ,
7195
7210
Hash :: default ( ) ,
7196
7211
1 ,
7197
- ProtocolVersion :: default ( ) ,
7212
+ protocol_version ,
7198
7213
) ;
7199
7214
7200
7215
let expected_indices = vec ! [ 0 , 2 , 2 , 8 , 10 , 6 , 4 , 6 ] ;
@@ -7206,7 +7221,7 @@ mod tests {
7206
7221
expected_lemma_lengths,
7207
7222
vec ! [ b1, b2, b3] ,
7208
7223
tally_txs,
7209
- ProtocolVersion :: default ( ) ,
7224
+ protocol_version ,
7210
7225
) ;
7211
7226
}
7212
7227
@@ -7218,8 +7233,10 @@ mod tests {
7218
7233
let mut b1 = block_example ( ) ;
7219
7234
let mut b2 = block_example ( ) ;
7220
7235
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 ( ) ] ) ;
7223
7240
7224
7241
b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
7225
7242
b1. txns . tally_txns = vec ! [ tally_txs[ 0 ] . clone( ) ] ;
@@ -7239,16 +7256,18 @@ mod tests {
7239
7256
assert ! ( result. is_none( ) ) ;
7240
7257
}
7241
7258
7259
+ #[ ignore]
7242
7260
#[ test]
7243
7261
fn test_tally_merkle_root_superblock_single_block ( ) {
7244
7262
let tally_txs = build_test_tally_txs ( 3 ) ;
7263
+ let protocol_version = ProtocolVersion :: default ( ) ;
7245
7264
7246
7265
let mut b1 = block_example ( ) ;
7247
7266
7248
7267
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 ( ) ,
7252
7271
] ) ;
7253
7272
7254
7273
b1. block_header . merkle_roots . tally_hash_merkle_root = b1_tally_root. into ( ) ;
@@ -7264,7 +7283,7 @@ mod tests {
7264
7283
1 ,
7265
7284
Hash :: default ( ) ,
7266
7285
1 ,
7267
- ProtocolVersion :: default ( ) ,
7286
+ protocol_version ,
7268
7287
) ;
7269
7288
7270
7289
let expected_indices = vec ! [ 0 , 2 , 2 ] ;
@@ -7276,7 +7295,7 @@ mod tests {
7276
7295
expected_lemma_lengths,
7277
7296
vec ! [ b1] ,
7278
7297
tally_txs,
7279
- ProtocolVersion :: default ( ) ,
7298
+ protocol_version ,
7280
7299
) ;
7281
7300
}
7282
7301
0 commit comments