Repository: paradigmxyz/reth (language: rust)

Issue:
Add serde-bincode-compat for receipt
### Describe the feature

we need to make the receipt variant `SerdeBincodeCompat` as well because for Op it has fields that are skipped (due to rpc compatibility).

so we need to add this to:

https://github.com/paradigmxyz/reth/blob/47bc55b061b1846899392723b432cb2460c4c9da/crates/primitives-traits/src/receipt.rs#L17-L17

as well

like:
https://github.com/paradigmxyz/reth/blob/47bc55b061b1846899392723b432cb2460c4c9da/crates/primitives-traits/src/block/header.rs#L32-L32

## TODO
* add trait requirement
* update bincode compat usage by adding a bincode helper for execution outcome https://github.com/paradigmxyz/reth/blob/47bc55b061b1846899392723b432cb2460c4c9da/crates/evm/execution-types/src/chain.rs#L562-L562
* implement for receipt types (can just return `Self` for now, but we also need: https://github.com/alloy-rs/op-alloy/issues/424 for this)


### Additional context

_No response_


Discussion / hints:
Hi, could you assign to me?
assigned, please open a draft pr when you encounter issues

Fix patch:
diff --git a/crates/ethereum/primitives/src/receipt.rs b/crates/ethereum/primitives/src/receipt.rs
index 2fec1bf85a3d..e364a13aef20 100644
--- a/crates/ethereum/primitives/src/receipt.rs
+++ b/crates/ethereum/primitives/src/receipt.rs
@@ -193,6 +193,15 @@ impl InMemorySize for Receipt {
 
 impl reth_primitives_traits::Receipt for Receipt {}
 
+#[cfg(feature = "serde-bincode-compat")]
+impl reth_primitives_traits::serde_bincode_compat::SerdeBincodeCompat for Receipt {
+    type BincodeRepr<'a> = Self;
+
+    fn as_repr(&self) -> Self::BincodeRepr<'_> {
+        self.clone()
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;
diff --git a/crates/optimism/primitives/src/receipt.rs b/crates/optimism/primitives/src/receipt.rs
index 74f9a4e49f31..019095dbcc86 100644
--- a/crates/optimism/primitives/src/receipt.rs
+++ b/crates/optimism/primitives/src/receipt.rs
@@ -211,6 +211,15 @@ impl InMemorySize for OpReceipt {
 
 impl reth_primitives_traits::Receipt for OpReceipt {}
 
+#[cfg(feature = "serde-bincode-compat")]
+impl reth_primitives_traits::serde_bincode_compat::SerdeBincodeCompat for OpReceipt {
+    type BincodeRepr<'a> = Self;
+
+    fn as_repr(&self) -> Self::BincodeRepr<'_> {
+        self.clone()
+    }
+}
+
 /// Trait for deposit receipt.
 pub trait DepositReceipt: reth_primitives_traits::Receipt {
     /// Returns deposit receipt if it is a deposit transaction.
diff --git a/crates/primitives-traits/src/receipt.rs b/crates/primitives-traits/src/receipt.rs
index 7d4fa8902888..a8d632c35691 100644
--- a/crates/primitives-traits/src/receipt.rs
+++ b/crates/primitives-traits/src/receipt.rs
@@ -1,6 +1,6 @@
 //! Receipt abstraction
 
-use crate::{InMemorySize, MaybeCompact, MaybeSerde};
+use crate::{InMemorySize, MaybeCompact, MaybeSerde, MaybeSerdeBincodeCompat};
 use alloc::vec::Vec;
 use alloy_consensus::{
     Eip2718EncodableReceipt, RlpDecodableReceipt, RlpEncodableReceipt, TxReceipt, Typed2718,
@@ -27,6 +27,7 @@ pub trait Receipt:
     + Typed2718
     + MaybeSerde
     + InMemorySize
+    + MaybeSerdeBincodeCompat
 {
 }
 


Test patch:
diff --git a/crates/e2e-test-utils/Cargo.toml b/crates/e2e-test-utils/Cargo.toml
index 57610c77b7c6..1df1a20f8720 100644
--- a/crates/e2e-test-utils/Cargo.toml
+++ b/crates/e2e-test-utils/Cargo.toml
@@ -34,7 +34,7 @@ reth-engine-local.workspace = true
 reth-tasks.workspace = true
 
 # currently need to enable this for workspace level
-reth-optimism-primitives = { workspace = true, features = ["arbitrary", "serde"] }
+reth-optimism-primitives = { workspace = true, features = ["arbitrary", "serde", "serde-bincode-compat"] }
 
 # rpc
 jsonrpsee.workspace = true