Skip to content

Commit

Permalink
Add istambul opcodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
palkeo committed Feb 18, 2020
1 parent c2afc7e commit 4fa018f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pano/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ def trace_extend(l):
off = sub_op(256, to_bytes(num))
stack.append(mask_op(val, 8, off, shr=off))

elif op == 'selfbalance':
stack.append(('balance', 'address',))

elif op == 'balance':
addr = stack.pop()
if opcode(addr) == 'mask_shl' and addr[:4] == ('mask_shl', 160, 0, 0):
Expand Down Expand Up @@ -768,7 +771,7 @@ def trace_extend(l):
elif op in ('extcodesize', 'extcodehash', 'blockhash'):
stack.append((op, stack.pop(),))

elif op in ['callvalue', 'caller', 'address', 'number', 'gas', 'origin', 'timestamp',
elif op in ['callvalue', 'caller', 'address', 'number', 'gas', 'origin', 'timestamp', 'chainid',
'difficulty', 'gasprice', 'coinbase', 'gaslimit', 'calldatasize', 'returndatasize']:
stack.append(op)

Expand Down
9 changes: 6 additions & 3 deletions utils/opcode_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
opcode_dict is used by the loader to disassemble a contract
stack_diffs is used by vm.apply_stack to test the proper parsing of opcodes
'''

opcode_dict = {
Expand Down Expand Up @@ -78,6 +78,8 @@
0x43: 'number',
0x44: 'difficulty',
0x45: 'gaslimit',
0x46: 'chainid',
0x47: 'selfbalance',


#
Expand Down Expand Up @@ -245,6 +247,8 @@
"balance": 0,
"origin": 1,
"address": 1,
"selfbalance": 1,
"chainid": 1,
"call": -6,
"callcode": -6,
"delegatecall": -5,
Expand All @@ -259,7 +263,6 @@
"gasprice": 1,
"extcodesize": 0,
"extcodehash": 0,

"extcodecopy": -4,
"returndatasize": 1,
"returndatacopy": -3,
Expand Down Expand Up @@ -355,4 +358,4 @@
"dup16": 1,
"swap16": 0

}
}

0 comments on commit 4fa018f

Please sign in to comment.