Skip to content

Commit

Permalink
Merge branch 'master' into piper/remove-multi-trie-support
Browse files Browse the repository at this point in the history
  • Loading branch information
pipermerriam authored Apr 30, 2018
2 parents 457ac14 + 2edd73a commit 48d09d8
Show file tree
Hide file tree
Showing 30 changed files with 48 additions and 65 deletions.
5 changes: 2 additions & 3 deletions evm/consensus/pow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
from eth_typing import (
Hash32
)
from eth_utils import (
keccak,
)

from eth_hash.auto import keccak

from evm.utils.hexadecimal import (
encode_hex,
Expand Down
4 changes: 1 addition & 3 deletions evm/db/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
HexaryTrie,
)

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm.constants import (
BLANK_ROOT_HASH,
Expand Down
3 changes: 2 additions & 1 deletion evm/db/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
)

from eth_utils import (
keccak,
to_list,
to_tuple,
)

from eth_hash.auto import keccak

from evm.constants import (
GENESIS_PARENT_HASH,
)
Expand Down
4 changes: 1 addition & 3 deletions evm/db/hash_trie.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from eth_utils import (
keccak,
)
from eth_hash.auto import keccak


class HashTrie(object):
Expand Down
3 changes: 2 additions & 1 deletion evm/rlp/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
Hash32
)
from eth_utils import (
keccak,
to_dict,
)

from eth_hash.auto import keccak

from evm.constants import (
ZERO_ADDRESS,
ZERO_HASH32,
Expand Down
4 changes: 1 addition & 3 deletions evm/rlp/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
Address
)

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm.exceptions import (
ValidationError,
Expand Down
3 changes: 2 additions & 1 deletion evm/tools/fixture_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
decode_hex,
is_0x_prefixed,
to_bytes,
keccak,
to_canonical_address,
to_normalized_address,
to_tuple,
Expand All @@ -30,6 +29,8 @@
hexstr_if_str,
)

from eth_hash.auto import keccak

from evm import MainnetChain
from evm.constants import (
CREATE_CONTRACT_ADDRESS,
Expand Down
4 changes: 1 addition & 3 deletions evm/utils/address.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import rlp

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak


def force_bytes_to_address(value: bytes) -> bytes:
Expand Down
4 changes: 3 additions & 1 deletion evm/utils/blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from eth_utils import (
apply_to_return_value,
int_to_big_endian,
keccak,
)

from eth_hash.auto import keccak

from evm.utils.padding import (
zpad_right,
)
Expand Down
3 changes: 2 additions & 1 deletion evm/vm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
import rlp

from eth_utils import (
keccak,
to_tuple,
)

from eth_hash.auto import keccak

from evm.constants import (
GENESIS_PARENT_HASH,
MAX_PREV_HEADER_DEPTH,
Expand Down
4 changes: 1 addition & 3 deletions evm/vm/forks/frontier/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
BloomFilter,
)

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm.constants import (
EMPTY_UNCLE_HASH,
Expand Down
4 changes: 1 addition & 3 deletions evm/vm/forks/frontier/computation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm import constants
from evm import precompiles
Expand Down
4 changes: 1 addition & 3 deletions evm/vm/forks/frontier/state.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import absolute_import
from typing import Type # noqa: F401

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm import constants
from evm.constants import (
Expand Down
4 changes: 1 addition & 3 deletions evm/vm/forks/homestead/computation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm import constants
from evm.exceptions import (
Expand Down
4 changes: 1 addition & 3 deletions evm/vm/forks/spurious_dragon/computation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm import constants
from evm.exceptions import (
Expand Down
4 changes: 1 addition & 3 deletions evm/vm/logic/sha3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm import constants
from evm.utils.numeric import (
Expand Down
4 changes: 1 addition & 3 deletions p2p/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
keys,
)

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from p2p import ecies
from p2p import kademlia
Expand Down
3 changes: 2 additions & 1 deletion p2p/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import rlp
from eth_utils import (
encode_hex,
keccak,
text_if_str,
to_bytes,
to_list,
Expand All @@ -29,6 +28,8 @@
from eth_keys import keys
from eth_keys import datatypes

from eth_hash.auto import keccak

from p2p.cancel_token import CancelToken
from p2p import kademlia
from evm.utils.numeric import (
Expand Down
3 changes: 2 additions & 1 deletion p2p/kademlia.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
big_endian_to_int,
decode_hex,
encode_hex,
keccak,
)

from eth_keys import (
datatypes,
keys,
)

from eth_hash.auto import keccak

from p2p.cancel_token import CancelToken, wait_with_token

# Workaround for import cycles caused by type annotations:
Expand Down
3 changes: 2 additions & 1 deletion p2p/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
from eth_utils import (
decode_hex,
encode_hex,
keccak,
)

from eth_keys import (
datatypes,
keys,
)

from eth_hash.auto import keccak

from trie import HexaryTrie

from evm.constants import GENESIS_BLOCK_NUMBER
Expand Down
3 changes: 2 additions & 1 deletion p2p/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

from eth_utils import (
encode_hex,
keccak,
)

from eth_hash.auto import keccak

from evm.constants import (
BLANK_ROOT_HASH,
EMPTY_SHA3,
Expand Down
5 changes: 2 additions & 3 deletions tests/core/test_blob_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
zip_longest,
)

from eth_hash.auto import keccak

from evm.utils.blobs import (
calc_chunk_root,
calc_merkle_root,
Expand All @@ -17,9 +19,6 @@

from evm.utils.padding import zpad_left
from evm.utils.numeric import int_to_big_endian
from eth_utils import (
keccak,
)

from evm.constants import (
CHUNK_SIZE,
Expand Down
4 changes: 1 addition & 3 deletions tests/database/test_account_db.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm.exceptions import (
ValidationError,
Expand Down
4 changes: 1 addition & 3 deletions tests/database/test_chaindb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

import rlp

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm.constants import (
BLANK_ROOT_HASH,
Expand Down
4 changes: 1 addition & 3 deletions tests/fillers/build_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
get_test_name,
)

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm.utils.hexadecimal import (
encode_hex,
Expand Down
6 changes: 4 additions & 2 deletions tests/json-fixtures/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
)

from eth_utils import (
keccak,
to_bytes,
to_tuple,
)

from eth_hash.auto import keccak

from evm.db.chain import ChainDB
from evm.exceptions import (
ValidationError,
Expand Down Expand Up @@ -176,7 +178,7 @@ def get_block_hash_for_testing(self, block_number):
elif block_number < self.block_number - 256:
return b''
else:
return keccak(text="{0}".format(block_number))
return keccak(to_bytes(text="{0}".format(block_number)))


def get_prev_hashes_testing(self, last_block_hash, db):
Expand Down
3 changes: 2 additions & 1 deletion tests/json-fixtures/test_virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from evm.db.chain import ChainDB

from eth_utils import (
keccak,
to_bytes,
)

from eth_hash.auto import keccak

from evm.exceptions import (
VMError,
)
Expand Down
4 changes: 1 addition & 3 deletions tests/p2p/peer_helpers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import asyncio
import os

from eth_utils import (
keccak,
)
from eth_hash.auto import keccak

from evm.chains.mainnet import MAINNET_GENESIS_HEADER
from evm.db.backends.memory import MemoryDB
Expand Down
3 changes: 2 additions & 1 deletion tests/p2p/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

from eth_utils import (
decode_hex,
keccak,
to_bytes,
)

from eth_hash.auto import keccak

from eth_keys import keys

from p2p import discovery
Expand Down
3 changes: 2 additions & 1 deletion tests/p2p/test_lightchain_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from eth_utils import (
decode_hex,
encode_hex,
keccak,
)

from eth_hash.auto import keccak

from evm.chains.ropsten import ROPSTEN_NETWORK_ID, ROPSTEN_GENESIS_HEADER
from evm.chains.mainnet import MAINNET_VM_CONFIGURATION
from evm.db.backends.memory import MemoryDB
Expand Down

0 comments on commit 48d09d8

Please sign in to comment.