@@ -533,6 +533,8 @@ def vm_execute(ext, msg, code):
533
533
mstart , msz = stk .pop (), stk .pop ()
534
534
topics = [stk .pop () for x in range (depth )]
535
535
compustate .gas -= msz * opcodes .GLOGBYTE
536
+ if msg .static :
537
+ return vm_exception ('Cannot LOG inside a static context' )
536
538
if not mem_extend (mem , compustate , op , mstart , msz ):
537
539
return vm_exception ('OOG EXTENDING MEMORY' )
538
540
data = bytearray_to_bytestr (mem [mstart : mstart + msz ])
@@ -570,8 +572,8 @@ def vm_execute(ext, msg, code):
570
572
stk .pop (), stk .pop (), stk .pop (), stk .pop (), stk .pop (), stk .pop ()
571
573
value = 0
572
574
# Static context prohibition
573
- if msg .static and op != 'STATICCALL' :
574
- return vm_exception ('Cannot %s inside a static context' % op )
575
+ if msg .static and value > 0 :
576
+ return vm_exception ('Cannot make a non-zero-value call inside a static context' )
575
577
# Expand memory
576
578
if not mem_extend (mem , compustate , op , meminstart , meminsz ) or \
577
579
not mem_extend (mem , compustate , op , memoutstart , memoutsz ):
@@ -602,15 +604,15 @@ def vm_execute(ext, msg, code):
602
604
# Generate the message
603
605
if op == 'CALL' :
604
606
call_msg = Message (msg .to , to , value , submsg_gas , cd ,
605
- msg .depth + 1 , code_address = to )
607
+ msg .depth + 1 , code_address = to , static = msg . static )
606
608
elif ext .post_homestead_hardfork () and op == 'DELEGATECALL' :
607
609
call_msg = Message (msg .sender , msg .to , msg .value , submsg_gas , cd ,
608
- msg .depth + 1 , code_address = to , transfers_value = False )
610
+ msg .depth + 1 , code_address = to , transfers_value = False , static = msg . static )
609
611
elif op == 'DELEGATECALL' :
610
612
return vm_exception ('OPCODE INACTIVE' )
611
613
elif op == 'CALLCODE' :
612
614
call_msg = Message (msg .to , msg .to , value , submsg_gas , cd ,
613
- msg .depth + 1 , code_address = to )
615
+ msg .depth + 1 , code_address = to , static = msg . static )
614
616
elif op == 'STATICCALL' :
615
617
call_msg = Message (msg .to , to , value , submsg_gas , cd ,
616
618
msg .depth + 1 , code_address = to , static = True )
0 commit comments