1- extern crate rustc_hex ;
1+ extern crate hex ;
22extern crate wasmi;
33#[ macro_use]
44extern crate log;
@@ -8,7 +8,6 @@ extern crate ssz;
88extern crate ssz_derive;
99
1010use primitive_types:: U256 ;
11- use rustc_hex:: { FromHex , ToHex } ;
1211use serde:: { Deserialize , Serialize } ;
1312use ssz:: { Decode , Encode } ;
1413use std:: convert:: { TryFrom , TryInto } ;
@@ -35,8 +34,8 @@ impl From<std::io::Error> for ScoutError {
3534 }
3635}
3736
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 {
4039 ScoutError {
4140 0 : error. description ( ) . to_string ( ) ,
4241 }
@@ -246,7 +245,7 @@ impl<'a> Externals for Runtime<'a> {
246245 let tmp = memory
247246 . get ( ptr, length as usize )
248247 . expect ( "expects reading from memory to succeed" ) ;
249- debug ! ( "deposit: {}" , tmp. to_hex ( ) ) ;
248+ debug ! ( "deposit: {}" , hex :: encode ( tmp. clone ( ) ) ) ;
250249 self . deposits . push ( tmp) ;
251250
252251 Ok ( None )
@@ -284,7 +283,7 @@ impl<'a> Externals for Runtime<'a> {
284283 memory
285284 . get_into ( ptr, & mut buf)
286285 . expect ( "expects reading from memory to succeed" ) ;
287- debug ! ( "print.hex: {}" , buf. to_hex ( ) ) ;
286+ debug ! ( "print.hex: {}" , hex :: encode ( buf) . clone ( ) ) ;
288287 Ok ( None )
289288 }
290289 BIGNUM_ADD256_FUNC => {
@@ -550,7 +549,8 @@ impl Default for BLSPubKey {
550549
551550impl fmt:: Debug for BLSPubKey {
552551 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
553- write ! ( f, "{}" , self . 0 . to_hex( ) )
552+ unimplemented ! ( )
553+ // write!(f, "{}", hex::encode(self.0))
554554 }
555555}
556556
@@ -571,7 +571,8 @@ impl Default for BLSSignature {
571571
572572impl fmt:: Debug for BLSSignature {
573573 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
574- write ! ( f, "{}" , self . 0 . to_hex( ) )
574+ unimplemented ! ( )
575+ // write!(f, "{}", hex::encode(self.0))
575576 }
576577}
577578
@@ -628,7 +629,7 @@ pub struct ShardState {
628629
629630impl fmt:: Display for ShardBlockBody {
630631 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
631- write ! ( f, "{}" , self . data. to_hex ( ) )
632+ write ! ( f, "{}" , hex :: encode ( self . data. clone ( ) ) )
632633 }
633634}
634635
@@ -647,7 +648,7 @@ impl fmt::Display for ShardState {
647648 let states: Vec < String > = self
648649 . exec_env_states
649650 . iter ( )
650- . map ( |x| x . bytes . to_hex ( ) )
651+ . map ( |state| hex :: encode ( state . bytes ) )
651652 . collect ( ) ;
652653 write ! (
653654 f,
@@ -762,7 +763,7 @@ struct TestFile {
762763}
763764
764765fn hex_to_slice ( input : & str , output : & mut [ u8 ] ) -> Result < ( ) , ScoutError > {
765- let tmp = input . from_hex ( ) ?;
766+ let tmp = hex :: decode ( input ) ?;
766767 if tmp. len ( ) != output. len ( ) {
767768 return Err ( ScoutError ( "Length mismatch from hex input" . to_string ( ) ) ) ;
768769 }
@@ -844,7 +845,7 @@ impl TryFrom<TestShardBlock> for ShardBlock {
844845 Ok ( ShardBlock {
845846 env : input. env ,
846847 data : ShardBlockBody {
847- data : input. data . from_hex ( ) ?,
848+ data : hex :: decode ( input. data ) ?,
848849 } ,
849850 } )
850851 }
0 commit comments