Skip to content

Commit 9752a1c

Browse files
authored
Merge pull request #3904 from etan-status/df-rlptx
Fix blob transaction serialization to use RLP
2 parents 28f9f07 + 72f5190 commit 9752a1c

File tree

12 files changed

+80
-99
lines changed

12 files changed

+80
-99
lines changed

tests/core/pyspec/eth2spec/test/deneb/block_processing/test_process_execution_payload.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
expect_assertion_error,
1111
with_deneb_and_later
1212
)
13-
from eth2spec.test.helpers.sharding import (
14-
get_sample_opaque_tx,
13+
from eth2spec.test.helpers.blob import (
14+
get_sample_blob_tx,
1515
)
1616

1717

@@ -74,7 +74,7 @@ def test_incorrect_blob_tx_type(spec, state):
7474
"""
7575
execution_payload = build_empty_execution_payload(spec, state)
7676

77-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
77+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
7878
opaque_tx = b'\x04' + opaque_tx[1:] # incorrect tx type
7979

8080
execution_payload.transactions = [opaque_tx]
@@ -91,7 +91,7 @@ def test_incorrect_transaction_length_1_extra_byte(spec, state):
9191
"""
9292
execution_payload = build_empty_execution_payload(spec, state)
9393

94-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
94+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
9595
opaque_tx = opaque_tx + b'\x12' # incorrect tx length, longer
9696

9797
execution_payload.transactions = [opaque_tx]
@@ -108,7 +108,7 @@ def test_incorrect_transaction_length_1_byte_short(spec, state):
108108
"""
109109
execution_payload = build_empty_execution_payload(spec, state)
110110

111-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
111+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
112112
opaque_tx = opaque_tx[:-1] # incorrect tx length, shorter
113113

114114
execution_payload.transactions = [opaque_tx]
@@ -125,7 +125,7 @@ def test_incorrect_transaction_length_empty(spec, state):
125125
"""
126126
execution_payload = build_empty_execution_payload(spec, state)
127127

128-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
128+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
129129
opaque_tx = opaque_tx[0:0] # incorrect tx length, empty
130130

131131
execution_payload.transactions = [opaque_tx]
@@ -142,7 +142,7 @@ def test_incorrect_transaction_length_32_extra_bytes(spec, state):
142142
"""
143143
execution_payload = build_empty_execution_payload(spec, state)
144144

145-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
145+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
146146
opaque_tx = opaque_tx + b'\x12' * 32 # incorrect tx length
147147

148148
execution_payload.transactions = [opaque_tx]
@@ -159,7 +159,7 @@ def test_no_transactions_with_commitments(spec, state):
159159
"""
160160
execution_payload = build_empty_execution_payload(spec, state)
161161

162-
_, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
162+
_, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
163163

164164
execution_payload.transactions = []
165165
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload, state)
@@ -175,7 +175,7 @@ def test_incorrect_commitment(spec, state):
175175
"""
176176
execution_payload = build_empty_execution_payload(spec, state)
177177

178-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
178+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
179179
blob_kzg_commitments[0] = b'\x12' * 48 # incorrect commitment
180180

181181
execution_payload.transactions = [opaque_tx]
@@ -192,7 +192,7 @@ def test_incorrect_commitments_order(spec, state):
192192
"""
193193
execution_payload = build_empty_execution_payload(spec, state)
194194

195-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=2, rng=Random(1111))
195+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=2, rng=Random(1111))
196196
blob_kzg_commitments = [blob_kzg_commitments[1], blob_kzg_commitments[0]] # incorrect order
197197

198198
execution_payload.transactions = [opaque_tx]
@@ -206,7 +206,7 @@ def test_incorrect_commitments_order(spec, state):
206206
def test_incorrect_block_hash(spec, state):
207207
execution_payload = build_empty_execution_payload(spec, state)
208208

209-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
209+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
210210

211211
execution_payload.transactions = [opaque_tx]
212212
execution_payload.block_hash = b'\x12' * 32 # incorrect block hash
@@ -223,7 +223,7 @@ def test_zeroed_commitment(spec, state):
223223
"""
224224
execution_payload = build_empty_execution_payload(spec, state)
225225

226-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=1, is_valid_blob=False)
226+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=1, is_valid_blob=False)
227227
assert all(commitment == b'\x00' * 48 for commitment in blob_kzg_commitments)
228228

229229
execution_payload.transactions = [opaque_tx]
@@ -240,7 +240,7 @@ def test_invalid_correct_input__execution_invalid(spec, state):
240240
"""
241241
execution_payload = build_empty_execution_payload(spec, state)
242242

243-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
243+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec)
244244

245245
execution_payload.transactions = [opaque_tx]
246246
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload, state)
@@ -254,7 +254,7 @@ def test_invalid_correct_input__execution_invalid(spec, state):
254254
def test_invalid_exceed_max_blobs_per_block(spec, state):
255255
execution_payload = build_empty_execution_payload(spec, state)
256256

257-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=spec.config.MAX_BLOBS_PER_BLOCK + 1)
257+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=spec.config.MAX_BLOBS_PER_BLOCK + 1)
258258

259259
execution_payload.transactions = [opaque_tx]
260260
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload, state)

tests/core/pyspec/eth2spec/test/deneb/fork_choice/test_on_block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
from eth2spec.test.helpers.state import (
2626
state_transition_and_sign_block,
2727
)
28-
from eth2spec.test.helpers.sharding import (
29-
get_sample_opaque_tx,
28+
from eth2spec.test.helpers.blob import (
29+
get_sample_blob_tx,
3030
)
3131

3232

3333
def get_block_with_blob(spec, state, rng=None):
3434
block = build_empty_block_for_next_slot(spec, state)
35-
opaque_tx, blobs, blob_kzg_commitments, blob_kzg_proofs = get_sample_opaque_tx(spec, blob_count=1, rng=rng)
35+
opaque_tx, blobs, blob_kzg_commitments, blob_kzg_proofs = get_sample_blob_tx(spec, blob_count=1, rng=rng)
3636
block.body.execution_payload.transactions = [opaque_tx]
3737
block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload, state)
3838
block.body.blob_kzg_commitments = blob_kzg_commitments

tests/core/pyspec/eth2spec/test/deneb/merkle_proof/test_single_merkle_proof.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from eth2spec.test.helpers.execution_payload import (
1313
compute_el_block_hash,
1414
)
15-
from eth2spec.test.helpers.sharding import (
16-
get_sample_opaque_tx,
15+
from eth2spec.test.helpers.blob import (
16+
get_sample_blob_tx,
1717
)
1818
from eth2spec.debug.random_value import (
1919
RandomizationMode,
@@ -22,7 +22,7 @@
2222

2323

2424
def _run_blob_kzg_commitment_merkle_proof_test(spec, state, rng=None):
25-
opaque_tx, blobs, blob_kzg_commitments, proofs = get_sample_opaque_tx(spec, blob_count=1)
25+
opaque_tx, blobs, blob_kzg_commitments, proofs = get_sample_blob_tx(spec, blob_count=1)
2626
if rng is None:
2727
block = build_empty_block_for_next_slot(spec, state)
2828
else:

tests/core/pyspec/eth2spec/test/deneb/sanity/test_blocks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
compute_el_block_hash,
1515
get_random_tx,
1616
)
17-
from eth2spec.test.helpers.sharding import (
18-
get_sample_opaque_tx,
17+
from eth2spec.test.helpers.blob import (
18+
get_sample_blob_tx,
1919
)
2020

2121

@@ -27,7 +27,7 @@ def run_block_with_blobs(spec, state, blob_count, tx_count=1, blob_gas_used=1, e
2727
txs = []
2828
blob_kzg_commitments = []
2929
for _ in range(tx_count):
30-
opaque_tx, _, commits, _ = get_sample_opaque_tx(spec, blob_count=blob_count)
30+
opaque_tx, _, commits, _ = get_sample_blob_tx(spec, blob_count=blob_count)
3131
txs.append(opaque_tx)
3232
blob_kzg_commitments += commits
3333

tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
expect_assertion_error,
88
always_bls
99
)
10-
from eth2spec.test.helpers.sharding import (
10+
from eth2spec.test.helpers.blob import (
1111
get_sample_blob,
1212
get_poly_in_both_forms,
1313
eval_poly_in_coeff_form,

tests/core/pyspec/eth2spec/test/deneb/unittests/validator/test_validator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from eth2spec.test.helpers.execution_payload import (
77
compute_el_block_hash,
88
)
9-
from eth2spec.test.helpers.sharding import (
10-
get_sample_opaque_tx,
9+
from eth2spec.test.helpers.blob import (
10+
get_sample_blob_tx,
1111
)
1212
from eth2spec.test.helpers.block import (
1313
build_empty_block_for_next_slot,
@@ -20,8 +20,8 @@ def _get_sample_sidecars(spec, state, rng):
2020

2121
# 2 txs, each has 2 blobs
2222
blob_count = 2
23-
opaque_tx_1, blobs_1, blob_kzg_commitments_1, proofs_1 = get_sample_opaque_tx(spec, blob_count=blob_count, rng=rng)
24-
opaque_tx_2, blobs_2, blob_kzg_commitments_2, proofs_2 = get_sample_opaque_tx(spec, blob_count=blob_count, rng=rng)
23+
opaque_tx_1, blobs_1, blob_kzg_commitments_1, proofs_1 = get_sample_blob_tx(spec, blob_count=blob_count, rng=rng)
24+
opaque_tx_2, blobs_2, blob_kzg_commitments_2, proofs_2 = get_sample_blob_tx(spec, blob_count=blob_count, rng=rng)
2525
assert opaque_tx_1 != opaque_tx_2
2626

2727
block.body.blob_kzg_commitments = blob_kzg_commitments_1 + blob_kzg_commitments_2

tests/core/pyspec/eth2spec/test/eip7594/merkle_proof/test_single_merkle_proof.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from eth2spec.test.helpers.execution_payload import (
1313
compute_el_block_hash,
1414
)
15-
from eth2spec.test.helpers.sharding import (
16-
get_sample_opaque_tx,
15+
from eth2spec.test.helpers.blob import (
16+
get_sample_blob_tx,
1717
)
1818
from eth2spec.debug.random_value import (
1919
RandomizationMode,
@@ -22,7 +22,7 @@
2222

2323

2424
def _run_blob_kzg_commitments_merkle_proof_test(spec, state, rng=None):
25-
opaque_tx, blobs, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=1)
25+
opaque_tx, blobs, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=1)
2626
if rng is None:
2727
block = build_empty_block_for_next_slot(spec, state)
2828
else:

tests/core/pyspec/eth2spec/test/eip7594/unittests/das/test_das.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
with_config_overrides,
77
with_eip7594_and_later,
88
)
9-
from eth2spec.test.helpers.sharding import (
9+
from eth2spec.test.helpers.blob import (
1010
get_sample_blob,
1111
)
1212

tests/core/pyspec/eth2spec/test/eip7594/unittests/polynomial_commitments/test_polynomial_commitments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
expect_assertion_error,
66
with_eip7594_and_later,
77
)
8-
from eth2spec.test.helpers.sharding import (
8+
from eth2spec.test.helpers.blob import (
99
get_sample_blob,
1010
)
1111
from eth2spec.utils.bls import BLS_MODULUS

tests/core/pyspec/eth2spec/test/eip7594/unittests/test_networking.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from eth2spec.test.helpers.execution_payload import (
1616
compute_el_block_hash,
1717
)
18-
from eth2spec.test.helpers.sharding import (
19-
get_sample_opaque_tx,
18+
from eth2spec.test.helpers.blob import (
19+
get_sample_blob_tx,
2020
)
2121

2222

@@ -25,7 +25,7 @@
2525

2626
def compute_data_column_sidecar(spec, state):
2727
rng = random.Random(5566)
28-
opaque_tx, blobs, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=2)
28+
opaque_tx, blobs, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=2)
2929
block = get_random_ssz_object(
3030
rng,
3131
spec.BeaconBlock,

0 commit comments

Comments
 (0)