alloy-rs / alloy

Transports, Middleware, and Networks for the Alloy project
https://alloy.rs
Apache License 2.0
666 stars 240 forks source link

fix: serde for `AnyTxEnvelope` #1613

Closed klkvr closed 3 weeks ago

klkvr commented 3 weeks ago

Motivation

RIght now AnyTxType is serialized as number but we should use quantity for it.

Also, MaybeTaggedEnvelope would correctly deserialize legacy transaction if map has all its fields and a different type flag. This is the case for deposit transaction breaking its deserialization in AnyTxEnvelope context

Solution

Serialize and deserialize AnyTxType as U8

Fail Untagged variant deserialization if type is present.

Also fixed deserialization of transaction fields in Transaction trait impl. We had incorrect name for gas and didn't use quantity when deserializing integers.

PR Checklist