diff --git a/setup.py b/setup.py index b2316ed95..c6a9ebaa9 100644 --- a/setup.py +++ b/setup.py @@ -279,7 +279,7 @@ def get_spec(file_name: Path, preset: Dict[str, str], config: Dict[str, str], pr elif name in config: config_vars[name] = VariableDefinition(value_def.type_name, config[name], value_def.comment, None) else: - if name == 'ENDIANNESS': + if name in ('ENDIANNESS', 'KZG_ENDIANNESS'): # Deal with mypy Literal typing check value_def = _parse_value(name, value, type_hint='Final') constant_vars[name] = value_def diff --git a/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py b/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py index 6d3f377a3..5ee8097c8 100644 --- a/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py +++ b/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py @@ -33,7 +33,7 @@ def bls_add_one(x): def field_element_bytes(x): - return int.to_bytes(x % BLS_MODULUS, 32, "little") + return int.to_bytes(x % BLS_MODULUS, 32, "big") @with_deneb_and_later @@ -304,7 +304,7 @@ def test_bytes_to_bls_field_modulus_minus_one(spec): Verify that `bytes_to_bls_field` handles modulus minus one """ - spec.bytes_to_bls_field((BLS_MODULUS - 1).to_bytes(spec.BYTES_PER_FIELD_ELEMENT, spec.ENDIANNESS)) + spec.bytes_to_bls_field((BLS_MODULUS - 1).to_bytes(spec.BYTES_PER_FIELD_ELEMENT, spec.KZG_ENDIANNESS)) @with_deneb_and_later @@ -316,7 +316,7 @@ def test_bytes_to_bls_field_modulus(spec): """ expect_assertion_error(lambda: spec.bytes_to_bls_field( - BLS_MODULUS.to_bytes(spec.BYTES_PER_FIELD_ELEMENT, spec.ENDIANNESS) + BLS_MODULUS.to_bytes(spec.BYTES_PER_FIELD_ELEMENT, spec.KZG_ENDIANNESS) )) diff --git a/tests/core/pyspec/eth2spec/test/helpers/sharding.py b/tests/core/pyspec/eth2spec/test/helpers/sharding.py index 6b913b90e..cd88ae3ea 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/sharding.py +++ b/tests/core/pyspec/eth2spec/test/helpers/sharding.py @@ -61,7 +61,7 @@ def get_sample_blob(spec, rng=None): b = bytes() for v in values: - b += v.to_bytes(32, spec.ENDIANNESS) + b += v.to_bytes(32, spec.KZG_ENDIANNESS) return spec.Blob(b) diff --git a/tests/generators/kzg_4844/main.py b/tests/generators/kzg_4844/main.py index 2f3efeb21..9297e524a 100644 --- a/tests/generators/kzg_4844/main.py +++ b/tests/generators/kzg_4844/main.py @@ -27,11 +27,11 @@ def expect_exception(func, *args): def field_element_bytes(x): - return int.to_bytes(x % spec.BLS_MODULUS, 32, spec.ENDIANNESS) + return int.to_bytes(x % spec.BLS_MODULUS, 32, spec.KZG_ENDIANNESS) def field_element_bytes_unchecked(x): - return int.to_bytes(x, 32, spec.ENDIANNESS) + return int.to_bytes(x, 32, spec.KZG_ENDIANNESS) def encode_hex_list(a): @@ -54,7 +54,7 @@ def evaluate_blob_at(blob, z): ) -BLS_MODULUS_BYTES = spec.BLS_MODULUS.to_bytes(32, spec.ENDIANNESS) +BLS_MODULUS_BYTES = spec.BLS_MODULUS.to_bytes(32, spec.KZG_ENDIANNESS) G1 = bls.G1_to_bytes48(bls.G1()) G1_INVALID_TOO_FEW_BYTES = G1[:-1]