Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 06e3c81

Browse files
vubvub
authored andcommitted
Changed to DELEGATECALL
1 parent b96d389 commit 06e3c81

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ethereum/opcodes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
0xf1: ['CALL', 7, 1, 40],
6666
0xf2: ['CALLCODE', 7, 1, 40],
6767
0xf3: ['RETURN', 2, 0, 0],
68+
0xf4: ['DELEGATECALL', 2, 0, 0],
6869
0xff: ['SUICIDE', 1, 0, 0],
6970
}
7071

ethereum/vm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def vm_execute(ext, msg, code):
533533
else:
534534
compustate.gas -= (gas + extra_gas - submsg_gas)
535535
stk.append(0)
536-
elif op == 'CALLCODE':
536+
elif op == 'CALLCODE' or op == 'DELEGATECALL':
537537
gas, to, value, meminstart, meminsz, memoutstart, memoutsz = \
538538
stk.pop(), stk.pop(), stk.pop(), stk.pop(), stk.pop(), stk.pop(), stk.pop()
539539
if not mem_extend(mem, compustate, op, meminstart, meminsz) or \
@@ -548,9 +548,11 @@ def vm_execute(ext, msg, code):
548548
to = utils.encode_int(to)
549549
to = ((b'\x00' * (32 - len(to))) + to)[12:]
550550
cd = CallData(mem, meminstart, meminsz)
551-
if ext.post_homestead_hardfork():
551+
if ext.post_homestead_hardfork() and op == 'DELEGATECALL':
552552
call_msg = Message(msg.sender, msg.to, msg.value, submsg_gas, cd,
553553
msg.depth + 1, code_address=to)
554+
elif op == 'DELEGATECALL':
555+
return vm_exception('OPCODE INACTIVE')
554556
else:
555557
call_msg = Message(msg.to, msg.to, value, submsg_gas, cd,
556558
msg.depth + 1, code_address=to)

0 commit comments

Comments
 (0)