Skip to content
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ profile = "black"
line_length = 100
combine_as_imports = true
known_first_party = ["eth2spec"]
order_by_type = false
skip_glob = [
"tests/core/pyspec/eth2spec/*/mainnet.py",
"tests/core/pyspec/eth2spec/*/minimal.py",
Expand Down
4 changes: 2 additions & 2 deletions tests/core/pyspec/eth2spec/debug/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from eth2spec.utils.ssz.ssz_impl import hash_tree_root
from eth2spec.utils.ssz.ssz_typing import (
boolean,
ByteList,
ByteVector,
Container,
List,
uint,
Union,
Vector,
View,
boolean,
uint,
)


Expand Down
4 changes: 2 additions & 2 deletions tests/core/pyspec/eth2spec/debug/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from eth2spec.utils.ssz.ssz_typing import (
Bitlist,
Bitvector,
boolean,
Container,
List,
uint,
Union,
Vector,
boolean,
uint,
)


Expand Down
4 changes: 2 additions & 2 deletions tests/core/pyspec/eth2spec/debug/random_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
BasicView,
Bitlist,
Bitvector,
boolean,
ByteList,
ByteVector,
Container,
List,
uint,
Union,
Vector,
View,
boolean,
uint,
)

# in bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
MINIMAL,
)
from eth2spec.test.helpers.light_client_data_collection import (
BlockID,
add_new_block,
BlockID,
finish_lc_data_collection_test,
get_lc_bootstrap_block_id,
get_lc_update_attested_block_id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from eth2spec.test.context import (
ForkMeta,
always_bls,
ForkMeta,
with_fork_metas,
with_presets,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
on_tick_and_append_step,
)
from eth2spec.test.helpers.optimistic_sync import (
add_optimistic_block,
get_optimistic_store,
MegaStore,
PayloadStatusV1,
PayloadStatusV1Status,
add_optimistic_block,
get_optimistic_store,
)
from eth2spec.test.helpers.state import (
next_epoch,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import random

from eth2spec.debug.random_value import (
RandomizationMode,
get_random_ssz_object,
RandomizationMode,
)
from eth2spec.test.context import (
spec_state_test,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from eth2spec.test.context import (
ForkMeta,
always_bls,
ForkMeta,
with_fork_metas,
)
from eth2spec.test.helpers.attestations import (
Expand All @@ -14,8 +14,8 @@
DENEB,
)
from eth2spec.test.helpers.fork_transition import (
OperationType,
do_fork,
OperationType,
run_transition_with_operation,
transition_until_fork,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from eth2spec.test.context import (
ForkMeta,
always_bls,
ForkMeta,
with_fork_metas,
with_presets,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import random

from eth2spec.debug.random_value import (
RandomizationMode,
get_random_ssz_object,
RandomizationMode,
)
from eth2spec.test.context import (
spec_state_test,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import random

from eth2spec.debug.random_value import (
RandomizationMode,
get_random_ssz_object,
RandomizationMode,
)
from eth2spec.test.context import (
single_phase,
Expand Down
4 changes: 2 additions & 2 deletions tests/core/pyspec/eth2spec/test/helpers/blob.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random

from rlp import Serializable, encode
from rlp.sedes import Binary, CountableList, List as RLPList, big_endian_int, binary
from rlp import encode, Serializable
from rlp.sedes import big_endian_int, Binary, binary, CountableList, List as RLPList

from eth2spec.test.helpers.forks import (
is_post_electra,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from eth_hash.auto import keccak
from rlp import encode
from rlp.sedes import Binary, List, big_endian_int
from rlp.sedes import big_endian_int, Binary, List
from trie import HexaryTrie

from eth2spec.debug.random_value import get_random_bytes_list
Expand Down
2 changes: 1 addition & 1 deletion tests/core/pyspec/eth2spec/test/helpers/fork_transition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from enum import Enum, auto
from enum import auto, Enum

from eth2spec.test.helpers.attestations import (
next_slots_with_attestations,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from random import Random

from eth2spec.test.context import (
PHASE0,
low_single_balance,
misc_balances,
PHASE0,
single_phase,
spec_state_test,
spec_test,
Expand Down
12 changes: 6 additions & 6 deletions tests/core/pyspec/eth2spec/utils/bls.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import milagro_bls_binding as milagro_bls # noqa: F401 for BLS switching option
import py_arkworks_bls12381 as arkworks_bls # noqa: F401 for BLS switching option
from py_arkworks_bls12381 import (
GT as arkworks_GT,
G1Point as arkworks_G1,
G2Point as arkworks_G2,
GT as arkworks_GT,
Scalar as arkworks_Scalar,
)
from py_ecc.bls import G2ProofOfPossession as py_ecc_bls
from py_ecc.bls.g2_primitives import ( # noqa: F401
curve_order as BLS_MODULUS,
G1_to_pubkey as py_ecc_G1_to_bytes48,
G2_to_signature as py_ecc_G2_to_bytes96,
curve_order as BLS_MODULUS,
pubkey_to_G1 as py_ecc_bytes48_to_G1,
signature_to_G2 as _signature_to_G2,
signature_to_G2 as py_ecc_bytes96_to_G2,
)
from py_ecc.optimized_bls12_381 import ( # noqa: F401
add as py_ecc_add,
final_exponentiate as py_ecc_final_exponentiate,
FQ,
FQ2,
FQ12 as py_ecc_GT,
G1 as py_ecc_G1,
G2 as py_ecc_G2,
Z1 as py_ecc_Z1,
Z2 as py_ecc_Z2,
add as py_ecc_add,
final_exponentiate as py_ecc_final_exponentiate,
multiply as py_ecc_mul,
neg as py_ecc_neg,
pairing as py_ecc_pairing,
Z1 as py_ecc_Z1,
Z2 as py_ecc_Z2,
)
from py_ecc.utils import prime_field_inv as py_ecc_prime_field_inv

Expand Down
4 changes: 2 additions & 2 deletions tests/generators/runners/kzg_4844.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
BLOB_ALL_TWOS,
BLOB_ALL_ZEROS,
BLOB_RANDOM_VALID1,
bls_add_one,
encode_hex_list,
G1,
INVALID_BLOBS,
INVALID_FIELD_ELEMENTS,
INVALID_G1_POINTS,
VALID_BLOBS,
VALID_FIELD_ELEMENTS,
bls_add_one,
encode_hex_list,
)

###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions tests/generators/runners/kzg_7594.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
from eth2spec.gen_helpers.gen_base.gen_typing import TestCase
from eth2spec.test.helpers.constants import FULU
from eth2spec.test.utils.kzg_tests import (
bls_add_one,
CELL_RANDOM_VALID1,
CELL_RANDOM_VALID2,
encode_hex_list,
INVALID_BLOBS,
INVALID_G1_POINTS,
INVALID_INDIVIDUAL_CELL_BYTES,
VALID_BLOBS,
bls_add_one,
encode_hex_list,
)

###############################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from random import Random
from typing import Dict, Type

from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object
from eth2spec.debug.random_value import get_random_ssz_object, RandomizationMode
from eth2spec.utils.ssz.ssz_impl import serialize
from eth2spec.utils.ssz.ssz_typing import (
BasicView,
Vector,
boolean,
uint8,
uint16,
uint32,
uint64,
uint128,
uint256,
Vector,
)

from .ssz_test_case import invalid_test_case, valid_test_case
Expand Down
2 changes: 1 addition & 1 deletion tests/generators/runners/ssz_generic_cases/ssz_bitlist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from random import Random

from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object
from eth2spec.debug.random_value import get_random_ssz_object, RandomizationMode
from eth2spec.utils.ssz.ssz_impl import serialize
from eth2spec.utils.ssz.ssz_typing import Bitlist

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from random import Random

from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object
from eth2spec.debug.random_value import get_random_ssz_object, RandomizationMode
from eth2spec.utils.ssz.ssz_impl import serialize
from eth2spec.utils.ssz.ssz_typing import Bitvector

Expand Down
8 changes: 4 additions & 4 deletions tests/generators/runners/ssz_generic_cases/ssz_container.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
from random import Random
from typing import Callable, Dict, Sequence, Tuple, Type

from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object
from eth2spec.debug.random_value import get_random_ssz_object, RandomizationMode
from eth2spec.utils.ssz.ssz_impl import serialize
from eth2spec.utils.ssz.ssz_typing import (
Bitlist,
Bitvector,
byte,
ByteList,
Container,
List,
Vector,
View,
byte,
uint8,
uint16,
uint32,
uint64,
Vector,
View,
)

from .ssz_test_case import invalid_test_case, valid_test_case
Expand Down
2 changes: 1 addition & 1 deletion tests/generators/runners/ssz_generic_cases/ssz_uints.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from random import Random
from typing import Type

from eth2spec.debug.random_value import RandomizationMode, get_random_ssz_object
from eth2spec.debug.random_value import get_random_ssz_object, RandomizationMode
from eth2spec.utils.ssz.ssz_typing import BasicView, uint8, uint16, uint32, uint64, uint128, uint256

from .ssz_test_case import invalid_test_case, valid_test_case
Expand Down