diff --git a/crates/edr_eth/src/remote/eth.rs b/crates/edr_eth/src/remote/eth.rs index ac6e88c14b..c9b91a3ef6 100644 --- a/crates/edr_eth/src/remote/eth.rs +++ b/crates/edr_eth/src/remote/eth.rs @@ -15,7 +15,7 @@ use crate::{ access_list::AccessListItem, signature::Signature, transaction::{ - EIP1559SignedTransaction, EIP155SignedTransaction, EIP2930SignedTransaction, + EIP155SignedTransaction, Eip1559SignedTransaction, Eip2930SignedTransaction, Eip4844SignedTransaction, LegacySignedTransaction, SignedTransaction, TransactionKind, }, withdrawal::Withdrawal, @@ -175,7 +175,7 @@ impl TryFrom for (SignedTransaction, Address) { }) } } - 1 => SignedTransaction::Eip2930(EIP2930SignedTransaction { + 1 => SignedTransaction::Eip2930(Eip2930SignedTransaction { odd_y_parity: value.odd_y_parity(), chain_id: value .chain_id @@ -194,7 +194,7 @@ impl TryFrom 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 diff --git a/crates/edr_eth/src/transaction/request/eip1559.rs b/crates/edr_eth/src/transaction/request/eip1559.rs index 70c5877eef..262aacd494 100644 --- a/crates/edr_eth/src/transaction/request/eip1559.rs +++ b/crates/edr_eth/src/transaction/request/eip1559.rs @@ -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, }; @@ -36,12 +36,12 @@ impl EIP1559TransactionRequest { keccak256(&envelop_bytes(2, &encoded)) } - pub fn sign(self, secret_key: &SecretKey) -> Result { + pub fn sign(self, secret_key: &SecretKey) -> Result { 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, @@ -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, diff --git a/crates/edr_eth/src/transaction/request/eip2930.rs b/crates/edr_eth/src/transaction/request/eip2930.rs index 260af9e375..a30cd87918 100644 --- a/crates/edr_eth/src/transaction/request/eip2930.rs +++ b/crates/edr_eth/src/transaction/request/eip2930.rs @@ -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, }; @@ -36,12 +36,12 @@ impl EIP2930TransactionRequest { } /// Signs the transaction with the provided secret key. - pub fn sign(self, secret_key: &SecretKey) -> Result { + pub fn sign(self, secret_key: &SecretKey) -> Result { 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, @@ -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, diff --git a/crates/edr_eth/src/transaction/signed.rs b/crates/edr_eth/src/transaction/signed.rs index 5dee94d098..f270876bfe 100644 --- a/crates/edr_eth/src/transaction/signed.rs +++ b/crates/edr_eth/src/transaction/signed.rs @@ -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, }; @@ -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), } @@ -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), @@ -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), @@ -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), diff --git a/crates/edr_eth/src/transaction/signed/eip1559.rs b/crates/edr_eth/src/transaction/signed/eip1559.rs index 568f5ad18e..246f0e27e3 100644 --- a/crates/edr_eth/src/transaction/signed/eip1559.rs +++ b/crates/edr_eth/src/transaction/signed/eip1559.rs @@ -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"))] @@ -38,7 +38,7 @@ pub struct EIP1559SignedTransaction { pub hash: OnceLock, } -impl EIP1559SignedTransaction { +impl Eip1559SignedTransaction { pub fn nonce(&self) -> &u64 { &self.nonce } @@ -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 @@ -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)); @@ -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 { if rlp.item_count()? != 12 { return Err(rlp::DecoderError::RlpIncorrectListLen); diff --git a/crates/edr_eth/src/transaction/signed/eip2930.rs b/crates/edr_eth/src/transaction/signed/eip2930.rs index 667dba2a57..52cdbca645 100644 --- a/crates/edr_eth/src/transaction/signed/eip2930.rs +++ b/crates/edr_eth/src/transaction/signed/eip2930.rs @@ -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"))] @@ -37,7 +37,7 @@ pub struct EIP2930SignedTransaction { pub hash: OnceLock, } -impl EIP2930SignedTransaction { +impl Eip2930SignedTransaction { pub fn nonce(&self) -> &u64 { &self.nonce } @@ -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 @@ -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)); @@ -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 { if rlp.item_count()? != 11 { return Err(rlp::DecoderError::RlpIncorrectListLen); diff --git a/crates/edr_evm/src/transaction/pending.rs b/crates/edr_evm/src/transaction/pending.rs index 8efd3deb45..fb13660b4a 100644 --- a/crates/edr_evm/src/transaction/pending.rs +++ b/crates/edr_evm/src/transaction/pending.rs @@ -2,7 +2,7 @@ use std::ops::Deref; use edr_eth::{ transaction::{ - EIP1559SignedTransaction, EIP155SignedTransaction, EIP2930SignedTransaction, + EIP155SignedTransaction, Eip1559SignedTransaction, Eip2930SignedTransaction, Eip4844SignedTransaction, LegacySignedTransaction, SignedTransaction, TransactionKind, }, Address, U256, @@ -220,7 +220,7 @@ impl From for TxEnv { blob_hashes: Vec::new(), max_fee_per_blob_gas: None, }, - SignedTransaction::Eip2930(EIP2930SignedTransaction { + SignedTransaction::Eip2930(Eip2930SignedTransaction { nonce, gas_price, gas_limit, @@ -243,7 +243,7 @@ impl From 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, diff --git a/crates/edr_evm_napi/index.d.ts b/crates/edr_evm_napi/index.d.ts index 4818894b03..4b3cbf6fbd 100644 --- a/crates/edr_evm_napi/index.d.ts +++ b/crates/edr_evm_napi/index.d.ts @@ -481,7 +481,7 @@ export class Block { /**Retrieves the block's header. */ get header(): BlockHeader /**Retrieves the block's transactions. */ - get transactions(): Array + get transactions(): Array /**Retrieves the callers of the block's transactions */ get callers(): Array /**Retrieves the transactions' receipts. */ @@ -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 + static create(stateManager: State, specId: SpecId, transaction: LegacySignedTransaction | Eip2930SignedTransaction | Eip1559SignedTransaction | Eip4844SignedTransaction, caller?: Buffer | undefined | null): Promise get caller(): Buffer - get transaction(): LegacySignedTransaction | EIP2930SignedTransaction | EIP1559SignedTransaction | Eip4844SignedTransaction + get transaction(): LegacySignedTransaction | Eip2930SignedTransaction | Eip1559SignedTransaction | Eip4844SignedTransaction } export class TransactionResult { get result(): ExecutionResult diff --git a/crates/edr_evm_napi/src/block.rs b/crates/edr_evm_napi/src/block.rs index 50b215204f..9aef244bd6 100644 --- a/crates/edr_evm_napi/src/block.rs +++ b/crates/edr_evm_napi/src/block.rs @@ -14,7 +14,7 @@ use crate::{ cast::TryCast, receipt::Receipt, transaction::signed::{ - EIP1559SignedTransaction, EIP2930SignedTransaction, Eip4844SignedTransaction, + Eip1559SignedTransaction, Eip2930SignedTransaction, Eip4844SignedTransaction, LegacySignedTransaction, }, }; @@ -369,8 +369,8 @@ impl Block { Vec< Either4< LegacySignedTransaction, - EIP2930SignedTransaction, - EIP1559SignedTransaction, + Eip2930SignedTransaction, + Eip1559SignedTransaction, Eip4844SignedTransaction, >, >, @@ -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) diff --git a/crates/edr_evm_napi/src/transaction/pending.rs b/crates/edr_evm_napi/src/transaction/pending.rs index 14624aa89d..a5ae57edd2 100644 --- a/crates/edr_evm_napi/src/transaction/pending.rs +++ b/crates/edr_evm_napi/src/transaction/pending.rs @@ -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, }; @@ -38,8 +38,8 @@ impl PendingTransaction { spec_id: SpecId, transaction: Either4< LegacySignedTransaction, - EIP2930SignedTransaction, - EIP1559SignedTransaction, + Eip2930SignedTransaction, + Eip1559SignedTransaction, Eip4844SignedTransaction, >, caller: Option, @@ -85,8 +85,8 @@ impl PendingTransaction { // so manually do that here Either4< LegacySignedTransaction, - EIP2930SignedTransaction, - EIP1559SignedTransaction, + Eip2930SignedTransaction, + Eip1559SignedTransaction, Eip4844SignedTransaction, >, > { @@ -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) diff --git a/crates/edr_evm_napi/src/transaction/signed.rs b/crates/edr_evm_napi/src/transaction/signed.rs index 4299395593..7e12041e83 100644 --- a/crates/edr_evm_napi/src/transaction/signed.rs +++ b/crates/edr_evm_napi/src/transaction/signed.rs @@ -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, >; diff --git a/crates/edr_evm_napi/src/transaction/signed/eip1559.rs b/crates/edr_evm_napi/src/transaction/signed/eip1559.rs index bc76044ab8..d0fb9c4499 100644 --- a/crates/edr_evm_napi/src/transaction/signed/eip1559.rs +++ b/crates/edr_evm_napi/src/transaction/signed/eip1559.rs @@ -10,7 +10,7 @@ use napi_derive::napi; use crate::{access_list::AccessListItem, cast::TryCast}; #[napi(object)] -pub struct EIP1559SignedTransaction { +pub struct Eip1559SignedTransaction { pub chain_id: BigInt, pub nonce: BigInt, pub max_priority_fee_per_gas: BigInt, @@ -27,11 +27,11 @@ pub struct EIP1559SignedTransaction { pub s: BigInt, } -impl EIP1559SignedTransaction { - /// Constructs a [`EIP1559SignedTransaction`] instance. +impl Eip1559SignedTransaction { + /// Constructs an instance. pub fn new( env: &Env, - transaction: &edr_eth::transaction::EIP1559SignedTransaction, + transaction: &edr_eth::transaction::Eip1559SignedTransaction, ) -> napi::Result { let input = transaction.input.clone(); let input = unsafe { @@ -87,10 +87,10 @@ impl EIP1559SignedTransaction { } } -impl TryFrom for edr_eth::transaction::EIP1559SignedTransaction { +impl TryFrom for edr_eth::transaction::Eip1559SignedTransaction { type Error = napi::Error; - fn try_from(value: EIP1559SignedTransaction) -> Result { + fn try_from(value: Eip1559SignedTransaction) -> Result { Ok(Self { chain_id: value.chain_id.try_cast()?, nonce: value.nonce.try_cast()?, diff --git a/crates/edr_evm_napi/src/transaction/signed/eip2930.rs b/crates/edr_evm_napi/src/transaction/signed/eip2930.rs index ae9a243080..2602543495 100644 --- a/crates/edr_evm_napi/src/transaction/signed/eip2930.rs +++ b/crates/edr_evm_napi/src/transaction/signed/eip2930.rs @@ -10,7 +10,7 @@ use napi_derive::napi; use crate::{access_list::AccessListItem, cast::TryCast}; #[napi(object)] -pub struct EIP2930SignedTransaction { +pub struct Eip2930SignedTransaction { pub chain_id: BigInt, pub nonce: BigInt, pub gas_price: BigInt, @@ -26,11 +26,11 @@ pub struct EIP2930SignedTransaction { pub s: BigInt, } -impl EIP2930SignedTransaction { - /// Constructs a [`EIP2930SignedTransaction`] instance. +impl Eip2930SignedTransaction { + /// Constructs an instance. pub fn new( env: &Env, - transaction: &edr_eth::transaction::EIP2930SignedTransaction, + transaction: &edr_eth::transaction::Eip2930SignedTransaction, ) -> napi::Result { let input = transaction.input.clone(); let input = unsafe { @@ -82,10 +82,10 @@ impl EIP2930SignedTransaction { } } -impl TryFrom for edr_eth::transaction::EIP2930SignedTransaction { +impl TryFrom for edr_eth::transaction::Eip2930SignedTransaction { type Error = napi::Error; - fn try_from(value: EIP2930SignedTransaction) -> Result { + fn try_from(value: Eip2930SignedTransaction) -> Result { Ok(Self { chain_id: value.chain_id.try_cast()?, nonce: value.nonce.try_cast()?,