Skip to content

Commit

Permalink
refactor: change input output to Bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
prestwich committed Oct 15, 2024
1 parent ff07988 commit 2fdd473
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl Transaction for TxEip1559 {
self.value
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
&self.input
}

Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl Transaction for TxEip2930 {
self.value
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
&self.input
}

Expand Down
10 changes: 5 additions & 5 deletions crates/consensus/src/transaction/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ impl Transaction for TxEip4844Variant {
}
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
match self {
Self::TxEip4844(tx) => tx.input.as_ref(),
Self::TxEip4844WithSidecar(tx) => tx.tx().input.as_ref(),
Self::TxEip4844(tx) => tx.input(),
Self::TxEip4844WithSidecar(tx) => tx.tx().input(),
}
}

Expand Down Expand Up @@ -725,7 +725,7 @@ impl Transaction for TxEip4844 {
self.value
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
&self.input
}

Expand Down Expand Up @@ -998,7 +998,7 @@ impl Transaction for TxEip4844WithSidecar {
self.tx.value()
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
self.tx.input()
}

Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/eip7702.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl Transaction for TxEip7702 {
self.value
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
&self.input
}

Expand Down
4 changes: 2 additions & 2 deletions crates/consensus/src/transaction/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use alloy_eips::{
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
eip2930::AccessList,
};
use alloy_primitives::{TxKind, B256};
use alloy_primitives::{Bytes, TxKind, B256};
use alloy_rlp::{Decodable, Encodable, Header};

use crate::transaction::eip4844::{TxEip4844, TxEip4844Variant, TxEip4844WithSidecar};
Expand Down Expand Up @@ -467,7 +467,7 @@ impl Transaction for TxEnvelope {
}
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
match self {
Self::Legacy(tx) => tx.tx().input(),
Self::Eip2930(tx) => tx.tx().input(),
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/transaction/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl Transaction for TxLegacy {
self.value
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
&self.input
}

Expand Down
6 changes: 3 additions & 3 deletions crates/consensus/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::Signed;
use alloc::vec::Vec;
use alloy_eips::{eip2930::AccessList, eip7702::SignedAuthorization};
use alloy_primitives::{keccak256, Address, ChainId, TxKind, B256, U256};
use alloy_primitives::{keccak256, Address, Bytes, ChainId, TxKind, B256, U256};
use core::any;

mod eip1559;
Expand Down Expand Up @@ -124,7 +124,7 @@ pub trait Transaction: any::Any + Send + Sync + 'static {
fn value(&self) -> U256;

/// Get `data`.
fn input(&self) -> &[u8];
fn input(&self) -> &Bytes;

/// Returns the transaction type
fn ty(&self) -> u8;
Expand Down Expand Up @@ -259,7 +259,7 @@ impl<T: Transaction> Transaction for alloy_serde::WithOtherFields<T> {
self.inner.value()
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
self.inner.input()
}

Expand Down
4 changes: 2 additions & 2 deletions crates/consensus/src/transaction/typed.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_eips::{eip2930::AccessList, eip7702::SignedAuthorization};
use alloy_primitives::{ChainId, TxKind, B256};
use alloy_primitives::{Bytes, ChainId, TxKind, B256};

use crate::{
transaction::eip4844::{TxEip4844, TxEip4844Variant, TxEip4844WithSidecar},
Expand Down Expand Up @@ -236,7 +236,7 @@ impl Transaction for TypedTransaction {
}
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
match self {
Self::Legacy(tx) => tx.input(),
Self::Eip2930(tx) => tx.input(),
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-types-eth/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl alloy_consensus::Transaction for Transaction {
self.value
}

fn input(&self) -> &[u8] {
fn input(&self) -> &Bytes {
&self.input
}

Expand Down

0 comments on commit 2fdd473

Please sign in to comment.