Skip to content

Commit 4fa018f

Browse files
author
palkeo
committed
Add istambul opcodes.
1 parent c2afc7e commit 4fa018f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pano/vm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,9 @@ def trace_extend(l):
543543
off = sub_op(256, to_bytes(num))
544544
stack.append(mask_op(val, 8, off, shr=off))
545545

546+
elif op == 'selfbalance':
547+
stack.append(('balance', 'address',))
548+
546549
elif op == 'balance':
547550
addr = stack.pop()
548551
if opcode(addr) == 'mask_shl' and addr[:4] == ('mask_shl', 160, 0, 0):
@@ -768,7 +771,7 @@ def trace_extend(l):
768771
elif op in ('extcodesize', 'extcodehash', 'blockhash'):
769772
stack.append((op, stack.pop(),))
770773

771-
elif op in ['callvalue', 'caller', 'address', 'number', 'gas', 'origin', 'timestamp',
774+
elif op in ['callvalue', 'caller', 'address', 'number', 'gas', 'origin', 'timestamp', 'chainid',
772775
'difficulty', 'gasprice', 'coinbase', 'gaslimit', 'calldatasize', 'returndatasize']:
773776
stack.append(op)
774777

utils/opcode_dict.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
opcode_dict is used by the loader to disassemble a contract
55
stack_diffs is used by vm.apply_stack to test the proper parsing of opcodes
6-
6+
77
'''
88

99
opcode_dict = {
@@ -78,6 +78,8 @@
7878
0x43: 'number',
7979
0x44: 'difficulty',
8080
0x45: 'gaslimit',
81+
0x46: 'chainid',
82+
0x47: 'selfbalance',
8183

8284

8385
#
@@ -245,6 +247,8 @@
245247
"balance": 0,
246248
"origin": 1,
247249
"address": 1,
250+
"selfbalance": 1,
251+
"chainid": 1,
248252
"call": -6,
249253
"callcode": -6,
250254
"delegatecall": -5,
@@ -259,7 +263,6 @@
259263
"gasprice": 1,
260264
"extcodesize": 0,
261265
"extcodehash": 0,
262-
263266
"extcodecopy": -4,
264267
"returndatasize": 1,
265268
"returndatacopy": -3,
@@ -355,4 +358,4 @@
355358
"dup16": 1,
356359
"swap16": 0
357360

358-
}
361+
}

0 commit comments

Comments
 (0)