Fix tests
This commit is contained in:
parent
5b983f4097
commit
eea04704d4
2
setup.py
2
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
|
||||
|
|
|
@ -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)
|
||||
))
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue