From a44423bf016759a19de76ff4b4167d206d9c8d82 Mon Sep 17 00:00:00 2001 From: palkeo Date: Tue, 18 Feb 2020 23:53:10 +1300 Subject: [PATCH] Add istanbul opcodes. --- pakala/env.py | 1 + pakala/sm.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pakala/env.py b/pakala/env.py index 3391145..36e2f49 100644 --- a/pakala/env.py +++ b/pakala/env.py @@ -20,6 +20,7 @@ ("calldata_size", None, 2 ** 20), ("coinbase", None, None), ("difficulty", None, None), + ("chainid", None, None), ) diff --git a/pakala/sm.py b/pakala/sm.py index e0eed74..ddf2f7a 100644 --- a/pakala/sm.py +++ b/pakala/sm.py @@ -374,6 +374,10 @@ def solution(variable): state.stack_push(state.env.gas) elif op == opcode_values.ADDRESS: state.stack_push(state.env.address) + elif op == opcode_values.CHAINID: + state.stack_push(state.env.chainid) + elif op == opcode_values.SELFBALANCE: + state.stack_push(state.env.balance) elif op == opcode_values.BALANCE: addr = solution(state.stack_pop()) if addr != solution(state.env.address):