diff --git a/crates/contracts/src/account_contract.cairo b/crates/contracts/src/account_contract.cairo index 721e0284a..ba8358120 100644 --- a/crates/contracts/src/account_contract.cairo +++ b/crates/contracts/src/account_contract.cairo @@ -63,14 +63,13 @@ pub mod AccountContract { }; use core::starknet::syscalls::{call_contract_syscall, replace_class_syscall}; use core::starknet::{ - EthAddress, ClassHash, VALIDATED, get_caller_address, get_contract_address, get_tx_info, - get_block_timestamp + EthAddress, ClassHash, VALIDATED, get_caller_address, get_tx_info, get_block_timestamp }; use core::traits::TryInto; use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait}; use super::{IAccountLibraryDispatcher, IAccountDispatcherTrait, OutsideExecution}; use utils::constants::{POW_2_32}; - use utils::eth_transaction::transaction::{Transaction, TransactionTrait}; + use utils::eth_transaction::transaction::Transaction; use utils::eth_transaction::validation::validate_eth_tx; use utils::eth_transaction::{EthTransactionTrait, TransactionMetadata}; use utils::serialization::{deserialize_signature, deserialize_bytes, serialize_bytes}; @@ -233,13 +232,18 @@ pub mod AccountContract { .expect('conversion failed') .span(); - let chain_id: u64 = tx_info.chain_id.try_into().unwrap() % POW_2_32.try_into().unwrap(); + let _chain_id: u64 = tx_info + .chain_id + .try_into() + .unwrap() % POW_2_32 + .try_into() + .unwrap(); //TODO: add a type for unsigned transaction let unsigned_transaction = EthTransactionTrait::decode( encoded_tx_data, Default::default() ) - .expect('EOA: couldnt decode tx'); + .expect('EOA: could not decode tx'); //TODO: validate as part of execute_from_outside // let tx = EthTransactionTrait::decode(encoded_tx).expect('rlp decoding of tx failed'); @@ -338,7 +342,7 @@ pub mod AccountContract { .expect('conversion to Span failed') .span(); let signed_transaction = EthTransactionTrait::decode(encoded_tx_data, signature) - .expect('couldnt decode tx'); + .expect('could not decode tx'); // TODO(execute-from-outside): move validation to KakarotCore let tx_metadata = TransactionMetadata { address: self.Account_evm_address.read(), diff --git a/crates/contracts/src/kakarot_core/interface.cairo b/crates/contracts/src/kakarot_core/interface.cairo index 738f508c5..7addae72e 100644 --- a/crates/contracts/src/kakarot_core/interface.cairo +++ b/crates/contracts/src/kakarot_core/interface.cairo @@ -1,5 +1,5 @@ use core::starknet::{ContractAddress, EthAddress, ClassHash}; -use utils::eth_transaction::transaction::{Transaction, TransactionTrait}; +use utils::eth_transaction::transaction::Transaction; #[starknet::interface] pub trait IKakarotCore { diff --git a/crates/contracts/src/test_utils.cairo b/crates/contracts/src/test_utils.cairo index 246c1026a..e391d35fa 100644 --- a/crates/contracts/src/test_utils.cairo +++ b/crates/contracts/src/test_utils.cairo @@ -15,7 +15,6 @@ use snforge_std::{ stop_cheat_caller_address, start_cheat_caller_address_global }; use utils::constants::BLOCK_GAS_LIMIT; -use utils::eth_transaction::common::{TxKind, TxKindTrait}; use utils::eth_transaction::legacy::TxLegacy; diff --git a/crates/contracts/tests/test_execution_from_outside.cairo b/crates/contracts/tests/test_execution_from_outside.cairo index defa72b8f..98a126fa3 100644 --- a/crates/contracts/tests/test_execution_from_outside.cairo +++ b/crates/contracts/tests/test_execution_from_outside.cairo @@ -276,7 +276,7 @@ fn test_execute_from_outside_invalid_signature() { } #[test] -#[should_panic(expected: 'EOA: couldnt decode tx')] +#[should_panic(expected: 'EOA: could not decode tx')] fn test_execute_from_outside_invalid_tx() { let (kakarot_core, contract_account) = set_up(); diff --git a/crates/evm/src/gas.cairo b/crates/evm/src/gas.cairo index 76361b00b..8819d7d65 100644 --- a/crates/evm/src/gas.cairo +++ b/crates/evm/src/gas.cairo @@ -1,5 +1,5 @@ use core::cmp::min; -use utils::eth_transaction::common::{TxKind, TxKindTrait}; +use utils::eth_transaction::common::TxKindTrait; use utils::eth_transaction::eip2930::{AccessListItem}; use utils::eth_transaction::transaction::{Transaction, TransactionTrait}; use utils::helpers; @@ -266,11 +266,9 @@ mod tests { ACCESS_LIST_STORAGE_KEY }; use evm::test_utils::evm_address; - use utils::eth_transaction::common::{TxKind, TxKindTrait}; - use utils::eth_transaction::eip1559::TxEip1559; use utils::eth_transaction::eip2930::{AccessListItem, TxEip2930}; use utils::eth_transaction::legacy::TxLegacy; - use utils::eth_transaction::transaction::{Transaction, TransactionTrait}; + use utils::eth_transaction::transaction::Transaction; use utils::helpers::ToBytes; #[test] diff --git a/crates/utils/src/eth_transaction.cairo b/crates/utils/src/eth_transaction.cairo index e0c654fad..79a5eae3e 100644 --- a/crates/utils/src/eth_transaction.cairo +++ b/crates/utils/src/eth_transaction.cairo @@ -13,10 +13,10 @@ use core::option::OptionTrait; use core::starknet::{EthAddress, secp256_trait::Signature,}; use core::traits::TryInto; use crate::eth_transaction::common::TxKind; -use eip1559::{TxEip1559, TxEip1559Trait}; -use eip2930::{TxEip2930, TxEip2930Trait}; +use eip1559::TxEip1559Trait; +use eip2930::TxEip2930Trait; use legacy::TxLegacy; -use transaction::{Transaction, TransactionSigned, TransactionTrait}; +use transaction::{Transaction, TransactionSigned}; use tx_type::TxType; use utils::errors::{ RLPErrorTrait, EthTransactionError, RLPError, RLPErrorImpl, RLPHelpersErrorImpl, @@ -302,19 +302,14 @@ fn get_effective_gas_price( #[cfg(test)] mod tests { use core::option::OptionTrait; - use core::starknet::EthAddress; - use core::starknet::secp256_trait::{Signature}; use crate::eth_transaction::eip2930::AccessListItem; use crate::eth_transaction::tx_type::TxType; use crate::traits::DefaultSignature; use evm::test_utils::chain_id; - use utils::eth_transaction::transaction::{Transaction, TransactionSigned, TransactionTrait}; + use utils::eth_transaction::transaction::TransactionTrait; - use utils::eth_transaction::{ - EthTransactionTrait, EncodedTransactionTrait, TransactionMetadata, EthTransactionError - }; - use utils::helpers::{U256Trait, ToBytes}; - use utils::rlp::{RLPTrait, RLPItem, RLPHelpersTrait}; + use utils::eth_transaction::{EthTransactionTrait, EncodedTransactionTrait}; + use utils::helpers::ToBytes; use utils::test_data::{ legacy_rlp_encoded_tx, legacy_rlp_encoded_deploy_tx, eip_2930_encoded_tx, eip_1559_encoded_tx diff --git a/crates/utils/src/eth_transaction/eip1559.cairo b/crates/utils/src/eth_transaction/eip1559.cairo index 0a3b0c6a8..f588cc488 100644 --- a/crates/utils/src/eth_transaction/eip1559.cairo +++ b/crates/utils/src/eth_transaction/eip1559.cairo @@ -2,7 +2,7 @@ use core::num::traits::SaturatingSub; use crate::errors::{EthTransactionError, RLPError, RLPHelpersErrorTrait}; use crate::eth_transaction::common::TxKind; use crate::eth_transaction::eip2930::AccessListItem; -use crate::rlp::{RLPItem, RLPHelpersTrait, RLPTrait}; +use crate::rlp::{RLPItem, RLPHelpersTrait}; use crate::traits::SpanDefault; /// A transaction with a priority fee ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)). diff --git a/crates/utils/src/eth_transaction/eip2930.cairo b/crates/utils/src/eth_transaction/eip2930.cairo index 8108b7e32..09d0400b7 100644 --- a/crates/utils/src/eth_transaction/eip2930.cairo +++ b/crates/utils/src/eth_transaction/eip2930.cairo @@ -1,7 +1,7 @@ use core::starknet::EthAddress; use crate::errors::{EthTransactionError, RLPError, RLPHelpersErrorTrait}; use crate::eth_transaction::common::TxKind; -use crate::rlp::{RLPItem, RLPHelpersTrait, RLPTrait}; +use crate::rlp::{RLPItem, RLPHelpersTrait}; use crate::traits::SpanDefault; diff --git a/crates/utils/src/eth_transaction/validation.cairo b/crates/utils/src/eth_transaction/validation.cairo index 740a632b6..f59fa1cdd 100644 --- a/crates/utils/src/eth_transaction/validation.cairo +++ b/crates/utils/src/eth_transaction/validation.cairo @@ -1,5 +1,5 @@ use core::starknet::eth_signature::verify_eth_signature; -use crate::eth_transaction::transaction::{Transaction, TransactionSigned, TransactionTrait}; +use crate::eth_transaction::transaction::TransactionTrait; use crate::eth_transaction::{TransactionMetadata, EthTransactionError, EthTransactionTrait}; /// Validate an Ethereum transaction