From 2d08dc51c5c10aec6a896a86d872fbce7ca0e084 Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 6 Oct 2022 18:10:10 +0200 Subject: [PATCH] eip-4844: test tx_peek_blob_versioned_hashes --- .../test/eip4844/unittests/test_offset.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/core/pyspec/eth2spec/test/eip4844/unittests/test_offset.py diff --git a/tests/core/pyspec/eth2spec/test/eip4844/unittests/test_offset.py b/tests/core/pyspec/eth2spec/test/eip4844/unittests/test_offset.py new file mode 100644 index 000000000..1702ea7e0 --- /dev/null +++ b/tests/core/pyspec/eth2spec/test/eip4844/unittests/test_offset.py @@ -0,0 +1,23 @@ + +from eth2spec.test.helpers.constants import ( + EIP4844, + MINIMAL, +) +from eth2spec.test.helpers.sharding import ( + get_sample_opaque_tx, +) +from eth2spec.test.context import ( + with_phases, + spec_state_test, + with_presets, +) + + +@with_phases([EIP4844]) +@spec_state_test +@with_presets([MINIMAL]) +def test_tx_peek_blob_versioned_hashes(spec, state): + otx, blobs, commitments = get_sample_opaque_tx(spec) + data_hashes = spec.tx_peek_blob_versioned_hashes(otx) + expected = [spec.kzg_commitment_to_versioned_hash(blob_commitment) for blob_commitment in commitments] + assert expected == data_hashes