feat: add trait impls for Cow to support Recovered<Cow<'_, T>>#3689
Merged
feat: add trait impls for Cow to support Recovered<Cow<'_, T>>#3689
Conversation
Add Cow<'_, T> implementations for key traits: - Typed2718 - Encodable2718 - TxHashRef Add Recovered<Cow<'_, T>>::into_owned() helper. Amp-Thread-ID: https://ampcode.com/threads/T-019c5c07-e7dd-74c9-8640-a59cc70697a9 Co-authored-by: Amp <[email protected]>
mattsse
approved these changes
Feb 14, 2026
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.
Adds
Cow<'_, T>implementations for key traits so thatRecovered<Cow<'_, T>>works transparently. This enables pool transaction types to return either borrowed or owned consensus transactions viaCow.Changes
Typed2718 for Cow<'_, T>inalloy-eipsEncodable2718 for Cow<'_, T>inalloy-eipsTxHashRef for Cow<'_, T>inalloy-consensusRecovered<Cow<'_, T>>::into_owned()helper inalloy-consensusContext
reth's
PoolTransactiontrait needs aconsensus_refmethod that returnsRecovered<Cow<'_, Self::Consensus>>. Types wrapping the consensus tx returnCow::Borrowed, while mock/test types that don't store a consensus tx can returnCow::Owned. These impls makeRecovered<Cow<'_, T>>a first-class citizen.Transactionitself can't be impl'd forCow<'a, T>due to the'staticsupertrait bound, but callers accessTransactionmethods through deref coercion.Prompted by: matthias