Skip to content

Commit e469a29

Browse files
committed
added fork_at for transition forks, WIP
1 parent 9137dea commit e469a29

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/ethereum_test_types/blob_types.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ def get_cells(fork: Fork, data: Bytes) -> List[Bytes] | None:
212212
# loaded trusted setup if it is not already loaded
213213
Blob.trusted_setup()
214214

215+
# handle transition forks (not needed when default timestamp of 0 is used)
216+
if timestamp > 0:
217+
fork = fork.fork_at(timestamp=timestamp)
218+
215219
# get data for blob parameters
216220
data: Bytes = generate_blob_data(seed)
217221
commitment: Bytes = get_commitment(data)
@@ -433,15 +437,6 @@ def corrupt_byte(b: bytes) -> Bytes:
433437
self.proof = Bytes(b"".join(corrupt_byte(bytes([byte])) for byte in self.proof))
434438

435439

436-
# TODO: what does he mean with fork.fork_at()? This function also seems to require a 'block number' which is not available here. And to which file is the logic of that function hidden? # noqa: E501
437-
# mytestfork: Fork = CancunToPragueAtTime15k
438-
# mytestfork.fork_at(timestamp=14999) # returns cancun
439-
# mytestfork.fork_at(timestamp=15000) # returns prague
440-
# TODO: call this once only at blob creation (not when reading blob from file) + remove timestamp from json # noqa: E501
441-
442-
# TODO: fix tests/osaka/eip7594_peerdas/test_get_blobs.py
443-
# TODO: test all functions again
444-
445440
# --------- generate static blobs ------------
446441
# fork_list = [Cancun, Prague, Osaka]
447442
# amount_static_blobs_per_fork = 10
@@ -509,6 +504,22 @@ def corrupt_byte(b: bytes) -> Bytes:
509504
# # myparis: Fork = Paris
510505
# # parisapriaparip: Blob = Blob.from_fork(myparis, myseed, 123)
511506

507+
# test fork_at for when timestamp > 0
508+
# transitionfork: Fork = Cancun
509+
# new_timestamp = 15000 # is supposed to return prague, but still returns cancun.. TODO: ?
510+
# transitionforkblob: Blob = Blob.from_fork(transitionfork, timestamp=new_timestamp)
511+
# transitionforkblob.write_to_file()
512+
# restored_transitionforkblob: Blob = Blob.from_file("blob_0_cell_proofs_0")
513+
# assert transitionforkblob.data == restored_transitionforkblob.data
514+
# assert transitionforkblob.commitment == restored_transitionforkblob.commitment
515+
# assert transitionforkblob.proof == restored_transitionforkblob.proof
516+
# assert transitionforkblob.cells == restored_transitionforkblob.cells
517+
# assert transitionforkblob.versioned_hash == restored_transitionforkblob.versioned_hash
518+
# assert transitionforkblob.name == restored_transitionforkblob.name
519+
# assert transitionforkblob.fork == restored_transitionforkblob.fork
520+
# assert transitionforkblob.seed == restored_transitionforkblob.seed
521+
# assert transitionforkblob.timestamp == restored_transitionforkblob.timestamp
522+
512523
# # test proof corruption
513524
# # osaka
514525
# testseed = 55

0 commit comments

Comments
 (0)