Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fixtures
2 changes: 2 additions & 0 deletions newsfragments/1255.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Upgrade to Py-EVM ``0.3.0a8`` adding the planned Istanbul block for mainnet. See all the
`other changes in the latest py-evm <https://py-evm.readthedocs.io/en/latest/release_notes.html#py-evm-0-3-0-alpha-8-2019-11-05>`_
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
from setuptools import setup, find_packages

PYEVM_DEPENDENCY = "py-evm==0.3.0a7"
PYEVM_DEPENDENCY = "py-evm==0.3.0a8"


deps = {
Expand Down
47 changes: 33 additions & 14 deletions tests/json-fixtures-over-rpc/test_rpc_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from eth_utils import (
add_0x_prefix,
encode_hex,
is_address,
is_hex,
is_integer,
Expand All @@ -25,6 +26,9 @@
apply_formatter_if,
)

from eth.constants import (
EMPTY_UNCLE_HASH,
)
from eth.chains.mainnet import (
MainnetChain,
)
Expand Down Expand Up @@ -54,21 +58,20 @@
BASE_FIXTURE_PATH = os.path.join(ROOT_PROJECT_DIR, 'fixtures', 'BlockchainTests')

SLOW_TESTS = (
'bcExploitTest/SuicideIssue.json',
'Call1024PreCalls_d0g0v0',
'ContractCreationSpam_d0g0v0_Homestead',
'ContractCreationSpam_d0g0v0_Frontier',
'Create2Recursive_d0g0v0',
'Create2Recursive_d0g1v0',
'DelegateCallSpam',
'ForkStressTest',
'stQuadraticComplexityTest/Call50000_d0g1v0.json',
'stQuadraticComplexityTest/QuadraticComplexitySolidity_CallDataCopy_d0g1v0.json',
'stQuadraticComplexityTest/Return50000_2_d0g1v0.json',
'stQuadraticComplexityTest/Return50000_d0g1v0.json',
'stQuadraticComplexityTest/Callcode50000_d0g1v0.json',
'stQuadraticComplexityTest/Call50000_sha256_d0g1v0.json',
'stQuadraticComplexityTest/Call50000_ecrec_d0g1v0.json',
'walletReorganizeOwners',
'bcExploitTest/SuicideIssue.json',
'randomStatetest94_Homestead',
'randomStatetest94_Byzantium',
'randomStatetest94_Constantinople',
'randomStatetest94_ConstantinopleFix',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ☝️ four tests kept crashing CI (they work locally) and they were also put into the slow tests on the Py-EVM side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, veox said something about the tests having high RAM usage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cburgdorf That's correct. Those tests need more than 4gb of RAM(discovered here). And they were marked as slow in this commit.

'ShanghaiLove_Homestead',
'ShanghaiLove_Frontier',
'static_Call1024PreCalls_d1g0v0',
'static_Call1024PreCalls2_d0g0v0',
'static_Call1024PreCalls2_d1g0v0',
Expand All @@ -91,15 +94,20 @@
'static_LoopCallsThenRevert_d0g0v0',
'static_LoopCallsThenRevert_d0g1v0',
'static_Return50000_2_d0g0v0',
'stQuadraticComplexityTest/Call50000_d0g1v0.json',
'stQuadraticComplexityTest/QuadraticComplexitySolidity_CallDataCopy_d0g1v0.json',
'stQuadraticComplexityTest/Return50000_2_d0g1v0.json',
'stQuadraticComplexityTest/Return50000_d0g1v0.json',
'stQuadraticComplexityTest/Callcode50000_d0g1v0.json',
'stQuadraticComplexityTest/Call50000_sha256_d0g1v0.json',
'stQuadraticComplexityTest/Call50000_ecrec_d0g1v0.json',
'stQuadraticComplexityTest/Call50000_identity2_d0g1v0.json',
'stQuadraticComplexityTest/Call50000_identity_d0g1v0.json',
'stQuadraticComplexityTest/Call50000_rip160_d0g1v0.json',
'stQuadraticComplexityTest/Call50000bytesContract50_1_d0g1v0.json',
'stQuadraticComplexityTest/Call50000bytesContract50_2_d0g1v0.json',
'stQuadraticComplexityTest/Create1000_d0g1v0.json',
'ShanghaiLove_Homestead',
'ShanghaiLove_Frontier',
'DelegateCallSpam',
'walletReorganizeOwners',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't get confused, I just resorted this list alphabetically (in a separate commit), so there are really only four new tests in that list.

)

# These are tests that are thought to be incorrect or buggy upstream,
Expand Down Expand Up @@ -330,6 +338,10 @@ def is_by_hash(at_block):
raise ValueError("Unrecognized 'at_block' value: %r" % at_block)


def has_uncles(block_fixture):
return block_fixture['blockHeader']['uncleHash'] != encode_hex(EMPTY_UNCLE_HASH)


async def validate_transaction_count(rpc, block_fixture, at_block):
if is_by_hash(at_block):
rpc_method = 'eth_getBlockTransactionCountByHash'
Expand Down Expand Up @@ -398,11 +410,14 @@ async def validate_uncle_count(rpc, block_fixture, at_block):
else:
rpc_method = 'eth_getUncleCountByBlockNumber'

num_uncles = len(block_fixture['uncleHeaders'])
num_uncles = len(block_fixture['uncleHeaders']) if has_uncles(block_fixture) else 0
await assert_rpc_result(rpc, rpc_method, [at_block], hex(num_uncles))


async def validate_uncle_headers(rpc, block_fixture, at_block):
if not has_uncles(block_fixture):
return

if is_by_hash(at_block):
rpc_method = 'eth_getUncleByBlockHashAndIndex'
else:
Expand Down Expand Up @@ -466,6 +481,10 @@ async def test_rpc_against_fixtures(event_bus, chain_fixture, fixture_data):
if get_in(['blockHeader', 'hash'], block_fixture) == chain_fixture['lastblockhash']:
await validate_last_block(rpc, block_fixture)

await validate_accounts(rpc, chain_fixture['postState'])
# Fixtures do not include the `postState` field when its size would be past a certain limit.
# https://github.com/ethereum/tests/issues/637#issuecomment-534072897
if chain_fixture.get('postState', None):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carver I was a bit worried if we are losing any safety here but it seems that we are doing the same on the Py-EVM side and I think that we are still safe here because even if we do not validate the postState for these special cases we do validate the lastblockhash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ for the link to the convo. After reading it, I agree

await validate_accounts(rpc, chain_fixture['postState'])

await validate_accounts(rpc, chain_fixture['pre'], 'earliest')
await validate_accounts(rpc, chain_fixture['pre'], 0)
5 changes: 1 addition & 4 deletions trinity/_utils/eip1085.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,8 @@ def _filter_vm_config(vm_config: VMConfiguration) -> Iterable[VMFork]:
ByzantiumVM,
ConstantinopleVM,
PetersburgVM,
IstanbulVM,
)
ALL_VMS_BY_FORK = {
vm_class.fork: vm_class
for vm_class in ALL_VMS
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just dead code



@to_tuple
Expand Down
5 changes: 5 additions & 0 deletions trinity/assets/eip1085.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
"type": "string",
"pattern": "^0x([0-9a-fA-F])+$"
},
"istanbulForkBlock": {
"title": "Block number for the Istanbul fork",
"type": "string",
"pattern": "^0x([0-9a-fA-F])+$"
},
"chainId": {
"title": "The EIP155 chain ID",
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions trinity/assets/eip1085/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"EIP158ForkBlock":"0x28d138",
"byzantiumForkBlock":"0x42ae50",
"petersburgForkBlock":"0x6f1580",
"istanbulForkBlock": "0x8a61c8",
"chainId":"0x1",
"homesteadForkBlock":"0x118c30",
"miningMethod":"ethash"
Expand Down
4 changes: 2 additions & 2 deletions trinity/tools/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
)
from eth.constants import GENESIS_BLOCK_NUMBER
from eth.vm.forks.byzantium import ByzantiumVM
from eth.vm.forks.petersburg import PetersburgVM
from eth.vm.forks.istanbul import IstanbulVM

from trinity.chains.coro import AsyncChainMixin
from trinity.chains.full import FullChain
Expand All @@ -27,7 +27,7 @@ class LatestTestChain(FullChain):
A test chain that uses the most recent mainnet VM from block 0.
That means the VM will explicitly change when a new network upgrade is locked in.
"""
vm_configuration = ((GENESIS_BLOCK_NUMBER, PetersburgVM),)
vm_configuration = ((GENESIS_BLOCK_NUMBER, IstanbulVM),)
network_id = 999


Expand Down