1- extern crate rustc_hex ;
1+ extern crate hex ;
22extern crate wasmi;
33#[ macro_use]
44extern crate log;
55extern crate env_logger;
66
77use primitive_types:: U256 ;
8- use rustc_hex:: { FromHex , ToHex } ;
98use serde:: { Deserialize , Serialize } ;
109use std:: convert:: { TryFrom , TryInto } ;
1110use std:: env;
@@ -37,8 +36,8 @@ impl From<std::io::Error> for ScoutError {
3736 }
3837}
3938
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 {
4241 ScoutError {
4342 0 : error. description ( ) . to_string ( ) ,
4443 }
@@ -248,7 +247,7 @@ impl<'a> Externals for Runtime<'a> {
248247 let tmp = memory
249248 . get ( ptr, length as usize )
250249 . expect ( "expects reading from memory to succeed" ) ;
251- debug ! ( "deposit: {}" , tmp. to_hex ( ) ) ;
250+ debug ! ( "deposit: {}" , hex :: encode ( tmp. clone ( ) ) ) ;
252251 self . deposits . push ( tmp) ;
253252
254253 Ok ( None )
@@ -286,7 +285,7 @@ impl<'a> Externals for Runtime<'a> {
286285 memory
287286 . get_into ( ptr, & mut buf)
288287 . expect ( "expects reading from memory to succeed" ) ;
289- debug ! ( "print.hex: {}" , buf. to_hex ( ) ) ;
288+ debug ! ( "print.hex: {}" , hex :: encode ( buf) . clone ( ) ) ;
290289 Ok ( None )
291290 }
292291 BIGNUM_ADD256_FUNC => {
@@ -552,7 +551,8 @@ impl Default for BLSPubKey {
552551
553552impl fmt:: Debug for BLSPubKey {
554553 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))
556556 }
557557}
558558
@@ -573,7 +573,8 @@ impl Default for BLSSignature {
573573
574574impl fmt:: Debug for BLSSignature {
575575 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))
577578 }
578579}
579580
@@ -653,7 +654,7 @@ pub struct ShardState {
653654
654655impl fmt:: Display for ShardBlockBody {
655656 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
656- write ! ( f, "{}" , self . data. to_hex ( ) )
657+ write ! ( f, "{}" , hex :: encode ( self . data. clone ( ) ) )
657658 }
658659}
659660
@@ -672,7 +673,7 @@ impl fmt::Display for ShardState {
672673 let states: Vec < String > = self
673674 . exec_env_states
674675 . iter ( )
675- . map ( |x| x . bytes . to_hex ( ) )
676+ . map ( |state| hex :: encode ( state . bytes ) )
676677 . collect ( ) ;
677678 write ! (
678679 f,
@@ -784,7 +785,7 @@ struct TestFile {
784785}
785786
786787fn hex_to_slice ( input : & str , output : & mut [ u8 ] ) -> Result < ( ) , ScoutError > {
787- let tmp = input . from_hex ( ) ?;
788+ let tmp = hex :: decode ( input ) ?;
788789 if tmp. len ( ) != output. len ( ) {
789790 return Err ( ScoutError ( "Length mismatch from hex input" . to_string ( ) ) ) ;
790791 }
@@ -866,7 +867,7 @@ impl TryFrom<TestShardBlock> for ShardBlock {
866867 Ok ( ShardBlock {
867868 env : input. env ,
868869 data : ShardBlockBody {
869- data : input. data . from_hex ( ) ?,
870+ data : hex :: decode ( input. data ) ?,
870871 } ,
871872 } )
872873 }
0 commit comments