You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
f"Expected blob of length {fork.get_blob_constant('FIELD_ELEMENTS_PER_BLOB') *fork.get_blob_constant('BYTES_PER_FIELD_ELEMENT')} but got blob of length {len(data)}"# noqa: E501
z=2# 2 is one of many possible valid field elements z (https://github.com/ethereum/consensus-specs/blob/ad884507f7a1d5962cd3dfb5f7b3e41aab728c55/tests/core/pyspec/eth2spec/test/utils/kzg_tests.py#L58-L66)
Note: Requirement for successful reconstruction is having at least N of the 2N cells.
290
291
291
-
Theoretical Usage: You pass a cell list with to 128 elements to this function along with a list of deletion indices.
292
-
These cells will be deleted and then the ckzg recovery mechanism is used to repair the missing cells.
292
+
Theoretical Usage: You pass a cell list with to 128 elements to this function
293
+
along with a list of deletion indices. These cells will be deleted and then
294
+
the ckzg recovery mechanism is used to repair the missing cells.
293
295
If no assertion is triggered the reconstruction was successful.
294
-
"""# noqa: E501
296
+
"""
295
297
assertself.forkin ["osaka"], (
296
298
f"delete_cells_then_recover_them() is not available for fork: {self.fork}"
297
299
)
298
300
299
-
assertself.cellsisnotNone, "..."# TODO: write text
301
+
assertself.cellsisnotNone, "self.cells is None, critical problem."
300
302
301
303
assertisinstance(self.proof, list), (
302
-
"This function only works when self.proof is a list, but it seems to be of type bytes (not a list)"# noqa: E501
304
+
"This function only works when self.proof is a list, but it seems to be "
305
+
" of type bytes (not a list)"
303
306
)
304
307
305
308
assertlen(self.cells) ==128, (
306
-
f"You are supposed to pass a full cell list with 128 elements to this function, but got list of length {len(self.cells)}"# noqa: E501
309
+
f"You are supposed to pass a full cell list with 128 elements to this function, "
310
+
f"but got list of length {len(self.cells)}"
307
311
)
308
312
309
313
assertlen(deletion_indices) <129, (
310
-
f"You can't delete more than every cell (max len of deletion indices list is 128), but you passed a deletion indices list of length {len(deletion_indices)}"# noqa: E501
314
+
f"You can't delete more than every cell (max len of deletion indices list is 128), "
315
+
f"but you passed a deletion indices list of length {len(deletion_indices)}"
311
316
)
312
317
foriindeletion_indices:
313
318
assert0<=i<=127, f"Expected integers in range [0, 127], but got: {i}"
) # on success returns two lists of len 128 # noqa: E501
327
+
) # on success returns two lists of len 128
323
328
324
329
# determine success/failure
325
330
assertlen(recovered_cells) ==len(self.cells), (
326
-
f"Failed to recover cell list. Original cell list had length {len(self.cells)} but recovered cell list has length {len(recovered_cells)}"# noqa: E501
331
+
f"Failed to recover cell list. Original cell list had length {len(self.cells)} but "
332
+
f"recovered cell list has length {len(recovered_cells)}"
327
333
)
328
334
assertlen(recovered_proofs) ==len(self.proof), (
329
-
f"Failed to recover proofs list. Original proofs list had length {len(self.proof)} but recovered proofs list has length {len(recovered_proofs)}"# noqa: E501
335
+
f"Failed to recover proofs list. Original proofs list had length {len(self.proof)} "
336
+
f"but recovered proofs list has length {len(recovered_proofs)}"
330
337
)
331
338
332
339
foriinrange(len(recovered_cells)):
333
340
assertself.cells[i] ==recovered_cells[i], (
334
-
f"Failed to correctly restore missing cells. At index {i} original cell was 0x{self.cells[i].hex()} but reconstructed cell does not match: 0x{recovered_cells[i].hex()}"# noqa: E501
341
+
f"Failed to correctly restore missing cells. At index {i} original cell was "
342
+
f"0x{self.cells[i].hex()} but reconstructed cell does not match: "
343
+
f"0x{recovered_cells[i].hex()}"
335
344
)
336
345
assertself.proof[i] ==recovered_proofs[i], (
337
-
f"Failed to correctly restore missing proofs. At index {i} original proof was 0x{self.proof[i].hex()} but reconstructed proof does not match: 0x{recovered_proofs[i].hex()}"# noqa: E501
346
+
f"Failed to correctly restore missing proofs. At index {i} original proof was "
347
+
f"0x{self.proof[i].hex()} but reconstructed proof does not match: "
348
+
f"0x{recovered_proofs[i].hex()}"
338
349
)
339
350
340
351
classProofCorruptionMode(Enum):
341
-
"""Define what the proof corruption modes do. For Osaka and later each Bytes object in the list is manipulated this way."""# noqa: E501
352
+
"""
353
+
Define what the proof corruption modes do.
354
+
355
+
For Osaka and later each Bytes object in the list is manipulated this way.
356
+
"""
342
357
343
358
CORRUPT_FIRST_BYTE=1# corrupts a single byte (index 0)
344
359
CORRUPT_LAST_BYTE=2# corrupts a single byte (last valid index)
0 commit comments