Skip to content

Commit

Permalink
Migrated encode and decode hex
Browse files Browse the repository at this point in the history
  • Loading branch information
aashutoshrathi committed Nov 12, 2018
1 parent 7d0f188 commit 70768a2
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 66 deletions.
2 changes: 1 addition & 1 deletion eth/beacon/types/active_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from eth.rlp.sedes import (
hash32
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.utils.blake import (
Expand Down
2 changes: 1 addition & 1 deletion eth/beacon/types/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
int64,
hash32,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion eth/beacon/types/crystallized_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
int64,
hash32,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.utils.blake import (
Expand Down
2 changes: 1 addition & 1 deletion eth/chains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
from eth.utils.headers import (
compute_gas_limit_bounds,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.utils.rlp import (
Expand Down
16 changes: 8 additions & 8 deletions eth/consensus/pow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
Tuple
)

from pyethash import (
EPOCH_LENGTH,
hashimoto_light,
mkcache_bytes,
)

from eth_typing import (
Hash32
)

from eth_utils import (
big_endian_to_int,
ValidationError,
encode_hex,
)

from eth_hash.auto import keccak

from eth.utils.hexadecimal import (
encode_hex,
from pyethash import (
EPOCH_LENGTH,
hashimoto_light,
mkcache_bytes,
)


from eth.validation import (
validate_length,
validate_lte,
Expand Down
14 changes: 6 additions & 8 deletions eth/db/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import os
from typing import (
Any,
cast,
Type
Type,
cast
)

from eth.utils.module_loading import (
import_string,
)
from eth.db.backends.base import (
BaseAtomicDB,
)
from eth_utils import import_string

from eth.db.backends.base import BaseAtomicDB


DEFAULT_DB_BACKEND = 'eth.db.atomic.AtomicDB'

Expand Down
6 changes: 2 additions & 4 deletions eth/db/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from eth.rlp.receipts import (
Receipt
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.validation import (
Expand All @@ -59,9 +59,7 @@

if TYPE_CHECKING:
from eth.rlp.blocks import ( # noqa: F401
BaseBlock
)
from eth.rlp.transactions import ( # noqa: F401
BaseBlock,
BaseTransaction
)

Expand Down
15 changes: 5 additions & 10 deletions eth/estimators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import os
from typing import (
Callable,
cast,
cast
)

from eth.rlp.transactions import (
BaseTransaction,
)
from eth.utils.module_loading import (
import_string,
)
from eth.vm.state import (
BaseState,
)

from eth_utils import import_string
from eth.rlp.transactions import BaseTransaction
from eth.vm.state import BaseState


def get_gas_estimator() -> Callable[[BaseState, BaseTransaction], int]:
Expand Down
12 changes: 6 additions & 6 deletions eth/rlp/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

from eth_hash.auto import keccak

from eth_utils import (
encode_hex,
)

from eth.constants import (
ZERO_ADDRESS,
ZERO_HASH32,
Expand All @@ -29,8 +33,8 @@
BLANK_ROOT_HASH,
)

from eth.utils.hexadecimal import (
encode_hex,
from eth.vm.execution_context import (
ExecutionContext,
)

from .sedes import (
Expand All @@ -40,10 +44,6 @@
trie_root,
)

from eth.vm.execution_context import (
ExecutionContext,
)


class MiningHeader(rlp.Serializable):
fields = [
Expand Down
12 changes: 0 additions & 12 deletions eth/utils/hexadecimal.py

This file was deleted.

4 changes: 2 additions & 2 deletions eth/vm/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from eth.utils.datatypes import (
Configurable,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.utils.numeric import (
Expand Down Expand Up @@ -292,7 +292,7 @@ def refund_gas(self, amount: int) -> None:
"""
return self._gas_meter.refund_gas(amount)

def stack_pop(self, num_items: int=1, type_hint: str=None) -> Any:
def stack_pop(self, num_items: int = 1, type_hint: str = None) -> Any:
# TODO: Needs to be replaced with
# `Union[int, bytes, Tuple[Union[int, bytes], ...]]` if done properly
"""
Expand Down
2 changes: 1 addition & 1 deletion eth/vm/forks/constantinople/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
constants
)

from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion eth/vm/forks/frontier/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from eth.utils.address import (
force_bytes_to_address,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion eth/vm/forks/frontier/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from eth.utils.address import (
generate_contract_address,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion eth/vm/forks/homestead/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from eth.exceptions import (
OutOfGas,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.vm.computation import BaseComputation
Expand Down
2 changes: 1 addition & 1 deletion eth/vm/forks/spurious_dragon/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from eth.exceptions import (
OutOfGas,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.vm.computation import BaseComputation
Expand Down
2 changes: 1 addition & 1 deletion eth/vm/forks/spurious_dragon/state.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from eth.rlp.transactions import BaseTransaction

from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion eth/vm/logic/storage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from eth import constants

from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion eth/vm/logic/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
generate_contract_address,
generate_safe_contract_address,
)
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.utils.numeric import (
Expand Down
2 changes: 1 addition & 1 deletion scripts/benchmark/utils/format.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from eth.rlp.blocks import BaseBlock
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/hexadecimal-utils/test_encode_and_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
strategies as st,
)

from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
decode_hex,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/core/vm/test_modexp_precompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
_modexp,
_compute_modexp_gas_fee,
)
from eth.utils.hexadecimal import (
from eth_utils import (
decode_hex,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/fillers/build_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
filler_formatter,
)

from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)

Expand Down

0 comments on commit 70768a2

Please sign in to comment.