Skip to content

Commit

Permalink
fix: capitalization of struct names
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Oct 19, 2023
1 parent 33a5d0b commit 1f3e33c
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 63 deletions.
6 changes: 3 additions & 3 deletions crates/edr_eth/src/remote/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
access_list::AccessListItem,
signature::Signature,
transaction::{
EIP1559SignedTransaction, EIP155SignedTransaction, EIP2930SignedTransaction,
EIP155SignedTransaction, Eip1559SignedTransaction, Eip2930SignedTransaction,
Eip4844SignedTransaction, LegacySignedTransaction, SignedTransaction, TransactionKind,
},
withdrawal::Withdrawal,
Expand Down Expand Up @@ -175,7 +175,7 @@ impl TryFrom<Transaction> for (SignedTransaction, Address) {
})
}
}
1 => SignedTransaction::Eip2930(EIP2930SignedTransaction {
1 => SignedTransaction::Eip2930(Eip2930SignedTransaction {
odd_y_parity: value.odd_y_parity(),
chain_id: value
.chain_id
Expand All @@ -194,7 +194,7 @@ impl TryFrom<Transaction> for (SignedTransaction, Address) {
s: value.s,
hash: OnceLock::from(value.hash),
}),
2 => SignedTransaction::Eip1559(EIP1559SignedTransaction {
2 => SignedTransaction::Eip1559(Eip1559SignedTransaction {
odd_y_parity: value.odd_y_parity(),
chain_id: value
.chain_id
Expand Down
10 changes: 5 additions & 5 deletions crates/edr_eth/src/transaction/request/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use revm_primitives::{keccak256, B256, U256};
use crate::{
access_list::AccessListItem,
signature::{Signature, SignatureError},
transaction::{kind::TransactionKind, signed::EIP1559SignedTransaction},
transaction::{kind::TransactionKind, signed::Eip1559SignedTransaction},
utils::envelop_bytes,
};

Expand Down Expand Up @@ -36,12 +36,12 @@ impl EIP1559TransactionRequest {
keccak256(&envelop_bytes(2, &encoded))
}

pub fn sign(self, secret_key: &SecretKey) -> Result<EIP1559SignedTransaction, SignatureError> {
pub fn sign(self, secret_key: &SecretKey) -> Result<Eip1559SignedTransaction, SignatureError> {
let hash = self.hash();

let signature = Signature::new(hash, secret_key)?;

Ok(EIP1559SignedTransaction {
Ok(Eip1559SignedTransaction {
chain_id: self.chain_id,
nonce: self.nonce,
max_priority_fee_per_gas: self.max_priority_fee_per_gas,
Expand All @@ -59,8 +59,8 @@ impl EIP1559TransactionRequest {
}
}

impl From<&EIP1559SignedTransaction> for EIP1559TransactionRequest {
fn from(t: &EIP1559SignedTransaction) -> Self {
impl From<&Eip1559SignedTransaction> for EIP1559TransactionRequest {
fn from(t: &Eip1559SignedTransaction) -> Self {
Self {
chain_id: t.chain_id,
nonce: t.nonce,
Expand Down
10 changes: 5 additions & 5 deletions crates/edr_eth/src/transaction/request/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use revm_primitives::{keccak256, ruint::aliases::U64, B256, U256};
use crate::{
access_list::AccessListItem,
signature::{Signature, SignatureError},
transaction::{kind::TransactionKind, signed::EIP2930SignedTransaction},
transaction::{kind::TransactionKind, signed::Eip2930SignedTransaction},
utils::envelop_bytes,
};

Expand Down Expand Up @@ -36,12 +36,12 @@ impl EIP2930TransactionRequest {
}

/// Signs the transaction with the provided secret key.
pub fn sign(self, secret_key: &SecretKey) -> Result<EIP2930SignedTransaction, SignatureError> {
pub fn sign(self, secret_key: &SecretKey) -> Result<Eip2930SignedTransaction, SignatureError> {
let hash = self.hash();

let signature = Signature::new(hash, secret_key)?;

Ok(EIP2930SignedTransaction {
Ok(Eip2930SignedTransaction {
chain_id: self.chain_id,
nonce: self.nonce,
gas_price: self.gas_price,
Expand All @@ -58,8 +58,8 @@ impl EIP2930TransactionRequest {
}
}

impl From<&EIP2930SignedTransaction> for EIP2930TransactionRequest {
fn from(tx: &EIP2930SignedTransaction) -> Self {
impl From<&Eip2930SignedTransaction> for EIP2930TransactionRequest {
fn from(tx: &Eip2930SignedTransaction) -> Self {
Self {
chain_id: tx.chain_id,
nonce: tx.nonce,
Expand Down
14 changes: 7 additions & 7 deletions crates/edr_eth/src/transaction/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use crate::{
use super::kind::TransactionKind;

pub use self::{
eip155::EIP155SignedTransaction, eip1559::EIP1559SignedTransaction,
eip2930::EIP2930SignedTransaction, eip4844::Eip4844SignedTransaction,
eip155::EIP155SignedTransaction, eip1559::Eip1559SignedTransaction,
eip2930::Eip2930SignedTransaction, eip4844::Eip4844SignedTransaction,
legacy::LegacySignedTransaction,
};

Expand All @@ -29,9 +29,9 @@ pub enum SignedTransaction {
/// EIP-155 transaction
PostEip155Legacy(EIP155SignedTransaction),
/// EIP-2930 transaction
Eip2930(EIP2930SignedTransaction),
Eip2930(Eip2930SignedTransaction),
/// EIP-1559 transaction
Eip1559(EIP1559SignedTransaction),
Eip1559(Eip1559SignedTransaction),
/// EIP-4844 transaction
Eip4844(Eip4844SignedTransaction),
}
Expand Down Expand Up @@ -329,7 +329,7 @@ mod tests {
},
hash: OnceLock::new(),
}),
SignedTransaction::Eip2930(EIP2930SignedTransaction {
SignedTransaction::Eip2930(Eip2930SignedTransaction {
chain_id: 1,
nonce: 0,
gas_price: U256::from(1),
Expand All @@ -343,7 +343,7 @@ mod tests {
access_list: vec![].into(),
hash: OnceLock::new(),
}),
SignedTransaction::Eip1559(EIP1559SignedTransaction {
SignedTransaction::Eip1559(Eip1559SignedTransaction {
chain_id: 1u64,
nonce: 0,
max_priority_fee_per_gas: U256::from(1),
Expand Down Expand Up @@ -465,7 +465,7 @@ mod tests {
assert_eq!(expected, rlp::decode(&bytes_third).unwrap());

let bytes_fourth = hex::decode("02f872041a8459682f008459682f0d8252089461815774383099e24810ab832a5b2a5425c154d58829a2241af62c000080c001a059e6b67f48fb32e7e570dfb11e042b5ad2e55e3ce3ce9cd989c7e06e07feeafda0016b83f4f980694ed2eee4d10667242b1f40dc406901b34125b008d334d47469").unwrap();
let expected = SignedTransaction::Eip1559(EIP1559SignedTransaction {
let expected = SignedTransaction::Eip1559(Eip1559SignedTransaction {
chain_id: 4,
nonce: 26,
max_priority_fee_per_gas: U256::from(1500000000u64),
Expand Down
10 changes: 5 additions & 5 deletions crates/edr_eth/src/transaction/signed/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
derive(open_fastrlp::RlpEncodable, open_fastrlp::RlpDecodable)
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct EIP1559SignedTransaction {
pub struct Eip1559SignedTransaction {
#[cfg_attr(feature = "serde", serde(with = "crate::serde::u64"))]
pub chain_id: u64,
#[cfg_attr(feature = "serde", serde(with = "crate::serde::u64"))]
Expand All @@ -38,7 +38,7 @@ pub struct EIP1559SignedTransaction {
pub hash: OnceLock<B256>,
}

impl EIP1559SignedTransaction {
impl Eip1559SignedTransaction {
pub fn nonce(&self) -> &u64 {
&self.nonce
}
Expand All @@ -64,7 +64,7 @@ impl EIP1559SignedTransaction {
}
}

impl PartialEq for EIP1559SignedTransaction {
impl PartialEq for Eip1559SignedTransaction {
fn eq(&self, other: &Self) -> bool {
self.chain_id == other.chain_id
&& self.nonce == other.nonce
Expand All @@ -81,7 +81,7 @@ impl PartialEq for EIP1559SignedTransaction {
}
}

impl rlp::Encodable for EIP1559SignedTransaction {
impl rlp::Encodable for Eip1559SignedTransaction {
fn rlp_append(&self, s: &mut rlp::RlpStream) {
s.begin_list(12);
s.append(&U64::from(self.chain_id));
Expand All @@ -99,7 +99,7 @@ impl rlp::Encodable for EIP1559SignedTransaction {
}
}

impl rlp::Decodable for EIP1559SignedTransaction {
impl rlp::Decodable for Eip1559SignedTransaction {
fn decode(rlp: &rlp::Rlp<'_>) -> Result<Self, rlp::DecoderError> {
if rlp.item_count()? != 12 {
return Err(rlp::DecoderError::RlpIncorrectListLen);
Expand Down
10 changes: 5 additions & 5 deletions crates/edr_eth/src/transaction/signed/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
derive(open_fastrlp::RlpEncodable, open_fastrlp::RlpDecodable)
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct EIP2930SignedTransaction {
pub struct Eip2930SignedTransaction {
#[cfg_attr(feature = "serde", serde(with = "crate::serde::u64"))]
pub chain_id: u64,
#[cfg_attr(feature = "serde", serde(with = "crate::serde::u64"))]
Expand All @@ -37,7 +37,7 @@ pub struct EIP2930SignedTransaction {
pub hash: OnceLock<B256>,
}

impl EIP2930SignedTransaction {
impl Eip2930SignedTransaction {
pub fn nonce(&self) -> &u64 {
&self.nonce
}
Expand All @@ -63,7 +63,7 @@ impl EIP2930SignedTransaction {
}
}

impl PartialEq for EIP2930SignedTransaction {
impl PartialEq for Eip2930SignedTransaction {
fn eq(&self, other: &Self) -> bool {
self.chain_id == other.chain_id
&& self.nonce == other.nonce
Expand All @@ -79,7 +79,7 @@ impl PartialEq for EIP2930SignedTransaction {
}
}

impl rlp::Encodable for EIP2930SignedTransaction {
impl rlp::Encodable for Eip2930SignedTransaction {
fn rlp_append(&self, s: &mut rlp::RlpStream) {
s.begin_list(11);
s.append(&U64::from(self.chain_id));
Expand All @@ -96,7 +96,7 @@ impl rlp::Encodable for EIP2930SignedTransaction {
}
}

impl rlp::Decodable for EIP2930SignedTransaction {
impl rlp::Decodable for Eip2930SignedTransaction {
fn decode(rlp: &rlp::Rlp<'_>) -> Result<Self, rlp::DecoderError> {
if rlp.item_count()? != 11 {
return Err(rlp::DecoderError::RlpIncorrectListLen);
Expand Down
6 changes: 3 additions & 3 deletions crates/edr_evm/src/transaction/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::ops::Deref;

use edr_eth::{
transaction::{
EIP1559SignedTransaction, EIP155SignedTransaction, EIP2930SignedTransaction,
EIP155SignedTransaction, Eip1559SignedTransaction, Eip2930SignedTransaction,
Eip4844SignedTransaction, LegacySignedTransaction, SignedTransaction, TransactionKind,
},
Address, U256,
Expand Down Expand Up @@ -220,7 +220,7 @@ impl From<PendingTransaction> for TxEnv {
blob_hashes: Vec::new(),
max_fee_per_blob_gas: None,
},
SignedTransaction::Eip2930(EIP2930SignedTransaction {
SignedTransaction::Eip2930(Eip2930SignedTransaction {
nonce,
gas_price,
gas_limit,
Expand All @@ -243,7 +243,7 @@ impl From<PendingTransaction> for TxEnv {
blob_hashes: Vec::new(),
max_fee_per_blob_gas: None,
},
SignedTransaction::Eip1559(EIP1559SignedTransaction {
SignedTransaction::Eip1559(Eip1559SignedTransaction {
nonce,
max_priority_fee_per_gas,
max_fee_per_gas,
Expand Down
6 changes: 3 additions & 3 deletions crates/edr_evm_napi/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ export class Block {
/**Retrieves the block's header. */
get header(): BlockHeader
/**Retrieves the block's transactions. */
get transactions(): Array<LegacySignedTransaction | EIP2930SignedTransaction | EIP1559SignedTransaction | Eip4844SignedTransaction>
get transactions(): Array<LegacySignedTransaction | Eip2930SignedTransaction | Eip1559SignedTransaction | Eip4844SignedTransaction>
/**Retrieves the callers of the block's transactions */
get callers(): Array<Buffer>
/**Retrieves the transactions' receipts. */
Expand Down Expand Up @@ -678,9 +678,9 @@ export class OrderedTransaction {
}
export class PendingTransaction {
/** Tries to construct a new [`PendingTransaction`]. */
static create(stateManager: State, specId: SpecId, transaction: LegacySignedTransaction | EIP2930SignedTransaction | EIP1559SignedTransaction | Eip4844SignedTransaction, caller?: Buffer | undefined | null): Promise<PendingTransaction>
static create(stateManager: State, specId: SpecId, transaction: LegacySignedTransaction | Eip2930SignedTransaction | Eip1559SignedTransaction | Eip4844SignedTransaction, caller?: Buffer | undefined | null): Promise<PendingTransaction>
get caller(): Buffer
get transaction(): LegacySignedTransaction | EIP2930SignedTransaction | EIP1559SignedTransaction | Eip4844SignedTransaction
get transaction(): LegacySignedTransaction | Eip2930SignedTransaction | Eip1559SignedTransaction | Eip4844SignedTransaction
}
export class TransactionResult {
get result(): ExecutionResult
Expand Down
10 changes: 5 additions & 5 deletions crates/edr_evm_napi/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{
cast::TryCast,
receipt::Receipt,
transaction::signed::{
EIP1559SignedTransaction, EIP2930SignedTransaction, Eip4844SignedTransaction,
Eip1559SignedTransaction, Eip2930SignedTransaction, Eip4844SignedTransaction,
LegacySignedTransaction,
},
};
Expand Down Expand Up @@ -369,8 +369,8 @@ impl Block {
Vec<
Either4<
LegacySignedTransaction,
EIP2930SignedTransaction,
EIP1559SignedTransaction,
Eip2930SignedTransaction,
Eip1559SignedTransaction,
Eip4844SignedTransaction,
>,
>,
Expand All @@ -386,10 +386,10 @@ impl Block {
LegacySignedTransaction::from_eip155(&env, transaction).map(Either4::A)
}
edr_eth::transaction::SignedTransaction::Eip2930(transaction) => {
EIP2930SignedTransaction::new(&env, transaction).map(Either4::B)
Eip2930SignedTransaction::new(&env, transaction).map(Either4::B)
}
edr_eth::transaction::SignedTransaction::Eip1559(transaction) => {
EIP1559SignedTransaction::new(&env, transaction).map(Either4::C)
Eip1559SignedTransaction::new(&env, transaction).map(Either4::C)
}
edr_eth::transaction::SignedTransaction::Eip4844(transaction) => {
Eip4844SignedTransaction::new(&env, transaction).map(Either4::D)
Expand Down
14 changes: 7 additions & 7 deletions crates/edr_evm_napi/src/transaction/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use napi_derive::napi;
use crate::{cast::TryCast, config::SpecId, state::State};

use super::signed::{
EIP1559SignedTransaction, EIP2930SignedTransaction, Eip4844SignedTransaction,
Eip1559SignedTransaction, Eip2930SignedTransaction, Eip4844SignedTransaction,
LegacySignedTransaction,
};

Expand All @@ -38,8 +38,8 @@ impl PendingTransaction {
spec_id: SpecId,
transaction: Either4<
LegacySignedTransaction,
EIP2930SignedTransaction,
EIP1559SignedTransaction,
Eip2930SignedTransaction,
Eip1559SignedTransaction,
Eip4844SignedTransaction,
>,
caller: Option<Buffer>,
Expand Down Expand Up @@ -85,8 +85,8 @@ impl PendingTransaction {
// so manually do that here
Either4<
LegacySignedTransaction,
EIP2930SignedTransaction,
EIP1559SignedTransaction,
Eip2930SignedTransaction,
Eip1559SignedTransaction,
Eip4844SignedTransaction,
>,
> {
Expand All @@ -98,10 +98,10 @@ impl PendingTransaction {
LegacySignedTransaction::from_eip155(&env, transaction).map(Either4::A)
}
edr_eth::transaction::SignedTransaction::Eip2930(transaction) => {
EIP2930SignedTransaction::new(&env, transaction).map(Either4::B)
Eip2930SignedTransaction::new(&env, transaction).map(Either4::B)
}
edr_eth::transaction::SignedTransaction::Eip1559(transaction) => {
EIP1559SignedTransaction::new(&env, transaction).map(Either4::C)
Eip1559SignedTransaction::new(&env, transaction).map(Either4::C)
}
edr_eth::transaction::SignedTransaction::Eip4844(transaction) => {
Eip4844SignedTransaction::new(&env, transaction).map(Either4::D)
Expand Down
6 changes: 3 additions & 3 deletions crates/edr_evm_napi/src/transaction/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use napi::bindgen_prelude::Either4;
use crate::cast::TryCast;

pub use self::{
eip1559::EIP1559SignedTransaction, eip2930::EIP2930SignedTransaction,
eip1559::Eip1559SignedTransaction, eip2930::Eip2930SignedTransaction,
eip4844::Eip4844SignedTransaction, legacy::LegacySignedTransaction,
};

pub type SignedTransaction = Either4<
LegacySignedTransaction,
EIP2930SignedTransaction,
EIP1559SignedTransaction,
Eip2930SignedTransaction,
Eip1559SignedTransaction,
Eip4844SignedTransaction,
>;

Expand Down
Loading

0 comments on commit 1f3e33c

Please sign in to comment.