Skip to content

Commit

Permalink
Merge pull request #1194 from glaksmono/eth-py-evm-1125
Browse files Browse the repository at this point in the history
Unify `ValidationError`
  • Loading branch information
pipermerriam authored Aug 20, 2018
2 parents fb73938 + d18b78e commit 931e915
Show file tree
Hide file tree
Showing 61 changed files with 163 additions and 160 deletions.
2 changes: 1 addition & 1 deletion eth/chains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from eth_utils import (
to_tuple,
to_set,
ValidationError,
)

from eth.db.backends.base import BaseDB
Expand All @@ -56,7 +57,6 @@
from eth.exceptions import (
HeaderNotFound,
TransactionNotFound,
ValidationError,
VMNotFound,
)
from eth.utils.spoof import (
Expand Down
2 changes: 1 addition & 1 deletion eth/chains/mainnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from eth_utils import (
decode_hex,
encode_hex,
ValidationError,
)

from .constants import (
Expand All @@ -17,7 +18,6 @@
from eth.chains.base import (
Chain,
)
from eth.exceptions import ValidationError
from eth.rlp.headers import BlockHeader
from eth.vm.base import BaseVM # noqa: F401
from eth.vm.forks import (
Expand Down
9 changes: 3 additions & 6 deletions eth/chains/shard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
from eth_typing import (
Hash32,
)

from eth_utils import (
ValidationError,
)
from eth.db.shard import (
Availability,
ShardDB,
)

from eth.exceptions import (
ValidationError,
)

from eth.rlp.headers import (
CollationHeader,
)
Expand Down
2 changes: 1 addition & 1 deletion eth/chains/tester/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

from eth_utils import (
to_tuple,
ValidationError,
)

from eth.chains.base import Chain
from eth.chains.mainnet import MainnetChain
from eth.exceptions import ValidationError
from eth.rlp.headers import (
BlockHeader
)
Expand Down
6 changes: 3 additions & 3 deletions eth/consensus/pow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
from eth_typing import (
Hash32
)
from eth_utils import (
ValidationError,
)

from eth_hash.auto import keccak

from eth.utils.hexadecimal import (
encode_hex,
)
from eth.exceptions import (
ValidationError,
)
from eth.utils.numeric import (
big_endian_to_int,
)
Expand Down
2 changes: 1 addition & 1 deletion eth/db/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from eth_utils import (
to_list,
to_tuple,
ValidationError,
)

from eth_hash.auto import keccak
Expand All @@ -40,7 +41,6 @@
HeaderNotFound,
ParentNotFound,
TransactionNotFound,
ValidationError,
)
from eth.db.header import BaseHeaderDB, HeaderDB
from eth.db.backends.base import (
Expand Down
4 changes: 3 additions & 1 deletion eth/db/journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
merge,
last,
)
from eth_utils import (
ValidationError,
)

from eth.db.backends.base import BaseDB
from eth.exceptions import ValidationError


class DeletedEntry:
Expand Down
7 changes: 0 additions & 7 deletions eth/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ class CanonicalCollationNotFound(PyEVMError):
pass


class ValidationError(PyEVMError):
"""
Raised when something does not pass a validation check.
"""
pass


class Halt(PyEVMError):
"""
Raised when an opcode function halts vm execution.
Expand Down
6 changes: 5 additions & 1 deletion eth/precompiles/ecadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
optimized_bn128 as bn128,
)

from eth_utils import (
ValidationError,
)

from eth import constants

from eth.exceptions import (
ValidationError,
VMError,
)
from eth.utils.bn128 import (
Expand Down
6 changes: 5 additions & 1 deletion eth/precompiles/ecmul.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
optimized_bn128 as bn128,
)

from eth_utils import (
ValidationError,
)

from eth import constants

from eth.exceptions import (
ValidationError,
VMError,
)
from eth.utils.bn128 import (
Expand Down
6 changes: 5 additions & 1 deletion eth/precompiles/ecpairing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
optimized_bn128 as bn128,
)

from eth_utils import (
ValidationError,
)

from eth import constants

from eth.exceptions import (
ValidationError,
VMError,
)
from eth.utils.bn128 import (
Expand Down
6 changes: 4 additions & 2 deletions eth/precompiles/ecrecover.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
BadSignature,
)

from eth import constants
from eth.exceptions import (
from eth_utils import (
ValidationError,
)

from eth import constants

from eth.validation import (
validate_lt_secpk1n,
validate_gte,
Expand Down
4 changes: 1 addition & 3 deletions eth/rlp/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
)
from eth_utils import (
to_dict,
ValidationError,
)

from eth_hash.auto import keccak
Expand All @@ -37,9 +38,6 @@
GENESIS_PARENT_HASH,
BLANK_ROOT_HASH,
)
from eth.exceptions import (
ValidationError,
)

from eth.utils.hexadecimal import (
encode_hex,
Expand Down
5 changes: 3 additions & 2 deletions eth/rlp/receipts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
CountableList,
binary,
)
from eth_utils import (
ValidationError,
)

from eth_bloom import BloomFilter

from eth.exceptions import ValidationError

from .sedes import (
int256,
int32,
Expand Down
2 changes: 1 addition & 1 deletion eth/rlp/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from eth_hash.auto import keccak

from eth.exceptions import (
from eth_utils import (
ValidationError,
)

Expand Down
4 changes: 2 additions & 2 deletions eth/tools/test_builder/builder_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
Mapping,
)

from eth.db.backends.memory import MemoryDB

from cytoolz import (
first,
merge_with,
Expand All @@ -18,6 +16,8 @@
int_to_big_endian,
)

from eth.db.backends.memory import MemoryDB

from eth.utils.db import (
apply_state_dict,
)
Expand Down
15 changes: 7 additions & 8 deletions eth/tools/test_builder/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
Dict,
List,
)

from eth.db.account import (
AccountDB,
)
from eth.tools.fixture_tests import (
hash_log_entries,
)

from cytoolz import (
assoc,
assoc_in,
Expand All @@ -31,6 +23,13 @@
to_canonical_address,
)

from eth.db.account import (
AccountDB,
)
from eth.tools.fixture_tests import (
hash_log_entries,
)

from .normalization import (
normalize_bytes,
normalize_call_creates,
Expand Down
5 changes: 1 addition & 4 deletions eth/utils/blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from eth_utils import (
apply_to_return_value,
int_to_big_endian,
ValidationError,
)

from eth.utils.padding import (
Expand All @@ -26,10 +27,6 @@
MAX_BLOB_SIZE,
)

from eth.exceptions import (
ValidationError,
)

from typing import (
cast,
)
Expand Down
2 changes: 1 addition & 1 deletion eth/utils/bn128.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
optimized_bn128 as bn128,
)

from eth.exceptions import (
from eth_utils import (
ValidationError,
)

Expand Down
3 changes: 1 addition & 2 deletions eth/utils/merkle.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
from eth_typing import (
Hash32,
)

from eth.exceptions import (
from eth_utils import (
ValidationError,
)

Expand Down
3 changes: 1 addition & 2 deletions eth/utils/rlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

from eth_utils import (
to_tuple,
ValidationError,
)

from eth.exceptions import ValidationError


@to_tuple
def diff_rlp_object(left, right):
Expand Down
2 changes: 1 addition & 1 deletion eth/utils/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
BadSignature,
)

from eth.exceptions import (
from eth_utils import (
ValidationError,
)
from eth.utils.numeric import (
Expand Down
7 changes: 4 additions & 3 deletions eth/validation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import functools

from eth_utils import (
ValidationError,
)

from cytoolz.dicttoolz import (
valfilter,
)
Expand All @@ -19,9 +23,6 @@
SECPK1_N,
UINT_256_MAX,
)
from eth.exceptions import (
ValidationError,
)


def validate_is_bytes(value, title="Value"):
Expand Down
2 changes: 1 addition & 1 deletion eth/vm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from eth_utils import (
to_tuple,
ValidationError,
)

from eth_hash.auto import keccak
Expand All @@ -34,7 +35,6 @@
from eth.db.chain import BaseChainDB # noqa: F401
from eth.exceptions import (
HeaderNotFound,
ValidationError,
)
from eth.rlp.blocks import ( # noqa: F401
BaseBlock,
Expand Down
2 changes: 1 addition & 1 deletion eth/vm/forks/frontier/validation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from eth.exceptions import (
from eth_utils import (
ValidationError,
)

Expand Down
7 changes: 4 additions & 3 deletions eth/vm/forks/homestead/validation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from eth_utils import (
ValidationError,
)

from eth.constants import (
SECPK1_N,
)
from eth.exceptions import (
ValidationError,
)

from eth.vm.forks.frontier.validation import (
validate_frontier_transaction,
Expand Down
1 change: 1 addition & 0 deletions eth/vm/forks/spurious_dragon/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from eth_utils import to_set

from eth import constants

from eth.utils.address import (
force_bytes_to_address,
)
Expand Down
Loading

0 comments on commit 931e915

Please sign in to comment.