Skip to content

Commit

Permalink
bet
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Oct 15, 2024
1 parent 5e38613 commit f9d6372
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions crates/primitives/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ use derive_more::{DerefMut, From, IntoIterator};
use reth_codecs::{Compact, CompactZstd};
use serde::{Deserialize, Serialize};

pub trait Encodable2718: Encodable {
fn encode_envelope(&self, out: &mut dyn BufMut);
fn envelope_length(&self) -> usize;
}

/// Receipt containing result of transaction execution.
#[derive(
Clone, Debug, PartialEq, Eq, Default, RlpEncodable, RlpDecodable, Serialize, Deserialize,
Expand Down Expand Up @@ -205,14 +210,6 @@ impl<'a> arbitrary::Arbitrary<'a> for Receipt {
}

impl ReceiptWithBloom {
/// Returns the enveloped encoded receipt.
///
/// See also [`ReceiptWithBloom::encode_enveloped`]
pub fn envelope_encoded(&self) -> Bytes {
let mut buf = Vec::new();
self.encode_enveloped(&mut buf);
buf.into()
}

/// Encodes the receipt into its "raw" format.
/// This format is also referred to as "binary" encoding.
Expand Down Expand Up @@ -289,6 +286,16 @@ impl ReceiptWithBloom {
}
}

impl Encodable2718 for ReceiptWithBloom {
fn encode_envelope(&self, out: &mut dyn BufMut) {
self.encode_enveloped(out)
}

fn envelope_length(&self) -> usize {
self.as_encoder().length()
}
}

impl Encodable for ReceiptWithBloom {
fn encode(&self, out: &mut dyn BufMut) {
self.encode_inner(out, true)
Expand Down

0 comments on commit f9d6372

Please sign in to comment.