@@ -465,17 +465,39 @@ def normalize_vmtest_fixture(fixture: Dict[str, Any]) -> Iterable[Tuple[str, Any
465
465
466
466
467
467
def normalize_signed_transaction (transaction : Dict [str , Any ]) -> Dict [str , Any ]:
468
- return {
468
+ normalized_universal_transaction = {
469
469
'data' : robust_decode_hex (transaction ['data' ]),
470
470
'gasLimit' : to_int (transaction ['gasLimit' ]),
471
- 'gasPrice' : to_int (transaction ['gasPrice' ]),
472
471
'nonce' : to_int (transaction ['nonce' ]),
473
472
'r' : to_int (transaction ['r' ]),
474
473
's' : to_int (transaction ['s' ]),
475
474
'v' : to_int (transaction ['v' ]),
476
475
'to' : decode_hex (transaction ['to' ]),
477
476
'value' : to_int (transaction ['value' ]),
478
477
}
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 )
479
501
480
502
481
503
@curry
0 commit comments