-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: integrate signature with boolean parity #1540
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 tasks
klkvr
force-pushed
the
klkvr/wip-bool-parity
branch
from
October 20, 2024 21:14
b5e0a98
to
846c125
Compare
3 tasks
3 tasks
klkvr
force-pushed
the
klkvr/wip-bool-parity
branch
4 times, most recently
from
October 30, 2024 19:01
2e15710
to
e6177f7
Compare
klkvr
force-pushed
the
klkvr/wip-bool-parity
branch
from
October 30, 2024 19:17
e6177f7
to
fabd775
Compare
klkvr
force-pushed
the
klkvr/wip-bool-parity
branch
from
October 31, 2024 12:45
6e67c32
to
4ad8918
Compare
klkvr
changed the title
[wip] integrate signature with boolean parity
feat: integrate signature with boolean parity
Oct 31, 2024
klkvr
requested review from
DaniPopes,
gakonst,
mattsse,
onbjerg and
emhane
as code owners
October 31, 2024 19:29
mattsse
approved these changes
Oct 31, 2024
mattsse
approved these changes
Nov 1, 2024
klkvr
force-pushed
the
klkvr/wip-bool-parity
branch
3 times, most recently
from
November 4, 2024 03:08
7a56d8a
to
ede6173
Compare
klkvr
force-pushed
the
klkvr/wip-bool-parity
branch
from
November 5, 2024 14:07
ede6173
to
6408184
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Integrates signature from alloy-rs/core#776
Depends on alloy-rs/eips#12 and alloy-rs/core#796, needs minor releases for core and eips
Solution
Changes in this PR:
signature.v()
is now encoded and accounted in length separatelyu64
and extracting chain_id when possible. Encoding manually encodes chain_id into boolean parity as per EIP-155 spec.sign_transaction_with_chain_id
macro no more adjusts the signature. as long as signer signed the correct payload with chain_id we are fine with parity being boolean, and legacy transaction encoding methods will figure out how to encode it into integersigned_legacy_serde
module is added which should be used for serialization ofSigned<TxLegacy>
to respect the specification requiring parity being serialized as EIP-155 compliantv
key.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 withyParity
key. We can't implement serialize directly on individualSigned<_>
types because this would make it impossible to implement serde forSigned<_>
with custom transaction. For now I've addedwith = "signed_legacy_serde"
to envelope legacy variants which should ensure that enveloped transactions are always (de)serialized correctlyPR Checklist