Skip to content

Comments

feat(consensus): add InMemorySize trait#3656

Merged
mattsse merged 2 commits intomainfrom
mattsse/add-in-memory-size
Feb 7, 2026
Merged

feat(consensus): add InMemorySize trait#3656
mattsse merged 2 commits intomainfrom
mattsse/add-in-memory-size

Conversation

@gakonst
Copy link
Member

@gakonst gakonst commented Feb 7, 2026

Summary

Add the InMemorySize trait to alloy-consensus for calculating heuristic in-memory size of consensus types.

Motivation

Split out from #3649. This is part of a multi-repo effort to remove op-alloy-* dependencies from core reth crates. Moving trait definitions into alloy allows op-alloy to implement them natively.

Changes

  • Add InMemorySize trait in crates/consensus/src/size.rs
  • Implement for core consensus types: Header, TxLegacy, TxEip2930, TxEip1559, TxEip7702, TxEip4844, Receipt, Block, BlockBody, etc.
  • Re-export from alloy_consensus::InMemorySize

Testing

cargo check -p alloy-consensus --all-features
cargo test -p alloy-consensus

@github-project-automation github-project-automation bot moved this to Reviewed in Alloy Feb 7, 2026
@mattsse mattsse enabled auto-merge (squash) February 7, 2026 11:48
@mattsse mattsse merged commit 3ab03a4 into main Feb 7, 2026
30 checks passed
@mattsse mattsse deleted the mattsse/add-in-memory-size branch February 7, 2026 11:57
@github-project-automation github-project-automation bot moved this from Reviewed to Done in Alloy Feb 7, 2026
gakonst added a commit to paradigmxyz/reth that referenced this pull request Feb 12, 2026
Replace the local InMemorySize trait definition with a re-export from
alloy_consensus. The trait and all shared impls now live upstream in
alloy (alloy-rs/alloy#3656), and the op type impls live in op-alloy
(alloy-rs/op-alloy#624).

Prompted by: mattsse

Amp-Thread-ID: https://ampcode.com/threads/T-019c5388-ba74-7186-9892-926539efe2c1
Co-authored-by: Amp <[email protected]>
github-merge-queue bot pushed a commit to alloy-rs/op-alloy that referenced this pull request Feb 12, 2026
## Summary
Implement `alloy_consensus::InMemorySize` trait for op consensus types.

## Motivation
Part of a multi-repo effort to move the `InMemorySize` trait from reth
into alloy (done in
[alloy#3656](alloy-rs/alloy#3656)). With the
trait now in alloy-consensus, reth can re-export it instead of defining
it locally. However, due to the orphan rule, the op type impls must live
in op-alloy.

## Changes
- Bump `alloy-consensus` minimum to 1.6.2 (which includes
`InMemorySize`)
- Add `InMemorySize` impls for: `OpTxType`, `TxDeposit`,
`OpDepositReceipt`, `OpReceipt`, `OpTypedTransaction`,
`OpPooledTransaction`, `OpTxEnvelope`

## Testing
```
cargo check -p op-alloy-consensus --all-features
cargo test -p op-alloy-consensus
```

Prompted by: mattsse

---------

Co-authored-by: Amp <[email protected]>
refcell pushed a commit to base/base that referenced this pull request Feb 18, 2026
## Summary
Implement `alloy_consensus::InMemorySize` trait for op consensus types.

## Motivation
Part of a multi-repo effort to move the `InMemorySize` trait from reth
into alloy (done in
[alloy#3656](alloy-rs/alloy#3656)). With the
trait now in alloy-consensus, reth can re-export it instead of defining
it locally. However, due to the orphan rule, the op type impls must live
in op-alloy.

## Changes
- Bump `alloy-consensus` minimum to 1.6.2 (which includes
`InMemorySize`)
- Add `InMemorySize` impls for: `OpTxType`, `TxDeposit`,
`OpDepositReceipt`, `OpReceipt`, `OpTypedTransaction`,
`OpPooledTransaction`, `OpTxEnvelope`

## Testing
```
cargo check -p op-alloy-consensus --all-features
cargo test -p op-alloy-consensus
```

Prompted by: mattsse

---------

Co-authored-by: Amp <[email protected]>
refcell pushed a commit to base/base that referenced this pull request Feb 18, 2026
## Summary
Implement `alloy_consensus::InMemorySize` trait for op consensus types.

## Motivation
Part of a multi-repo effort to move the `InMemorySize` trait from reth
into alloy (done in
[alloy#3656](alloy-rs/alloy#3656)). With the
trait now in alloy-consensus, reth can re-export it instead of defining
it locally. However, due to the orphan rule, the op type impls must live
in op-alloy.

## Changes
- Bump `alloy-consensus` minimum to 1.6.2 (which includes
`InMemorySize`)
- Add `InMemorySize` impls for: `OpTxType`, `TxDeposit`,
`OpDepositReceipt`, `OpReceipt`, `OpTypedTransaction`,
`OpPooledTransaction`, `OpTxEnvelope`

## Testing
```
cargo check -p op-alloy-consensus --all-features
cargo test -p op-alloy-consensus
```

Prompted by: mattsse

---------

Co-authored-by: Amp <[email protected]>
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.

2 participants