diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index de6a106f6..26cdbfe51 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -6,7 +6,7 @@ cli: plugins: sources: - id: trunk - ref: v1.2.6 + ref: v1.3.0 uri: https://github.com/trunk-io/plugins runtimes: enabled: @@ -16,21 +16,21 @@ runtimes: lint: enabled: - actionlint@1.6.26 - - checkov@3.0.32 + - checkov@3.1.9 - clippy@1.65.0 - git-diff-check - hadolint@2.12.0 - markdownlint@0.37.0 - osv-scanner@1.4.3 - oxipng@9.0.0 - - prettier@3.0.3 + - prettier@3.1.0 - rustfmt@1.65.0 - shellcheck@0.9.0 - shfmt@3.6.0 - taplo@0.8.1 - - terrascan@1.18.3 + - terrascan@1.18.5 - trivy@0.47.0 - - trufflehog@3.62.1 + - trufflehog@3.63.2-rc0 - yamllint@1.33.0 actions: disabled: diff --git a/Cargo.toml b/Cargo.toml index 7c2ea0444..6a9a1097f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,8 +47,8 @@ serde_with = "2.3.1" anyhow = "1.0.68" async-trait = "0.1.58" ctor = "0.2.4" -eyre = "0.6.8" dotenv = "0.15.0" +eyre = "0.6.8" git2 = "0.18.0" lazy_static = "1.4.0" pin-project = "1.1.2" diff --git a/crates/core/src/client/errors.rs b/crates/core/src/client/errors.rs index 5eb88746b..d52f3acb4 100644 --- a/crates/core/src/client/errors.rs +++ b/crates/core/src/client/errors.rs @@ -84,8 +84,8 @@ pub enum EthApiError { Other(#[from] anyhow::Error), } -impl From> for EthApiError { - fn from(err: ConversionError) -> Self { +impl From for EthApiError { + fn from(err: ConversionError) -> Self { Self::ConversionError(err.to_string()) } } diff --git a/crates/core/src/client/helpers.rs b/crates/core/src/client/helpers.rs index 4aff1b561..e38b6fb7b 100644 --- a/crates/core/src/client/helpers.rs +++ b/crates/core/src/client/helpers.rs @@ -26,7 +26,7 @@ struct InvalidFieldElementError; impl std::error::Error for InvalidFieldElementError {} impl std::fmt::Display for InvalidFieldElementError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "Invalid FieldElement") } } @@ -47,7 +47,7 @@ pub fn decode_eth_call_return(call_result: &[FieldElement]) -> Result::Other(e.to_string()))?; + return_data_len.try_into().map_err(|e: ValueOutOfRangeError| ConversionError::Other(e.to_string()))?; let return_data = call_result.get(1..).ok_or_else(|| DataDecodingError::InvalidReturnArrayLength { entrypoint: "eth_call or eth_send_transaction".into(), diff --git a/crates/core/src/client/mod.rs b/crates/core/src/client/mod.rs index 8f0ee72e1..625ff68c5 100644 --- a/crates/core/src/client/mod.rs +++ b/crates/core/src/client/mod.rs @@ -38,9 +38,6 @@ use crate::contracts::erc20::starknet_erc20::StarknetErc20; use crate::contracts::kakarot_contract::KakarotContract; use crate::models::balance::{FutureTokenBalance, TokenBalances}; use crate::models::block::{BlockWithTxHashes, BlockWithTxs, EthBlockId}; -use crate::models::convertible::{ - ConvertibleSignedTransaction, ConvertibleStarknetBlock, ConvertibleStarknetTransaction, -}; use crate::models::errors::ConversionError; use crate::models::felt::Felt252Wrapper; use crate::models::transaction::transaction::{StarknetTransaction, StarknetTransactions}; @@ -54,13 +51,13 @@ use crate::contracts::kakarot_contract::KakarotCoreReader; abigen_legacy!(ContractAccount, "./artifacts/contract_account.json"); abigen_legacy!(Proxy, "./artifacts/proxy.json"); -pub struct KakarotClient { +pub struct KakarotClient { starknet_provider: Arc

, kakarot_contract: KakarotContract

, network: Network, } -impl KakarotClient

{ +impl KakarotClient

{ /// Create a new `KakarotClient`. pub fn new(starknet_config: KakarotRpcConfig, starknet_provider: Arc

) -> Self { let KakarotRpcConfig { @@ -72,7 +69,7 @@ impl KakarotClient

{ } = starknet_config; let provider = starknet_provider.clone(); - let contract_reader = KakarotCoreReader::new(kakarot_address, provider.clone()); + let contract_reader = KakarotCoreReader::new(kakarot_address, provider); let kakarot_contract = KakarotContract::new( proxy_account_class_hash, @@ -198,12 +195,7 @@ impl KakarotClient

{ let proxy = ProxyReader::new(starknet_address, &self.starknet_provider); - let class_hash = match proxy.get_implementation().call().await { - Ok(class_hash) => class_hash, - // TODO: replace by proper error handling - // if the contract doesn't exist, we return 0 - Err(_) => FieldElement::ZERO, - }; + let class_hash = proxy.get_implementation().call().await.map_or(FieldElement::ZERO, |class_hash| class_hash); if class_hash == self.kakarot_contract.contract_account_class_hash { // Get the nonce of the contract account -> a storage variable @@ -326,7 +318,7 @@ impl KakarotClient

{ _reward_percentiles: Option>, ) -> Result { let block_count_usize = - usize::try_from(block_count).map_err(|e| ConversionError::<()>::ValueOutOfRange(e.to_string()))?; + usize::try_from(block_count).map_err(|e| ConversionError::ValueOutOfRange(e.to_string()))?; let base_fee = self.base_fee_per_gas(); @@ -359,23 +351,23 @@ impl KakarotClient

{ let chain_id = request.chain_id.unwrap_or_else(|| CHAIN_ID.into()); let from = request.from.ok_or_else(|| EthApiError::MissingParameterError("from for estimate_gas".into()))?; - let nonce = self.nonce(from, block_id).await?.try_into().map_err(ConversionError::::from)?; + let nonce = self.nonce(from, block_id).await?.try_into().map_err(ConversionError::from)?; - let gas_limit = request.gas.unwrap_or(U256::ZERO).try_into().map_err(ConversionError::::from)?; + let gas_limit = request.gas.unwrap_or(U256::ZERO).try_into().map_err(ConversionError::from)?; let max_fee_per_gas = request .max_fee_per_gas .unwrap_or_else(|| U256::from(BASE_FEE_PER_GAS)) .try_into() - .map_err(ConversionError::::from)?; + .map_err(ConversionError::from)?; let max_priority_fee_per_gas = request .max_priority_fee_per_gas .unwrap_or_else(|| U256::from(self.max_priority_fee_per_gas())) .try_into() - .map_err(ConversionError::::from)?; + .map_err(ConversionError::from)?; let to = request.to.map_or(TransactionKind::Create, TransactionKind::Call); - let value = request.value.unwrap_or(U256::ZERO).try_into().map_err(ConversionError::::from)?; + let value = request.value.unwrap_or(U256::ZERO).try_into().map_err(ConversionError::from)?; let data = request.input.data.unwrap_or_default(); @@ -569,7 +561,7 @@ impl KakarotClient

{ // if the url is invalid, return an empty simulation (allows to call simulate_transaction on Kakana, // Madara, etc.) if url.is_err() { - let gas_usage = (*ESTIMATE_GAS).try_into().map_err(ConversionError::UintConversionError)?; + let gas_usage = (*ESTIMATE_GAS).try_into().map_err(ConversionError::from)?; let gas_price: Felt252Wrapper = (*MAX_FEE).into(); let overall_fee = Felt252Wrapper::from(gas_usage) * gas_price.clone(); return Ok(TransactionSimulationInfo { diff --git a/crates/core/src/contracts/erc20/ethereum_erc20.rs b/crates/core/src/contracts/erc20/ethereum_erc20.rs index 1d15bd77b..1b915b853 100644 --- a/crates/core/src/contracts/erc20/ethereum_erc20.rs +++ b/crates/core/src/contracts/erc20/ethereum_erc20.rs @@ -35,7 +35,7 @@ pub struct EthereumErc20

{ pub kakarot_address: FieldElement, } -impl EthereumErc20

{ +impl EthereumErc20

{ pub const fn new(address: FieldElement, provider: Arc

, kakarot_address: FieldElement) -> Self { Self { address, provider, kakarot_address } } diff --git a/crates/core/src/contracts/kakarot_contract.rs b/crates/core/src/contracts/kakarot_contract.rs index 6fe495caa..c38033c7f 100644 --- a/crates/core/src/contracts/kakarot_contract.rs +++ b/crates/core/src/contracts/kakarot_contract.rs @@ -8,15 +8,15 @@ use starknet_crypto::FieldElement; abigen_legacy!(KakarotCore, "./artifacts/kakarot.json"); -pub struct KakarotContract { +pub struct KakarotContract { pub proxy_account_class_hash: FieldElement, pub externally_owned_account_class_hash: FieldElement, pub contract_account_class_hash: FieldElement, pub reader: KakarotCoreReader>, } -impl KakarotContract

{ - pub fn new( +impl KakarotContract

{ + pub const fn new( proxy_account_class_hash: FieldElement, externally_owned_account_class_hash: FieldElement, contract_account_class_hash: FieldElement, diff --git a/crates/core/src/models/block.rs b/crates/core/src/models/block.rs index 3ed928ffb..3688da52f 100644 --- a/crates/core/src/models/block.rs +++ b/crates/core/src/models/block.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use reth_primitives::{Address, BlockId as EthereumBlockId, BlockNumberOrTag, Bloom, Bytes, H256, H64, U256}; use reth_rpc_types::{Block, BlockTransactions, Header, RichBlock}; use starknet::core::types::{ @@ -7,7 +6,6 @@ use starknet::core::types::{ }; use starknet::providers::Provider; -use super::convertible::ConvertibleStarknetBlock; use super::felt::Felt252Wrapper; use crate::client::constants::{ DIFFICULTY, EARLIEST_BLOCK_NUMBER, GAS_LIMIT, GAS_USED, MIX_HASH, NONCE, SIZE, TOTAL_DIFFICULTY, @@ -24,7 +22,7 @@ impl EthBlockId { } impl TryFrom for StarknetBlockId { - type Error = ConversionError<()>; + type Error = ConversionError; fn try_from(eth_block_id: EthBlockId) -> Result { match eth_block_id.0 { EthereumBlockId::Hash(hash) => { @@ -147,9 +145,8 @@ impl BlockWithTxs { ); } -#[async_trait] -impl ConvertibleStarknetBlock for BlockWithTxHashes { - async fn to_eth_block(&self, client: &KakarotClient

) -> RichBlock { +impl BlockWithTxHashes { + pub async fn to_eth_block(&self, client: &KakarotClient

) -> RichBlock { // TODO: Fetch real data let gas_limit = *GAS_LIMIT; @@ -226,9 +223,8 @@ impl ConvertibleStarknetBlock for BlockWithTxHashes { } } -#[async_trait] -impl ConvertibleStarknetBlock for BlockWithTxs { - async fn to_eth_block(&self, client: &KakarotClient

) -> RichBlock { +impl BlockWithTxs { + pub async fn to_eth_block(&self, client: &KakarotClient

) -> RichBlock { // TODO: Fetch real data let gas_limit = *GAS_LIMIT; diff --git a/crates/core/src/models/call.rs b/crates/core/src/models/call.rs index c85388123..cfa714402 100644 --- a/crates/core/src/models/call.rs +++ b/crates/core/src/models/call.rs @@ -54,7 +54,7 @@ impl From> for Calls { /// Converts a raw starknet transaction calldata to a vector of starknet calls. impl TryFrom> for Calls { - type Error = ConversionError<()>; + type Error = ConversionError; fn try_from(value: Vec) -> Result { // in account calls, the calldata is first each call as {contract address, selector, data offset, diff --git a/crates/core/src/models/convertible.rs b/crates/core/src/models/convertible.rs deleted file mode 100644 index 03961ff98..000000000 --- a/crates/core/src/models/convertible.rs +++ /dev/null @@ -1,59 +0,0 @@ -use async_trait::async_trait; -use reth_primitives::{H256, U256}; -use reth_rpc_types::{Log, RichBlock, Transaction as EthTransaction, TransactionReceipt}; -use starknet::core::types::{BroadcastedInvokeTransaction, EventFilter}; -use starknet::providers::Provider; - -use crate::client::errors::EthApiError; -use crate::client::KakarotClient; - -#[async_trait] -pub trait ConvertibleStarknetBlock { - async fn to_eth_block(&self, client: &KakarotClient

) -> RichBlock; -} - -pub trait ConvertibleStarknetEvent { - fn to_eth_log( - self, - client: &KakarotClient

, - block_hash: Option, - block_number: Option, - transaction_hash: Option, - log_index: Option, - transaction_index: Option, - ) -> Result; -} - -pub trait ConvertibleEthEventFilter { - fn to_starknet_event_filter( - self, - client: &KakarotClient

, - ) -> Result; -} - -#[async_trait] -pub trait ConvertibleStarknetTransaction { - async fn to_eth_transaction( - &self, - client: &KakarotClient

, - block_hash: Option, - block_number: Option, - transaction_index: Option, - ) -> Result; -} - -#[async_trait] -pub trait ConvertibleSignedTransaction { - async fn to_broadcasted_invoke_transaction( - &self, - client: &KakarotClient

, - ) -> Result; -} - -#[async_trait] -pub trait ConvertibleStarknetTransactionReceipt { - async fn to_eth_transaction_receipt( - self, - client: &KakarotClient

, - ) -> Result, EthApiError>; -} diff --git a/crates/core/src/models/errors.rs b/crates/core/src/models/errors.rs index 6a85243b3..a805f6f32 100644 --- a/crates/core/src/models/errors.rs +++ b/crates/core/src/models/errors.rs @@ -6,7 +6,7 @@ use crate::client::helpers::DataDecodingError; #[derive(Debug, Error)] /// Conversion error -pub enum ConversionError { +pub enum ConversionError { /// Ethereum to Starknet transaction conversion error #[error("transaction conversion error: {0}")] TransactionConversionError(String), @@ -26,9 +26,15 @@ pub enum ConversionError { #[error("value out of range: {0}")] ValueOutOfRange(String), /// Uint conversion error - #[error(transparent)] - UintConversionError(#[from] FromUintError), + #[error("Uint conversion error: {0}")] + UintConversionError(String), /// Other conversion error #[error("failed to convert value: {0}")] Other(String), } + +impl From> for ConversionError { + fn from(err: FromUintError) -> Self { + Self::UintConversionError(err.to_string()) + } +} diff --git a/crates/core/src/models/event.rs b/crates/core/src/models/event.rs index a398232e3..7465ccb27 100644 --- a/crates/core/src/models/event.rs +++ b/crates/core/src/models/event.rs @@ -10,7 +10,6 @@ use starknet_crypto::FieldElement; use super::felt::Felt252Wrapper; use crate::client::errors::EthApiError; use crate::client::KakarotClient; -use crate::models::convertible::ConvertibleStarknetEvent; #[derive(Debug, Clone)] pub struct StarknetEvent(Event); @@ -27,8 +26,8 @@ impl From for StarknetEvent { } } -impl ConvertibleStarknetEvent for StarknetEvent { - fn to_eth_log( +impl StarknetEvent { + pub fn to_eth_log( self, client: &KakarotClient

, block_hash: Option, diff --git a/crates/core/src/models/event_filter.rs b/crates/core/src/models/event_filter.rs index 5d55e9cbe..e62bce637 100644 --- a/crates/core/src/models/event_filter.rs +++ b/crates/core/src/models/event_filter.rs @@ -5,7 +5,6 @@ use starknet::providers::Provider; use starknet_crypto::FieldElement; use super::block::EthBlockNumberOrTag; -use super::convertible::ConvertibleEthEventFilter; use super::felt::Felt252Wrapper; use crate::client::errors::EthApiError; use crate::client::helpers::split_u256_into_field_elements; @@ -25,8 +24,8 @@ impl From for Filter { } } -impl ConvertibleEthEventFilter for EthEventFilter { - fn to_starknet_event_filter( +impl EthEventFilter { + pub fn to_starknet_event_filter( self, client: &KakarotClient

, ) -> Result { diff --git a/crates/core/src/models/felt.rs b/crates/core/src/models/felt.rs index 8c881113a..4566b920c 100644 --- a/crates/core/src/models/felt.rs +++ b/crates/core/src/models/felt.rs @@ -40,7 +40,7 @@ impl From for Felt252Wrapper { } impl TryFrom for u64 { - type Error = ConversionError<()>; + type Error = ConversionError; fn try_from(value: Felt252Wrapper) -> Result { Self::try_from(value.0).map_err(|e| ConversionError::ValueOutOfRange(e.to_string())) @@ -48,7 +48,7 @@ impl TryFrom for u64 { } impl TryFrom for u128 { - type Error = ConversionError<()>; + type Error = ConversionError; fn try_from(value: Felt252Wrapper) -> Result { Self::try_from(value.0).map_err(|e| ConversionError::ValueOutOfRange(e.to_string())) @@ -64,7 +64,7 @@ impl From

for Felt252Wrapper { } impl TryFrom for Address { - type Error = ConversionError<()>; + type Error = ConversionError; fn try_from(felt: Felt252Wrapper) -> Result { let felt: FieldElement = felt.into(); @@ -80,7 +80,7 @@ impl TryFrom for Address { } impl TryFrom for Felt252Wrapper { - type Error = ConversionError<()>; + type Error = ConversionError; fn try_from(h256: H256) -> Result { let felt = FieldElement::from_bytes_be(&h256)?; @@ -96,7 +96,7 @@ impl From for H256 { } impl TryFrom for Felt252Wrapper { - type Error = ConversionError<()>; + type Error = ConversionError; fn try_from(u256: U256) -> Result { let felt = FieldElement::from_bytes_be(&u256.to_be_bytes())?; diff --git a/crates/core/src/models/mod.rs b/crates/core/src/models/mod.rs index c890cdbd1..bba6a149d 100644 --- a/crates/core/src/models/mod.rs +++ b/crates/core/src/models/mod.rs @@ -1,7 +1,6 @@ pub mod balance; pub mod block; pub mod call; -pub mod convertible; pub mod errors; pub mod event; pub mod event_filter; diff --git a/crates/core/src/models/transaction/transaction.rs b/crates/core/src/models/transaction/transaction.rs index 04f0d78af..d614c1078 100644 --- a/crates/core/src/models/transaction/transaction.rs +++ b/crates/core/src/models/transaction/transaction.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use reth_primitives::{TransactionSigned, H256, U128, U256, U64}; use reth_rpc_types::{Signature, Transaction as EthTransaction}; use starknet::core::types::{ @@ -10,7 +9,6 @@ use crate::client::constants::{self, CHAIN_ID}; use crate::client::errors::EthApiError; use crate::client::KakarotClient; use crate::models::call::Calls; -use crate::models::convertible::ConvertibleStarknetTransaction; use crate::models::errors::ConversionError; use crate::models::felt::Felt252Wrapper; @@ -30,7 +28,7 @@ impl From for Transaction { macro_rules! get_invoke_transaction_field { (($field_v0:ident, $field_v1:ident), $type:ty) => { - pub fn $field_v1(&self) -> Result<$type, ConversionError<()>> { + pub fn $field_v1(&self) -> Result<$type, ConversionError> { match &self.0 { Transaction::Invoke(tx) => match tx { InvokeTransaction::V0(tx) => Ok(tx.$field_v0.clone().into()), @@ -67,9 +65,8 @@ impl From for Vec { } } -#[async_trait] -impl ConvertibleStarknetTransaction for StarknetTransaction { - async fn to_eth_transaction( +impl StarknetTransaction { + pub async fn to_eth_transaction( &self, client: &KakarotClient

, block_hash: Option, @@ -150,10 +147,7 @@ impl ConvertibleStarknetTransaction for StarknetTransaction { impl StarknetTransaction { /// Checks if the transaction is a Kakarot transaction. - async fn is_kakarot_tx( - &self, - client: &KakarotClient

, - ) -> Result { + async fn is_kakarot_tx(&self, client: &KakarotClient

) -> Result { let starknet_block_latest = StarknetBlockId::Tag(BlockTag::Latest); let sender_address: FieldElement = self.sender_address()?.into(); diff --git a/crates/core/src/models/transaction/transaction_signed.rs b/crates/core/src/models/transaction/transaction_signed.rs index c37702f99..5d888502c 100644 --- a/crates/core/src/models/transaction/transaction_signed.rs +++ b/crates/core/src/models/transaction/transaction_signed.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use reth_primitives::{Bytes, TransactionSigned}; use reth_rlp::Decodable as _; use starknet::core::types::{BlockId as StarknetBlockId, BlockTag, BroadcastedInvokeTransaction}; @@ -9,7 +8,6 @@ use crate::client::constants::MAX_FEE; use crate::client::errors::EthApiError; use crate::client::helpers::{prepare_kakarot_eth_send_transaction, DataDecodingError}; use crate::client::KakarotClient; -use crate::models::convertible::ConvertibleSignedTransaction; pub struct StarknetTransactionSigned(Bytes); @@ -19,9 +17,8 @@ impl From for StarknetTransactionSigned { } } -#[async_trait] -impl ConvertibleSignedTransaction for StarknetTransactionSigned { - async fn to_broadcasted_invoke_transaction( +impl StarknetTransactionSigned { + pub async fn to_broadcasted_invoke_transaction( &self, client: &KakarotClient

, ) -> Result { diff --git a/crates/core/src/models/transaction_receipt.rs b/crates/core/src/models/transaction_receipt.rs index 31e13a5aa..f968a0cf1 100644 --- a/crates/core/src/models/transaction_receipt.rs +++ b/crates/core/src/models/transaction_receipt.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use reth_primitives::{Bloom, H256, U128, U256, U64, U8}; use reth_rpc_types::TransactionReceipt as EthTransactionReceipt; use starknet::core::types::{ @@ -6,9 +5,6 @@ use starknet::core::types::{ }; use starknet::providers::Provider; -use super::convertible::{ - ConvertibleStarknetEvent, ConvertibleStarknetTransaction, ConvertibleStarknetTransactionReceipt, -}; use super::event::StarknetEvent; use super::felt::Felt252Wrapper; use super::transaction::transaction::StarknetTransaction; @@ -31,9 +27,8 @@ impl From for MaybePendingTransactionReceipt { } } -#[async_trait] -impl ConvertibleStarknetTransactionReceipt for StarknetTransactionReceipt { - async fn to_eth_transaction_receipt( +impl StarknetTransactionReceipt { + pub async fn to_eth_transaction_receipt( self, client: &KakarotClient

, ) -> Result, EthApiError> { diff --git a/crates/eth-rpc/src/rpc.rs b/crates/eth-rpc/src/rpc.rs index a4b5c7ccf..ebe0aeaeb 100644 --- a/crates/eth-rpc/src/rpc.rs +++ b/crates/eth-rpc/src/rpc.rs @@ -25,7 +25,7 @@ pub enum KakarotRpcModule { Net, } -pub struct KakarotRpcModuleBuilder { +pub struct KakarotRpcModuleBuilder { modules: HashMap, _phantom: PhantomData

, } diff --git a/crates/eth-rpc/src/servers/eth_rpc.rs b/crates/eth-rpc/src/servers/eth_rpc.rs index 3a9e0733a..aabb62022 100644 --- a/crates/eth-rpc/src/servers/eth_rpc.rs +++ b/crates/eth-rpc/src/servers/eth_rpc.rs @@ -5,10 +5,6 @@ use kakarot_rpc_core::client::constants::{CHAIN_ID, CHUNK_SIZE_LIMIT}; use kakarot_rpc_core::client::errors::EthApiError; use kakarot_rpc_core::client::{ContractAccountReader, KakarotClient}; use kakarot_rpc_core::models::block::EthBlockId; -use kakarot_rpc_core::models::convertible::{ - ConvertibleEthEventFilter, ConvertibleStarknetEvent, ConvertibleStarknetTransaction, - ConvertibleStarknetTransactionReceipt, -}; use kakarot_rpc_core::models::event::StarknetEvent; use kakarot_rpc_core::models::event_filter::EthEventFilter; use kakarot_rpc_core::models::felt::Felt252Wrapper; @@ -33,7 +29,7 @@ pub struct KakarotEthRpc { pub kakarot_client: Arc>, } -impl KakarotEthRpc

{ +impl KakarotEthRpc

{ pub fn new(kakarot_client: Arc>) -> Self { Self { kakarot_client } } diff --git a/crates/test-utils/src/execution/eoa.rs b/crates/test-utils/src/execution/eoa.rs index 585cee793..137854f3e 100644 --- a/crates/test-utils/src/execution/eoa.rs +++ b/crates/test-utils/src/execution/eoa.rs @@ -20,7 +20,7 @@ use super::watch_tx; use crate::execution::contract::EvmContract; #[async_trait] -pub trait EOA { +pub trait EOA { async fn starknet_address(&self) -> Result { let client = self.client(); Ok(client.compute_starknet_address(&self.evm_address()?, &StarknetBlockId::Tag(BlockTag::Latest)).await?) @@ -54,7 +54,7 @@ pub trait EOA { } } -pub struct KakarotEOA { +pub struct KakarotEOA { pub private_key: H256, pub client: KakarotClient

, } @@ -66,7 +66,7 @@ impl KakarotEOA

{ } #[async_trait] -impl EOA

for KakarotEOA

{ +impl EOA

for KakarotEOA

{ fn private_key(&self) -> H256 { self.private_key } @@ -78,8 +78,8 @@ impl EOA

for KakarotEOA

{ } } -impl KakarotEOA

{ - pub async fn deploy_evm_contract( +impl KakarotEOA

{ + pub async fn deploy_evm_contract( &self, contract_name: &str, constructor_args: T, @@ -120,7 +120,7 @@ impl KakarotEOA

{ Ok(KakarotEvmContract::new(bytecode, event.data[1], event.data[0])) } - pub async fn call_evm_contract( + pub async fn call_evm_contract( &self, contract: &KakarotEvmContract, function: &str,