mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
32 lines
1.0 KiB
Rust
32 lines
1.0 KiB
Rust
use crate::node::primitives::TransactionSigned;
|
|
use alloy_evm::eth::receipt_builder::{ReceiptBuilder, ReceiptBuilderCtx};
|
|
use reth_codecs::alloy::transaction::Envelope;
|
|
use reth_evm::Evm;
|
|
use reth_primitives::Receipt;
|
|
|
|
/// A builder that operates on Reth primitive types, specifically [`TransactionSigned`] and
|
|
/// [`Receipt`].
|
|
#[derive(Debug, Clone, Copy, Default)]
|
|
#[non_exhaustive]
|
|
pub struct RethReceiptBuilder;
|
|
|
|
impl ReceiptBuilder for RethReceiptBuilder {
|
|
type Transaction = TransactionSigned;
|
|
type Receipt = Receipt;
|
|
|
|
fn build_receipt<E: Evm>(
|
|
&self,
|
|
ctx: ReceiptBuilderCtx<'_, Self::Transaction, E>,
|
|
) -> Self::Receipt {
|
|
let ReceiptBuilderCtx { tx, result, cumulative_gas_used, .. } = ctx;
|
|
Receipt {
|
|
tx_type: tx.tx_type(),
|
|
// Success flag was added in `EIP-658: Embedding transaction status code in
|
|
// receipts`.
|
|
success: result.is_success(),
|
|
cumulative_gas_used,
|
|
logs: result.into_logs(),
|
|
}
|
|
}
|
|
}
|