From 506ca9a63a2f6836566e1150b071c1817af803da Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 17:14:45 -0300 Subject: [PATCH] format --- replay/src/benchmark.rs | 8 ++++---- replay/src/state_dump.rs | 26 +++++++++++++++++--------- rpc-state-reader/src/execution.rs | 5 ++++- rpc-state-reader/src/reader.rs | 2 +- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/replay/src/benchmark.rs b/replay/src/benchmark.rs index 3f03a46..398c5b4 100644 --- a/replay/src/benchmark.rs +++ b/replay/src/benchmark.rs @@ -1,7 +1,9 @@ use std::time::Instant; use blockifier::{ - context::BlockContext, execution::contract_class::RunnableCompiledClass, state::{cached_state::CachedState, state_api::StateReader} + context::BlockContext, + execution::contract_class::RunnableCompiledClass, + state::{cached_state::CachedState, state_api::StateReader}, }; use rpc_state_reader::{ execution::{execute_tx_with_blockifier, fetch_block_context}, @@ -178,9 +180,7 @@ impl StateReader for OptionalStateReader { fn get_compiled_class( &self, class_hash: starknet_api::core::ClassHash, - ) -> blockifier::state::state_api::StateResult< - RunnableCompiledClass, - > { + ) -> blockifier::state::state_api::StateResult { self.get_inner().get_compiled_class(class_hash) } diff --git a/replay/src/state_dump.rs b/replay/src/state_dump.rs index 2c39c51..363d4b2 100644 --- a/replay/src/state_dump.rs +++ b/replay/src/state_dump.rs @@ -14,15 +14,16 @@ use blockifier::{ cached_state::{CachedState, StateMaps, StorageEntry}, state_api::StateReader, }, - transaction::{ - errors::TransactionExecutionError, - objects::TransactionExecutionInfo, - }, + transaction::{errors::TransactionExecutionError, objects::TransactionExecutionInfo}, }; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_api::{ - contract_class::EntryPointType, core::{ClassHash, CompiledClassHash, ContractAddress, EntryPointSelector, Nonce}, execution_resources::GasVector, state::StorageKey, transaction::fields::Calldata + contract_class::EntryPointType, + core::{ClassHash, CompiledClassHash, ContractAddress, EntryPointSelector, Nonce}, + execution_resources::GasVector, + state::StorageKey, + transaction::fields::Calldata, }; use starknet_types_core::felt::Felt; @@ -120,9 +121,10 @@ struct SerializableExecutionInfo { impl SerializableExecutionInfo { pub fn new(execution_info: &TransactionExecutionInfo) -> Self { - let reverted = execution_info.revert_error.clone().and_then(|f|{ - Some(f.to_string()) - }); + let reverted = execution_info + .revert_error + .clone() + .and_then(|f| Some(f.to_string())); Self { validate_call_info: execution_info .validate_call_info @@ -201,7 +203,13 @@ impl SerializableExecutionInfo { .starknet_resources .messages .l1_handler_payload_size, - n_events: execution_info.receipt.resources.starknet_resources.archival_data.event_summary.n_events, + n_events: execution_info + .receipt + .resources + .starknet_resources + .archival_data + .event_summary + .n_events, }, }, da_gas: execution_info.receipt.da_gas, diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 14c379c..5d73eef 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -6,7 +6,10 @@ use blockifier::{ bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, execution::contract_class::RunnableCompiledClass, - state::{cached_state::{CachedState, TransactionalState}, state_api::{State, StateReader}}, + state::{ + cached_state::{CachedState, TransactionalState}, + state_api::{State, StateReader}, + }, transaction::{ account_transaction::AccountTransaction as BlockiAccountTransaction, objects::{TransactionExecutionInfo, TransactionExecutionResult}, diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 658dfff..36cfe5b 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -141,7 +141,7 @@ impl RpcStateReader { let params = json!([hash]); dbg!(&hash); let tx = self.send_rpc_request_with_retry("starknet_getTransactionByHash", params)?; - + objects::deser::transaction_from_json(tx).map_err(serde_err_to_state_err) }