mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-20 23:49:54 +00:00
update tests
This commit is contained in:
parent
6c8955d4bc
commit
c9e1291860
@ -18,11 +18,11 @@ def test_compute_extended_matrix(spec):
|
|||||||
blob_count = 2
|
blob_count = 2
|
||||||
input_blobs = [get_sample_blob(spec, rng=rng) for _ in range(blob_count)]
|
input_blobs = [get_sample_blob(spec, rng=rng) for _ in range(blob_count)]
|
||||||
extended_matrix = spec.compute_extended_matrix(input_blobs)
|
extended_matrix = spec.compute_extended_matrix(input_blobs)
|
||||||
assert len(extended_matrix) == spec.CELLS_PER_BLOB * blob_count
|
assert len(extended_matrix) == spec.CELLS_PER_EXT_BLOB * blob_count
|
||||||
|
|
||||||
rows = [extended_matrix[i:(i + spec.CELLS_PER_BLOB)] for i in range(0, len(extended_matrix), spec.CELLS_PER_BLOB)]
|
rows = [extended_matrix[i:(i + spec.CELLS_PER_EXT_BLOB)] for i in range(0, len(extended_matrix), spec.CELLS_PER_EXT_BLOB)]
|
||||||
assert len(rows) == blob_count
|
assert len(rows) == blob_count
|
||||||
assert len(rows[0]) == spec.CELLS_PER_BLOB
|
assert len(rows[0]) == spec.CELLS_PER_EXT_BLOB
|
||||||
|
|
||||||
for blob_index, row in enumerate(rows):
|
for blob_index, row in enumerate(rows):
|
||||||
extended_blob = []
|
extended_blob = []
|
||||||
@ -40,7 +40,7 @@ def test_recover_matrix(spec):
|
|||||||
rng = random.Random(5566)
|
rng = random.Random(5566)
|
||||||
|
|
||||||
# Number of samples we will be recovering from
|
# Number of samples we will be recovering from
|
||||||
N_SAMPLES = spec.CELLS_PER_BLOB // 2
|
N_SAMPLES = spec.CELLS_PER_EXT_BLOB // 2
|
||||||
|
|
||||||
blob_count = 2
|
blob_count = 2
|
||||||
cells_dict = {}
|
cells_dict = {}
|
||||||
@ -54,9 +54,9 @@ def test_recover_matrix(spec):
|
|||||||
cell_ids = []
|
cell_ids = []
|
||||||
# First figure out just the indices of the cells
|
# First figure out just the indices of the cells
|
||||||
for _ in range(N_SAMPLES):
|
for _ in range(N_SAMPLES):
|
||||||
cell_id = rng.randint(0, spec.CELLS_PER_BLOB - 1)
|
cell_id = rng.randint(0, spec.CELLS_PER_EXT_BLOB - 1)
|
||||||
while cell_id in cell_ids:
|
while cell_id in cell_ids:
|
||||||
cell_id = rng.randint(0, spec.CELLS_PER_BLOB - 1)
|
cell_id = rng.randint(0, spec.CELLS_PER_EXT_BLOB - 1)
|
||||||
cell_ids.append(cell_id)
|
cell_ids.append(cell_id)
|
||||||
cell = cells[cell_id]
|
cell = cells[cell_id]
|
||||||
cells_dict[(blob_index, cell_id)] = cell
|
cells_dict[(blob_index, cell_id)] = cell
|
||||||
|
@ -71,7 +71,7 @@ def test_recover_polynomial(spec):
|
|||||||
rng = random.Random(5566)
|
rng = random.Random(5566)
|
||||||
|
|
||||||
# Number of samples we will be recovering from
|
# Number of samples we will be recovering from
|
||||||
N_SAMPLES = spec.CELLS_PER_BLOB // 2
|
N_SAMPLES = spec.CELLS_PER_EXT_BLOB // 2
|
||||||
|
|
||||||
# Get the data we will be working with
|
# Get the data we will be working with
|
||||||
blob = get_sample_blob(spec)
|
blob = get_sample_blob(spec)
|
||||||
@ -86,9 +86,9 @@ def test_recover_polynomial(spec):
|
|||||||
cell_ids = []
|
cell_ids = []
|
||||||
# First figure out just the indices of the cells
|
# First figure out just the indices of the cells
|
||||||
for i in range(N_SAMPLES):
|
for i in range(N_SAMPLES):
|
||||||
j = rng.randint(0, spec.CELLS_PER_BLOB - 1)
|
j = rng.randint(0, spec.CELLS_PER_EXT_BLOB - 1)
|
||||||
while j in cell_ids:
|
while j in cell_ids:
|
||||||
j = rng.randint(0, spec.CELLS_PER_BLOB - 1)
|
j = rng.randint(0, spec.CELLS_PER_EXT_BLOB - 1)
|
||||||
cell_ids.append(j)
|
cell_ids.append(j)
|
||||||
# Now the cells themselves
|
# Now the cells themselves
|
||||||
known_cells_bytes = [cells_bytes[cell_id] for cell_id in cell_ids]
|
known_cells_bytes = [cells_bytes[cell_id] for cell_id in cell_ids]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user