Skip to content

Commit 96d65e5

Browse files
authored
New instructions (#1644)
* New instructions * Update evm.py * Link pyevmasm master * blkn * Fix pyevmasm dep * Fix pyevmasm link * Fix pyevmasm link * Fix deps * Remove bad merge
1 parent 4c51644 commit 96d65e5

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

manticore/platforms/evm.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def globalfakesha3(data):
9797
MASK160 = 2 ** 160 - 1
9898
TT255 = 2 ** 255
9999
TOOHIGHMEM = 0x1000
100-
DEFAULT_FORK = "constantinople"
100+
DEFAULT_FORK = "istanbul"
101101

102102
# FIXME. We should just use a Transaction() for this
103103
PendingTransaction = namedtuple(
@@ -1605,6 +1605,9 @@ def BALANCE(self, account):
16051605
"""Get balance of the given account"""
16061606
return self.world.get_balance(account)
16071607

1608+
def SELFBALANCE(self):
1609+
return self.world.get_balance(self.address)
1610+
16081611
def ORIGIN(self):
16091612
"""Get execution origination address"""
16101613
return Operators.ZEXTEND(self.world.tx_origin(), 256)
@@ -1774,6 +1777,12 @@ def EXTCODESIZE(self, account):
17741777
"""Get size of an account's code"""
17751778
return len(self.world.get_code(account))
17761779

1780+
@concretized_args(account="ACCOUNTS")
1781+
def EXTCODEHASH(self, account):
1782+
"""Get hash of code"""
1783+
bytecode = self.world.get_code(account)
1784+
return globalsha3(bytecode)
1785+
17771786
def EXTCODECOPY_gas(self, account, address, offset, size):
17781787
GCOPY = 3 # cost to copy one 32 byte word
17791788
extbytecode = self.world.get_code(account)
@@ -1835,6 +1844,11 @@ def GASLIMIT(self):
18351844
"""Get the block's gas limit"""
18361845
return self.world.block_gaslimit()
18371846

1847+
def CHAINID(self):
1848+
"""Get current chainid."""
1849+
# 1:= Ethereum Mainnet - https://chainid.network/
1850+
return 1
1851+
18381852
############################################################################
18391853
# Stack, Memory, Storage and Flow Operations
18401854
def POP(self, a):

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,14 @@ def rtd_dependent_deps():
5050
python_requires=">=3.6",
5151
install_requires=[
5252
"pyyaml",
53-
# evm dependencies
5453
"pysha3",
5554
"prettytable",
56-
"pyevmasm==0.2.0",
5755
"rlp",
5856
"ply",
5957
"crytic-compile>=0.1.1",
6058
"wasm",
6159
"dataclasses; python_version < '3.7'",
60+
"pyevmasm>=0.2.3",
6261
"psutil",
6362
]
6463
+ rtd_dependent_deps(),

0 commit comments

Comments
 (0)