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
This commit is contained in:
feliam
2020-04-23 15:44:25 -03:00
committed by GitHub
parent 4c51644aa7
commit 96d65e5fe9
2 changed files with 16 additions and 3 deletions
+15 -1
View File
@@ -97,7 +97,7 @@ TT256M1 = 2 ** 256 - 1
MASK160 = 2 ** 160 - 1
TT255 = 2 ** 255
TOOHIGHMEM = 0x1000
DEFAULT_FORK = "constantinople"
DEFAULT_FORK = "istanbul"
# FIXME. We should just use a Transaction() for this
PendingTransaction = namedtuple(
@@ -1605,6 +1605,9 @@ class EVM(Eventful):
"""Get balance of the given account"""
return self.world.get_balance(account)
def SELFBALANCE(self):
return self.world.get_balance(self.address)
def ORIGIN(self):
"""Get execution origination address"""
return Operators.ZEXTEND(self.world.tx_origin(), 256)
@@ -1774,6 +1777,12 @@ class EVM(Eventful):
"""Get size of an account's code"""
return len(self.world.get_code(account))
@concretized_args(account="ACCOUNTS")
def EXTCODEHASH(self, account):
"""Get hash of code"""
bytecode = self.world.get_code(account)
return globalsha3(bytecode)
def EXTCODECOPY_gas(self, account, address, offset, size):
GCOPY = 3 # cost to copy one 32 byte word
extbytecode = self.world.get_code(account)
@@ -1835,6 +1844,11 @@ class EVM(Eventful):
"""Get the block's gas limit"""
return self.world.block_gaslimit()
def CHAINID(self):
"""Get current chainid."""
# 1:= Ethereum Mainnet - https://chainid.network/
return 1
############################################################################
# Stack, Memory, Storage and Flow Operations
def POP(self, a):
+1 -2
View File
@@ -50,15 +50,14 @@ setup(
python_requires=">=3.6",
install_requires=[
"pyyaml",
# evm dependencies
"pysha3",
"prettytable",
"pyevmasm==0.2.0",
"rlp",
"ply",
"crytic-compile>=0.1.1",
"wasm",
"dataclasses; python_version < '3.7'",
"pyevmasm>=0.2.3",
"psutil",
]
+ rtd_dependent_deps(),