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 authored and cburgdorf committed Nov 13, 2018
1 parent e427ac2 commit ae1e3e4
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 102 deletions.
6 changes: 3 additions & 3 deletions eth/beacon/types/active_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
from eth_typing import (
Hash32,
)
from eth_utils import (
encode_hex,
)

from eth.rlp.sedes import (
hash32
)
from eth.utils.hexadecimal import (
encode_hex,
)
from eth.utils.blake import (
blake,
)
Expand Down
6 changes: 3 additions & 3 deletions eth/beacon/types/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from eth_typing import (
Hash32,
)
from eth_utils import (
encode_hex,
)
import rlp
from rlp.sedes import (
CountableList,
Expand All @@ -19,9 +22,6 @@
int64,
hash32,
)
from eth.utils.hexadecimal import (
encode_hex,
)

from .attestation_records import AttestationRecord

Expand Down
6 changes: 3 additions & 3 deletions eth/beacon/types/crystallized_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from eth_typing import (
Hash32,
)
from eth_utils import (
encode_hex,
)

import rlp
from rlp.sedes import (
Expand All @@ -16,9 +19,6 @@
int64,
hash32,
)
from eth.utils.hexadecimal import (
encode_hex,
)
from eth.utils.blake import (
blake,
)
Expand Down
6 changes: 3 additions & 3 deletions eth/chains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
BlockNumber,
Hash32,
)
from eth_utils import (
encode_hex,
)

from eth.db.backends.base import BaseAtomicDB
from eth.db.chain import (
Expand Down Expand Up @@ -82,9 +85,6 @@
from eth.utils.headers import (
compute_gas_limit_bounds,
)
from eth.utils.hexadecimal import (
encode_hex,
)
from eth.utils.rlp import (
validate_imported_block_unchanged,
)
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
10 changes: 4 additions & 6 deletions eth/db/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
BlockNumber,
Hash32
)
from eth_utils import (
encode_hex,
)

from eth_hash.auto import keccak

Expand All @@ -39,9 +42,6 @@
from eth.rlp.receipts import (
Receipt
)
from eth.utils.hexadecimal import (
encode_hex,
)
from eth.validation import (
validate_word,
)
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
16 changes: 6 additions & 10 deletions eth/estimators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
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.

7 changes: 3 additions & 4 deletions eth/vm/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
Callable,
cast,
Dict,
Iterator,
List,
Tuple,
Union,
Expand All @@ -18,6 +17,9 @@
from eth_typing import (
Address,
)
from eth_utils import (
encode_hex,
)

from eth.constants import (
GAS_MEMORY,
Expand All @@ -33,9 +35,6 @@
from eth.utils.datatypes import (
Configurable,
)
from eth.utils.hexadecimal import (
encode_hex,
)
from eth.utils.numeric import (
ceil32,
)
Expand Down
8 changes: 4 additions & 4 deletions eth/vm/forks/constantinople/storage.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from eth_utils import (
encode_hex,
)

from eth.constants import (
UINT256
)
Expand All @@ -7,10 +11,6 @@
constants
)

from eth.utils.hexadecimal import (
encode_hex,
)


def sstore_eip1283(computation: BaseComputation) -> None:
slot, value = computation.stack_pop(num_items=2, type_hint=UINT256)
Expand Down
6 changes: 3 additions & 3 deletions eth/vm/forks/frontier/computation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from eth import precompiles

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

from eth.constants import (
GAS_CODEDEPOSIT,
Expand All @@ -16,9 +19,6 @@
from eth.utils.address import (
force_bytes_to_address,
)
from eth.utils.hexadecimal import (
encode_hex,
)

from eth.vm.computation import (
BaseComputation,
Expand Down
6 changes: 3 additions & 3 deletions eth/vm/forks/frontier/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from typing import Type # noqa: F401

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

from eth.constants import CREATE_CONTRACT_ADDRESS
from eth.db.account import (
Expand All @@ -18,9 +21,6 @@
from eth.utils.address import (
generate_contract_address,
)
from eth.utils.hexadecimal import (
encode_hex,
)

from eth.vm.computation import (
BaseComputation,
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
6 changes: 3 additions & 3 deletions eth/vm/forks/spurious_dragon/computation.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from eth_hash.auto import keccak
from eth_utils import (
encode_hex,
)

from eth import constants
from eth.exceptions import (
OutOfGas,
)
from eth.utils.hexadecimal import (
encode_hex,
)
from eth.vm.computation import BaseComputation
from eth.vm.forks.homestead.computation import (
HomesteadComputation,
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
5 changes: 2 additions & 3 deletions eth/vm/logic/storage.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from eth import constants

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

from eth.vm.computation import BaseComputation

Expand Down
7 changes: 3 additions & 4 deletions eth/vm/logic/system.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from eth_typing import (
Address,
)

from eth_utils import (
encode_hex,
)
from eth import constants
from eth.exceptions import (
Halt,
Expand All @@ -14,9 +16,6 @@
generate_contract_address,
generate_safe_contract_address,
)
from eth.utils.hexadecimal import (
encode_hex,
)
from eth.utils.numeric import (
ceil32,
)
Expand Down
4 changes: 2 additions & 2 deletions scripts/benchmark/utils/format.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from eth.rlp.blocks import BaseBlock
from eth.utils.hexadecimal import (
from eth_utils import (
encode_hex,
)
from eth.rlp.blocks import BaseBlock


def format_block(block: BaseBlock) -> str:
Expand Down
Loading

0 comments on commit ae1e3e4

Please sign in to comment.