alloy-rs / alloy

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

feat: integrate signature with boolean parity #1540

Closed klkvr closed 3 weeks ago

klkvr commented 1 month ago

Motivation

Integrates signature from https://github.com/alloy-rs/core/pull/776

Depends on https://github.com/alloy-rs/eips/pull/12 and https://github.com/alloy-rs/core/pull/796, needs minor releases for core and eips

Solution

Changes in this PR:

This is not perfect from our pov because we now have more boilerplate logic for parity encoding. However, this makes encoding API safer without any changes to it.

One limitation here is that Signed<TxLegacy> on its own would be serialized incorrectly with yParity key. We can't implement serialize directly on individual Signed<_> types because this would make it impossible to implement serde for Signed<_> with custom transaction. For now I've added with = "signed_legacy_serde" to envelope legacy variants which should ensure that enveloped transactions are always (de)serialized correctly

PR Checklist