Skip to content

Commit

Permalink
feat: add eip4844 tx type id
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jul 26, 2023
1 parent d5ea168 commit a291875
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::mem;

use crate::{
compression::{TRANSACTION_COMPRESSOR, TRANSACTION_DECOMPRESSOR},
keccak256, Address, Bytes, ChainId, TxHash, H256,
Expand All @@ -15,6 +13,7 @@ use reth_rlp::{
};
use serde::{Deserialize, Serialize};
pub use signature::Signature;
use std::mem;
pub use tx_type::{TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, LEGACY_TX_TYPE_ID};

mod access_list;
Expand Down Expand Up @@ -268,7 +267,9 @@ pub struct TxEip4844 {
pub blob_hashes: Vec<H256>,

/// Max fee per data gas
pub max_fee_per_blob: u128,
///
/// aka BlobFeeCap
pub max_fee_per_data_gas: u128,

/// Input has two uses depending if transaction is Create or Call (if `to` field is None or
/// Some). pub init: An unlimited size byte array specifying the
Expand All @@ -292,7 +293,7 @@ impl TxEip4844 {
self.access_list.size() + // access_list
self.input.len() + // input
self.blob_hashes.capacity() * mem::size_of::<H256>() + // blob hashes size
mem::size_of::<u128>() // blob fee cap
mem::size_of::<u128>() // max_fee_per_data_gas
}
}

Expand Down
3 changes: 3 additions & 0 deletions crates/primitives/src/transaction/tx_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub const EIP2930_TX_TYPE_ID: u8 = 1;
/// Identifier for [TxEip1559](crate::TxEip1559) transaction.
pub const EIP1559_TX_TYPE_ID: u8 = 2;

/// Identifier for [TxEip4844](crate::TxEip4844) transaction.
pub(crate) const EIP4844_TX_TYPE_ID: u8 = 3;

Check failure on line 16 in crates/primitives/src/transaction/tx_type.rs

View workflow job for this annotation

GitHub Actions / clippy

constant `EIP4844_TX_TYPE_ID` is never used

error: constant `EIP4844_TX_TYPE_ID` is never used --> crates/primitives/src/transaction/tx_type.rs:16:18 | 16 | pub(crate) const EIP4844_TX_TYPE_ID: u8 = 3; | ^^^^^^^^^^^^^^^^^^ | = note: `-D dead-code` implied by `-D warnings`

/// Transaction Type
#[derive_arbitrary(compact)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Serialize, Deserialize)]
Expand Down

0 comments on commit a291875

Please sign in to comment.