Skip to content

Commit a5095ad

Browse files
committed
Parse the name of London transition tests
Also, normalize dynamic-fee-transactions
1 parent df17fa7 commit a5095ad

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

eth/tools/_utils/normalization.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,17 +465,39 @@ def normalize_vmtest_fixture(fixture: Dict[str, Any]) -> Iterable[Tuple[str, Any
465465

466466

467467
def normalize_signed_transaction(transaction: Dict[str, Any]) -> Dict[str, Any]:
468-
return {
468+
normalized_universal_transaction = {
469469
'data': robust_decode_hex(transaction['data']),
470470
'gasLimit': to_int(transaction['gasLimit']),
471-
'gasPrice': to_int(transaction['gasPrice']),
472471
'nonce': to_int(transaction['nonce']),
473472
'r': to_int(transaction['r']),
474473
's': to_int(transaction['s']),
475474
'v': to_int(transaction['v']),
476475
'to': decode_hex(transaction['to']),
477476
'value': to_int(transaction['value']),
478477
}
478+
if 'type' in transaction:
479+
type_id = to_int(transaction['type'])
480+
if type_id == 1:
481+
custom_fields = {
482+
'type': type_id,
483+
'gasPrice': to_int(transaction['gasPrice']),
484+
'chainId': to_int(transaction['chainId']),
485+
}
486+
elif type_id == 2:
487+
custom_fields = {
488+
'type': type_id,
489+
'chainId': to_int(transaction['chainId']),
490+
'maxFeePerGas': to_int(transaction['maxFeePerGas']),
491+
'maxPriorityFeePerGas': to_int(transaction['maxPriorityFeePerGas']),
492+
}
493+
else:
494+
raise ValidationError(f"Did not recognize transaction type {type_id}")
495+
else:
496+
custom_fields = {
497+
'gasPrice': to_int(transaction['gasPrice']),
498+
}
499+
500+
return merge(normalized_universal_transaction, custom_fields)
479501

480502

481503
@curry

eth/tools/fixtures/helpers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
SpuriousDragonVM,
4949
IstanbulVM,
5050
BerlinVM,
51+
LondonVM,
5152
)
5253

5354

@@ -162,6 +163,11 @@ def chain_vm_configuration(fixture: Dict[str, Any]) -> Iterable[Tuple[int, Type[
162163
(0, ByzantiumVM),
163164
(5, PetersburgVM),
164165
)
166+
elif network == 'BerlinToLondonAt5':
167+
return (
168+
(0, BerlinVM),
169+
(5, LondonVM),
170+
)
165171
else:
166172
raise ValueError(f"Network {network} does not match any known VM rules")
167173

0 commit comments

Comments
 (0)