feat(consensus-any): move AnyTxType, UnknownTxEnvelope, UnknownTypedTransaction from alloy-network#3878
Open
TechFusionData wants to merge 1 commit intoalloy-rs:mainfrom
Conversation
…ransaction from alloy-network Partially resolves alloy-rs#1598. Move the three 'unknown' transaction types from alloy-network into alloy-consensus-any, reducing the dependency surface for crates that only need to work with unknown transaction envelopes: - AnyTxType - UnknownTypedTransaction - UnknownTxEnvelope (+ internal DeserMemo helper) Key changes: - New crates/consensus-any/src/unknown.rs with the moved types - alloy-consensus-any Cargo.toml: enable serde + alloy-serde when std feature is active (required by OtherFields and OnceLock) - alloy-network re-exports the moved types from alloy-consensus-any for backwards compatibility - AnyTypedTransaction and AnyTxEnvelope remain in alloy-network; moving them requires resolving the From<Self::UnsignedTx/TxEnvelope> bounds on the Network::TransactionRequest associated type, which would create a circular dependency between alloy-consensus-any and alloy-rpc-types-eth
This file contains hidden or 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
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.
Partially resolves #1598.
Summary
Moves the three unknown transaction types from
alloy-networkintoalloy-consensus-any, so that downstream crates which only need to inspect or pattern-match unknown transaction envelopes no longer need to pull in the fullalloy-networkdependency tree.Types moved to
alloy-consensus-any:AnyTxTypeUnknownTypedTransactionUnknownTxEnvelopealloy-networkre-exports all three types unchanged, so this is backwards-compatible for existing users.Why not move
AnyTypedTransaction/AnyTxEnvelope?The
Networktrait requires:For
AnyNetwork,TransactionRequest = WithOtherFields<TransactionRequest>. MovingAnyTxEnvelope/AnyTypedTransactiontoalloy-consensus-anywould require theFromimpls to live inalloy-consensus-anyas well, butalloy-rpc-types-ethalready depends onalloy-consensus-any, creating a circular dependency. This is left as a follow-up — one approach would be to moveTransactionRequestto a lighter crate.Changes
crates/consensus-any/src/unknown.rs— new file with the moved types; usesalloy_eips::eip2930::AccessListinstead ofalloy_rpc_types_eth::AccessList(same type, lighter dep path)crates/consensus-any/Cargo.toml— enablesserde+alloy-serdewhenstdfeature is active (required byOtherFieldsandOnceLock)crates/network/src/any/unknowns.rs— becomes a thin re-export wrappercrates/network/src/any/either.rs— unchanged behaviour, updated to import unknown types fromalloy_consensus_anyTesting
cargo check -p alloy-consensus-any -p alloy-network -p alloy-rpc-types-eth -p alloy-rpc-types-any— zero errors, zero warnings.