@@ -41,7 +41,7 @@ mod tests {
4141
4242 use crate :: consensus:: VoteStep ;
4343
44- use primitives:: H256 ;
44+ use primitives:: { u256_from_u128 , BigEndianHash , H256 } ;
4545
4646 #[ test]
4747 fn test_initial_set ( ) {
@@ -74,12 +74,12 @@ mod tests {
7474
7575 checker. check ( & VoteOn {
7676 step : VoteStep :: new ( 100 , 10 , Step :: Prevote ) ,
77- block_hash : Some ( H256 :: from ( 1 ) . into ( ) ) ,
77+ block_hash : Some ( H256 :: from_uint ( & u256_from_u128 ( 1u128 ) ) . into ( ) ) ,
7878 } ) ;
7979
8080 assert ! ( checker. check( & VoteOn {
8181 step: VoteStep :: new( 101 , 10 , Step :: Prevote ) ,
82- block_hash: Some ( H256 :: from ( 2 ) . into( ) )
82+ block_hash: Some ( H256 :: from_uint ( & u256_from_u128 ( 2u128 ) ) . into( ) ) ,
8383 } ) )
8484 }
8585
@@ -89,12 +89,12 @@ mod tests {
8989
9090 checker. check ( & VoteOn {
9191 step : VoteStep :: new ( 100 , 10 , Step :: Prevote ) ,
92- block_hash : Some ( H256 :: from ( 1 ) . into ( ) ) ,
92+ block_hash : Some ( H256 :: from_uint ( & u256_from_u128 ( 1u128 ) ) . into ( ) ) ,
9393 } ) ;
9494
9595 assert ! ( !checker. check( & VoteOn {
9696 step: VoteStep :: new( 99 , 10 , Step :: Prevote ) ,
97- block_hash: Some ( H256 :: from ( 2 ) . into( ) )
97+ block_hash: Some ( H256 :: from_uint ( & u256_from_u128 ( 2u128 ) ) . into( ) ) ,
9898 } ) )
9999 }
100100
@@ -104,12 +104,12 @@ mod tests {
104104
105105 checker. check ( & VoteOn {
106106 step : VoteStep :: new ( 100 , 10 , Step :: Prevote ) ,
107- block_hash : Some ( H256 :: from ( 1 ) . into ( ) ) ,
107+ block_hash : Some ( H256 :: from_uint ( & u256_from_u128 ( 1u128 ) ) . into ( ) ) ,
108108 } ) ;
109109
110110 assert ! ( checker. check( & VoteOn {
111111 step: VoteStep :: new( 100 , 11 , Step :: Prevote ) ,
112- block_hash: Some ( H256 :: from ( 2 ) . into( ) )
112+ block_hash: Some ( H256 :: from_uint ( & u256_from_u128 ( 2u128 ) ) . into( ) ) ,
113113 } ) )
114114 }
115115
@@ -119,12 +119,12 @@ mod tests {
119119
120120 checker. check ( & VoteOn {
121121 step : VoteStep :: new ( 100 , 10 , Step :: Prevote ) ,
122- block_hash : Some ( H256 :: from ( 1 ) . into ( ) ) ,
122+ block_hash : Some ( H256 :: from_uint ( & u256_from_u128 ( 1u128 ) ) . into ( ) ) ,
123123 } ) ;
124124
125125 assert ! ( !checker. check( & VoteOn {
126126 step: VoteStep :: new( 100 , 9 , Step :: Prevote ) ,
127- block_hash: Some ( H256 :: from ( 2 ) . into( ) )
127+ block_hash: Some ( H256 :: from_uint ( & u256_from_u128 ( 2u128 ) ) . into( ) ) ,
128128 } ) )
129129 }
130130
@@ -134,12 +134,12 @@ mod tests {
134134
135135 checker. check ( & VoteOn {
136136 step : VoteStep :: new ( 100 , 10 , Step :: Prevote ) ,
137- block_hash : Some ( H256 :: from ( 1 ) . into ( ) ) ,
137+ block_hash : Some ( H256 :: from_uint ( & u256_from_u128 ( 1u128 ) ) . into ( ) ) ,
138138 } ) ;
139139
140140 assert ! ( checker. check( & VoteOn {
141141 step: VoteStep :: new( 100 , 10 , Step :: Precommit ) ,
142- block_hash: Some ( H256 :: from ( 2 ) . into( ) )
142+ block_hash: Some ( H256 :: from_uint ( & u256_from_u128 ( 2u128 ) ) . into( ) )
143143 } ) )
144144 }
145145
@@ -149,12 +149,12 @@ mod tests {
149149
150150 checker. check ( & VoteOn {
151151 step : VoteStep :: new ( 100 , 10 , Step :: Prevote ) ,
152- block_hash : Some ( H256 :: from ( 1 ) . into ( ) ) ,
152+ block_hash : Some ( H256 :: from_uint ( & u256_from_u128 ( 1u128 ) ) . into ( ) ) ,
153153 } ) ;
154154
155155 assert ! ( !checker. check( & VoteOn {
156156 step: VoteStep :: new( 100 , 10 , Step :: Propose ) ,
157- block_hash: Some ( H256 :: from ( 2 ) . into( ) )
157+ block_hash: Some ( H256 :: from_uint ( & u256_from_u128 ( 2u128 ) ) . into( ) )
158158 } ) )
159159 }
160160
@@ -180,12 +180,12 @@ mod tests {
180180
181181 checker. check ( & VoteOn {
182182 step : VoteStep :: new ( 100 , 10 , Step :: Prevote ) ,
183- block_hash : Some ( H256 :: from ( 1 ) . into ( ) ) ,
183+ block_hash : Some ( H256 :: from_uint ( & u256_from_u128 ( 1u128 ) ) . into ( ) ) ,
184184 } ) ;
185185
186186 assert ! ( !checker. check( & VoteOn {
187187 step: VoteStep :: new( 100 , 10 , Step :: Prevote ) ,
188- block_hash: Some ( H256 :: from ( 2 ) . into( ) )
188+ block_hash: Some ( H256 :: from_uint ( & u256_from_u128 ( 2u128 ) ) . into( ) )
189189 } ) )
190190 }
191191}
0 commit comments