alloy-rs / core

High-performance, well-tested & documented core libraries for Ethereum, in Rust
https://alloy.rs
Apache License 2.0
790 stars 155 forks source link

fix(serde): add alias `v` for `yParity` #801

Closed klkvr closed 3 weeks ago

klkvr commented 3 weeks ago

Motivation

Geth responds with v for EIP-1559 transactions. This PR updates default serde impl for PrimitiveSignature to accept v in place of yParity. Only 0/1 values for v would get correctly deserialized.

Additionaly, we now always serialize both v and yParity for compatibility as this is done in reth: https://github.com/paradigmxyz/reth/blob/bd8c4eceb20c39c6e501d06cf906469329340bb9/crates/rpc/rpc-types-compat/src/transaction/signature.rs#L29

Solution

PR Checklist