-
Notifications
You must be signed in to change notification settings - Fork 236
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
fix: make a sensible encoding api #1496
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only looked briefly because rlp gives me headaches
wdyt @Rjected
539cf91
to
95844bf
Compare
this is rebased and ready for review The main thing it does is make an INTERNAL trait |
95844bf
to
bb3c510
Compare
now closes #1510 as well |
86e2c5e
to
21f7aef
Compare
this has been rebased onto main after #1528 and is ready for review. Note that 1528 included a version of this API in the blob sidecar rlp impl. I'm also prepping a followup PR to move other RLP impls to this style |
Could we get a patch release of alloy-rlp? alloy-rs/rlp#28 would let us reduce code complexity |
@prestwich alloy-rlp 0.3.9 is now released with alloy-rs/rlp#28 |
8de9c9f
to
1257307
Compare
Thank you, this PR is updated, rebased, and ready for review 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool,
I think this a lot cleaner now.
would like one more sanity rlp review from @klkvr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the API, one concern about the header type when this is implemented on legacy txs - I'm thinking legacy txs should probably override all of the default impls for network_
fns
I think we should also specify the type of RLP header when possible (list v string)
d9c7bd5
to
72169eb
Compare
fixes up and ready for re-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just a nit
<!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Bug fixes and new features should include tests. Contributors guide: https://github.com/alloy-rs/core/blob/main/CONTRIBUTING.md The contributors guide includes instructions for running rustfmt and building the documentation. --> <!-- ** Please select "Allow edits from maintainers" in the PR Options ** --> ## Motivation Bumps alloy, alloy-core and alloy-eip7702. Code changes: - alloy-rs/alloy#1496 changed transaction encoding API, encoding functions are now prefixed with `rlp`,`eip2718` or `network`. I've updated `TxDeposit` to have methods following this pattern - alloy-rs/core#776 updated signature type to avoid using `Parity` generic and instead just keep a boolean for parity byte. The motivation is to have more correctness in encoding and data structure. Before that it was possible to construct `Signed<TxLegacy>` where transaction chain_id is `Some`, but the parity would not follow EIP-155. This required a few changes to `SpanBatchTransactions` type: - `encode_y_parity_bits` and `encode_tx_sigs_rs` are merged into single `encode_tx_sigs` which firstly encodes parity bits and then `rs` values. Same was done for decoding methods - `recover_v` method is removed. instead, we now pass the `is_protected` flag down to `SpanBatchLegacyTransactionData` and only set `chain_id` to `Some` when `is_protected` is true Blocked by minor releases for alloy, core and revm ## Solution <!-- Summarize the solution and provide any necessary context needed to understand the code change. --> ## PR Checklist - [ ] Added Tests - [ ] Added Documentation - [ ] Breaking changes
Spawned from the depths of #1485
Motivation
Fix transaction coding APIs to be usable and clear
encode_with_signature
encode_with_signature
are wrongencode_with_signature
produces 2718 output whenwith_header
is false, and RLP in network format whenwith_header
istrue
. All otherencode_
methods produce RLP output in non-network formatdecode_with_signature
is missing entirelyEncodableSignature
seems to now be redundant as reth migrated toalloy-primitives::Signature
Solution
create a simple API in which encoding and decoding function names specify which format they produce/accept
PR Checklist