1
- extern crate rustc_hex ;
1
+ extern crate hex ;
2
2
extern crate wasmi;
3
3
#[ macro_use]
4
4
extern crate log;
5
5
extern crate env_logger;
6
6
7
7
use primitive_types:: U256 ;
8
- use rustc_hex:: { FromHex , ToHex } ;
9
8
use serde:: { Deserialize , Serialize } ;
10
9
use std:: convert:: { TryFrom , TryInto } ;
11
10
use std:: env;
@@ -37,8 +36,8 @@ impl From<std::io::Error> for ScoutError {
37
36
}
38
37
}
39
38
40
- impl From < rustc_hex :: FromHexError > for ScoutError {
41
- fn from ( error : rustc_hex :: FromHexError ) -> Self {
39
+ impl From < hex :: FromHexError > for ScoutError {
40
+ fn from ( error : hex :: FromHexError ) -> Self {
42
41
ScoutError {
43
42
0 : error. description ( ) . to_string ( ) ,
44
43
}
@@ -248,7 +247,7 @@ impl<'a> Externals for Runtime<'a> {
248
247
let tmp = memory
249
248
. get ( ptr, length as usize )
250
249
. expect ( "expects reading from memory to succeed" ) ;
251
- debug ! ( "deposit: {}" , tmp. to_hex ( ) ) ;
250
+ debug ! ( "deposit: {}" , hex :: encode ( tmp. clone ( ) ) ) ;
252
251
self . deposits . push ( tmp) ;
253
252
254
253
Ok ( None )
@@ -286,7 +285,7 @@ impl<'a> Externals for Runtime<'a> {
286
285
memory
287
286
. get_into ( ptr, & mut buf)
288
287
. expect ( "expects reading from memory to succeed" ) ;
289
- debug ! ( "print.hex: {}" , buf. to_hex ( ) ) ;
288
+ debug ! ( "print.hex: {}" , hex :: encode ( buf) . clone ( ) ) ;
290
289
Ok ( None )
291
290
}
292
291
BIGNUM_ADD256_FUNC => {
@@ -552,7 +551,8 @@ impl Default for BLSPubKey {
552
551
553
552
impl fmt:: Debug for BLSPubKey {
554
553
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
555
- write ! ( f, "{}" , self . 0 . to_hex( ) )
554
+ unimplemented ! ( )
555
+ // write!(f, "{}", hex::encode(self.0))
556
556
}
557
557
}
558
558
@@ -573,7 +573,8 @@ impl Default for BLSSignature {
573
573
574
574
impl fmt:: Debug for BLSSignature {
575
575
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
576
- write ! ( f, "{}" , self . 0 . to_hex( ) )
576
+ unimplemented ! ( )
577
+ // write!(f, "{}", hex::encode(self.0))
577
578
}
578
579
}
579
580
@@ -653,7 +654,7 @@ pub struct ShardState {
653
654
654
655
impl fmt:: Display for ShardBlockBody {
655
656
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
656
- write ! ( f, "{}" , self . data. to_hex ( ) )
657
+ write ! ( f, "{}" , hex :: encode ( self . data. clone ( ) ) )
657
658
}
658
659
}
659
660
@@ -672,7 +673,7 @@ impl fmt::Display for ShardState {
672
673
let states: Vec < String > = self
673
674
. exec_env_states
674
675
. iter ( )
675
- . map ( |x| x . bytes . to_hex ( ) )
676
+ . map ( |state| hex :: encode ( state . bytes ) )
676
677
. collect ( ) ;
677
678
write ! (
678
679
f,
@@ -784,7 +785,7 @@ struct TestFile {
784
785
}
785
786
786
787
fn hex_to_slice ( input : & str , output : & mut [ u8 ] ) -> Result < ( ) , ScoutError > {
787
- let tmp = input . from_hex ( ) ?;
788
+ let tmp = hex :: decode ( input ) ?;
788
789
if tmp. len ( ) != output. len ( ) {
789
790
return Err ( ScoutError ( "Length mismatch from hex input" . to_string ( ) ) ) ;
790
791
}
@@ -866,7 +867,7 @@ impl TryFrom<TestShardBlock> for ShardBlock {
866
867
Ok ( ShardBlock {
867
868
env : input. env ,
868
869
data : ShardBlockBody {
869
- data : input. data . from_hex ( ) ?,
870
+ data : hex :: decode ( input. data ) ?,
870
871
} ,
871
872
} )
872
873
}
0 commit comments