@@ -8,9 +8,9 @@ use evm::executor::stack::{
88use evm:: { Config , Context , ExitError , ExitSucceed } ;
99use lazy_static:: lazy_static;
1010use libsecp256k1:: SecretKey ;
11- use sha3:: { Digest , Keccak256 } ;
1211use primitive_types:: { H160 , H256 , U256 } ;
1312use serde:: Deserialize ;
13+ use sha3:: { Digest , Keccak256 } ;
1414use std:: collections:: BTreeMap ;
1515use std:: convert:: TryInto ;
1616
@@ -30,7 +30,7 @@ impl Test {
3030 let public = libsecp256k1:: PublicKey :: from_secret_key ( & secret. unwrap ( ) ) ;
3131 let mut res = [ 0u8 ; 64 ] ;
3232 res. copy_from_slice ( & public. serialize ( ) [ 1 ..65 ] ) ;
33-
33+
3434 H160 :: from ( H256 :: from_slice ( Keccak256 :: digest ( & res) . as_slice ( ) ) )
3535 }
3636
@@ -97,12 +97,7 @@ lazy_static! {
9797
9898macro_rules! precompile_entry {
9999 ( $map: expr, $builtins: expr, $index: expr) => {
100- let x: fn (
101- & [ u8 ] ,
102- Option <u64 >,
103- & Context ,
104- bool ,
105- ) -> Result <PrecompileOutput , PrecompileFailure > =
100+ let x: PrecompileFn =
106101 |input: & [ u8 ] , gas_limit: Option <u64 >, _context: & Context , _is_static: bool | {
107102 let builtin = $builtins. get( & H160 :: from_low_u64_be( $index) ) . unwrap( ) ;
108103 Self :: exec_as_precompile( builtin, input, gas_limit)
@@ -167,7 +162,7 @@ impl JsonPrecompile {
167162 builtin : & ethcore_builtin:: Builtin ,
168163 input : & [ u8 ] ,
169164 gas_limit : Option < u64 > ,
170- ) -> Result < PrecompileOutput , PrecompileFailure > {
165+ ) -> Result < ( PrecompileOutput , u64 ) , PrecompileFailure > {
171166 let cost = builtin. cost ( input, 0 ) ;
172167
173168 if let Some ( target_gas) = gas_limit {
@@ -180,12 +175,13 @@ impl JsonPrecompile {
180175
181176 let mut output = Vec :: new ( ) ;
182177 match builtin. execute ( input, & mut parity_bytes:: BytesRef :: Flexible ( & mut output) ) {
183- Ok ( ( ) ) => Ok ( PrecompileOutput {
184- exit_status : ExitSucceed :: Stopped ,
185- output,
186- cost : cost. as_u64 ( ) ,
187- logs : Vec :: new ( ) ,
188- } ) ,
178+ Ok ( ( ) ) => Ok ( (
179+ PrecompileOutput {
180+ exit_status : ExitSucceed :: Stopped ,
181+ output,
182+ } ,
183+ cost. as_u64 ( ) ,
184+ ) ) ,
189185 Err ( e) => Err ( PrecompileFailure :: Error {
190186 exit_status : ExitError :: Other ( e. into ( ) ) ,
191187 } ) ,
0 commit comments