@@ -380,6 +380,9 @@ impl<Cost: CostType> Interpreter<Cost> {
380
380
// Get sender & receive addresses, check if we have balance
381
381
let ( sender_address, receive_address, has_balance, call_type) = match instruction {
382
382
instructions:: CALL => {
383
+ if ext. is_static ( ) && value. map_or ( false , |v| !v. is_zero ( ) ) {
384
+ return Err ( vm:: Error :: MutableCallInStaticContext ) ;
385
+ }
383
386
let has_balance = ext. balance ( & params. address ) ? >= value. expect ( "value set for all but delegate call and staticcall; qed" ) ;
384
387
( & params. address , & code_address, has_balance, CallType :: Call )
385
388
} ,
@@ -388,11 +391,11 @@ impl<Cost: CostType> Interpreter<Cost> {
388
391
( & params. address , & params. address , has_balance, CallType :: CallCode )
389
392
} ,
390
393
instructions:: DELEGATECALL => ( & params. sender , & params. address , true , CallType :: DelegateCall ) ,
391
- instructions:: STATICCALL => ( & params. sender , & code_address, true , CallType :: StaticCall ) ,
394
+ instructions:: STATICCALL => ( & params. address , & code_address, true , CallType :: StaticCall ) ,
392
395
_ => panic ! ( format!( "Unexpected instruction {} in CALL branch." , instruction) )
393
396
} ;
394
397
395
- // clear return data buffer before crearing new call frame.
398
+ // clear return data buffer before creating new call frame.
396
399
self . return_data = ReturnData :: empty ( ) ;
397
400
398
401
let can_call = has_balance && ext. depth ( ) < ext. schedule ( ) . max_depth ;
@@ -415,6 +418,11 @@ impl<Cost: CostType> Interpreter<Cost> {
415
418
self . return_data = data;
416
419
Ok ( InstructionResult :: UnusedGas ( Cost :: from_u256 ( gas_left) . expect ( "Gas left cannot be greater then current one" ) ) )
417
420
} ,
421
+ MessageCallResult :: Reverted ( gas_left, data) => {
422
+ stack. push ( U256 :: zero ( ) ) ;
423
+ self . return_data = data;
424
+ Ok ( InstructionResult :: UnusedGas ( Cost :: from_u256 ( gas_left) . expect ( "Gas left cannot be greater then current one" ) ) )
425
+ } ,
418
426
MessageCallResult :: Failed => {
419
427
stack. push ( U256 :: zero ( ) ) ;
420
428
Ok ( InstructionResult :: Ok )
0 commit comments