1
- extern crate rustc_hex ;
1
+ extern crate hex ;
2
2
extern crate wasmi;
3
3
#[ macro_use]
4
4
extern crate log;
@@ -8,7 +8,6 @@ extern crate ssz;
8
8
extern crate ssz_derive;
9
9
10
10
use primitive_types:: U256 ;
11
- use rustc_hex:: { FromHex , ToHex } ;
12
11
use serde:: { Deserialize , Serialize } ;
13
12
use ssz:: { Decode , Encode } ;
14
13
use std:: convert:: { TryFrom , TryInto } ;
@@ -35,8 +34,8 @@ impl From<std::io::Error> for ScoutError {
35
34
}
36
35
}
37
36
38
- impl From < rustc_hex :: FromHexError > for ScoutError {
39
- fn from ( error : rustc_hex :: FromHexError ) -> Self {
37
+ impl From < hex :: FromHexError > for ScoutError {
38
+ fn from ( error : hex :: FromHexError ) -> Self {
40
39
ScoutError {
41
40
0 : error. description ( ) . to_string ( ) ,
42
41
}
@@ -193,7 +192,7 @@ impl<'a> Externals for Runtime<'a> {
193
192
let tmp = memory
194
193
. get ( ptr, length as usize )
195
194
. expect ( "expects reading from memory to succeed" ) ;
196
- debug ! ( "deposit: {}" , tmp. to_hex ( ) ) ;
195
+ debug ! ( "deposit: {}" , hex :: encode ( tmp. clone ( ) ) ) ;
197
196
self . deposits . push ( tmp) ;
198
197
199
198
Ok ( None )
@@ -231,7 +230,7 @@ impl<'a> Externals for Runtime<'a> {
231
230
memory
232
231
. get_into ( ptr, & mut buf)
233
232
. expect ( "expects reading from memory to succeed" ) ;
234
- debug ! ( "print.hex: {}" , buf. to_hex ( ) ) ;
233
+ debug ! ( "print.hex: {}" , hex :: encode ( buf) . clone ( ) ) ;
235
234
Ok ( None )
236
235
}
237
236
BIGNUM_ADD256_FUNC => {
@@ -497,7 +496,8 @@ impl Default for BLSPubKey {
497
496
498
497
impl fmt:: Debug for BLSPubKey {
499
498
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
500
- write ! ( f, "{}" , self . 0 . to_hex( ) )
499
+ unimplemented ! ( )
500
+ // write!(f, "{}", hex::encode(self.0))
501
501
}
502
502
}
503
503
@@ -518,7 +518,8 @@ impl Default for BLSSignature {
518
518
519
519
impl fmt:: Debug for BLSSignature {
520
520
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
521
- write ! ( f, "{}" , self . 0 . to_hex( ) )
521
+ unimplemented ! ( )
522
+ // write!(f, "{}", hex::encode(self.0))
522
523
}
523
524
}
524
525
@@ -574,7 +575,7 @@ pub struct ShardState {
574
575
575
576
impl fmt:: Display for ShardBlockBody {
576
577
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
577
- write ! ( f, "{}" , self . data. to_hex ( ) )
578
+ write ! ( f, "{}" , hex :: encode ( self . data. clone ( ) ) )
578
579
}
579
580
}
580
581
@@ -593,7 +594,7 @@ impl fmt::Display for ShardState {
593
594
let states: Vec < String > = self
594
595
. exec_env_states
595
596
. iter ( )
596
- . map ( |x| x . bytes . to_hex ( ) )
597
+ . map ( |state| hex :: encode ( state . bytes ) )
597
598
. collect ( ) ;
598
599
write ! (
599
600
f,
@@ -723,7 +724,7 @@ struct TestFile {
723
724
}
724
725
725
726
fn hex_to_slice ( input : & str , output : & mut [ u8 ] ) -> Result < ( ) , ScoutError > {
726
- let tmp = input . from_hex ( ) ?;
727
+ let tmp = hex :: decode ( input ) ?;
727
728
if tmp. len ( ) != output. len ( ) {
728
729
return Err ( ScoutError ( "Length mismatch from hex input" . to_string ( ) ) ) ;
729
730
}
@@ -791,7 +792,7 @@ impl TryFrom<TestShardBlock> for ShardBlock {
791
792
Ok ( ShardBlock {
792
793
env : input. env ,
793
794
data : ShardBlockBody {
794
- data : input. data . from_hex ( ) ?,
795
+ data : hex :: decode ( input. data ) ?,
795
796
} ,
796
797
} )
797
798
}
0 commit comments