Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return static Eip658Value from TxReceipt trait method #1394

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/consensus/src/receipt/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<T> AnyReceiptEnvelope<T> {
}

impl<T> TxReceipt<T> for AnyReceiptEnvelope<T> {
fn status_or_post_state(&self) -> &Eip658Value {
fn status_or_post_state(&self) -> Eip658Value {
self.inner.status_or_post_state()
}

Expand Down
6 changes: 3 additions & 3 deletions crates/consensus/src/receipt/envelope.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Receipt, ReceiptWithBloom, TxReceipt, TxType};
use crate::{Eip658Value, Receipt, ReceiptWithBloom, TxReceipt, TxType};
use alloy_eips::eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718};
use alloy_primitives::{Bloom, Log};
use alloy_rlp::{length_of_length, BufMut, Decodable, Encodable};
Expand Down Expand Up @@ -108,8 +108,8 @@ impl<T> ReceiptEnvelope<T> {
}

impl<T> TxReceipt<T> for ReceiptEnvelope<T> {
fn status_or_post_state(&self) -> &crate::Eip658Value {
&self.as_receipt().unwrap().status
fn status_or_post_state(&self) -> Eip658Value {
self.as_receipt().unwrap().status
}

fn status(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/receipt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait TxReceipt<T = Log> {
/// is pre-[EIP-658].
///
/// [EIP-658]: https://eips.ethereum.org/EIPS/eip-658
fn status_or_post_state(&self) -> &Eip658Value;
fn status_or_post_state(&self) -> Eip658Value;

/// Returns true if the transaction was successful OR if the transaction is
/// pre-[EIP-658]. Results for transactions before [EIP-658] are not
Expand Down
8 changes: 4 additions & 4 deletions crates/consensus/src/receipt/receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ impl<T> TxReceipt<T> for Receipt<T>
where
T: Borrow<Log>,
{
fn status_or_post_state(&self) -> &Eip658Value {
&self.status
fn status_or_post_state(&self) -> Eip658Value {
self.status
}

fn status(&self) -> bool {
Expand Down Expand Up @@ -159,8 +159,8 @@ pub struct ReceiptWithBloom<T = Log> {
}

impl<T> TxReceipt<T> for ReceiptWithBloom<T> {
fn status_or_post_state(&self) -> &Eip658Value {
&self.receipt.status
fn status_or_post_state(&self) -> Eip658Value {
self.receipt.status
}

fn status(&self) -> bool {
Expand Down