diff --git a/crates/network/src/any/mod.rs b/crates/network/src/any/mod.rs index dc8c9801595..da8156148a2 100644 --- a/crates/network/src/any/mod.rs +++ b/crates/network/src/any/mod.rs @@ -535,9 +535,28 @@ impl alloy_consensus::Transaction for AnyTypedTransaction { /// Types for a catch-all network. /// -/// Essentially just returns the regular Ethereum types + a catch all field. -/// This [`Network`] should be used only when the network is not known at -/// compile time. +/// `AnyNetwork`'s associated types allow for many different types of +/// transactions, using catch-all fields. This [`Network`] should be used +/// only when the application needs to support multiple networks via the same +/// codepaths without knowing the networks at compile time. +/// +/// ## Rough Edges +/// +/// Supporting arbitrary unknown types is hard, and users of this network +/// should be aware of the following: +/// +/// - The implementation of [`Decodable2718`] for [`AnyTxEnvelope`] will not work for non-Ethereum +/// transaction types. It will succesfully decode an Ethereum [`TxEnvelope`], but will decode only +/// the type for any unknown transaction type. It will also leave the buffer unconsumed, which +/// will cause further deserialization to produce erroneous results. +/// - The implementation of [`Encodable2718`] for [`AnyTypedTransaction`] will not work for +/// non-Ethereum transaction types. It will encode the type for any unknown transaction type, but +/// will not encode any other fields. This is symmetric with the decoding behavior, but still +/// erroneous. +/// - The [`TransactionRequest`] will build ONLY Ethereum types. It will error when attempting to +/// build any unknown type. +/// - The [`TransactionResponse`] may deserialize unknown metadata fields into the inner +/// [`AnyTxEnvelope`], rather than into the outer [`WithOtherFields`]. #[derive(Clone, Copy, Debug)] pub struct AnyNetwork { _private: (),