Skip to content
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

chore: remove associated constant from RlpEcdsaEncodableTx #2172

Merged
merged 3 commits into from
Mar 11, 2025

Conversation

stevencartavia
Copy link
Contributor

Motivation

closes #2171

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a good start, but for this pr we can simply move the associated constant from the encodable to the decodable trait until we figure out what to do with the default decode impls

@@ -195,8 +195,8 @@ pub trait RlpEcdsaDecodableTx: RlpEcdsaEncodableTx {

/// Decodes the transaction from eip2718 bytes, expecting the default type
/// flag.
fn eip2718_decode(buf: &mut &[u8]) -> Eip2718Result<Signed<Self>> {
Self::eip2718_decode_with_type(buf, Self::DEFAULT_TX_TYPE)
fn eip2718_decode(&self, buf: &mut &[u8]) -> Eip2718Result<Signed<Self>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't give the decoding fns a &self arg because this defeats the purpose of decoding, so we need to fix this separately

/// The default transaction type for this transaction.
const DEFAULT_TX_TYPE: u8;

pub trait RlpEcdsaEncodableTx: Sized + Typed2718 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great

}
}

/// Helper trait for managing RLP decoding of transactions inside 2718 envelopes.
#[doc(hidden)]
#[doc(alias = "RlpDecodableTx", alias = "RlpTxDecoding")]
pub trait RlpEcdsaDecodableTx: RlpEcdsaEncodableTx {
pub trait RlpEcdsaDecodableTx: RlpEcdsaEncodableTx + Typed2718 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we now need to introduce the associated constant for now, because we can't remove that in one go, but we want to remove it from the encodable trait right away

@stevencartavia stevencartavia changed the title chore: remove associated constant from RlpEcdsaDecodableTx chore: remove associated constant from RlpEcdsaEncodableTx Mar 11, 2025
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mattsse mattsse merged commit 7d0e83d into alloy-rs:main Mar 11, 2025
27 checks passed
github-merge-queue bot pushed a commit to alloy-rs/op-alloy that referenced this pull request Mar 12, 2025
<!--
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
same as alloy-rs/alloy#2172 

<!--
Explain the context and why you're making that change. What is the
problem
you're trying to solve? In some cases there is not a problem and this
can be
thought of as being the motivation for your change.
-->

## Solution

<!--
Summarize the solution and provide any necessary context needed to
understand
the code change.
-->

## PR Checklist

- [ ] Added Tests
- [ ] Added Documentation
- [ ] Breaking changes

---------

Co-authored-by: Matthias Seitz <[email protected]>
@Karrq
Copy link
Contributor

Karrq commented Mar 12, 2025

Hey, couldn't help but notice this API breaking change was included in the patch release 0.12.5 as described in the changelog.
What this intended? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature] Remove associated constant from RlpEcdsaDecodableTx
3 participants