Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoGiachetta committed Nov 28, 2024
1 parent d7f47e2 commit 506ca9a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
8 changes: 4 additions & 4 deletions replay/src/benchmark.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down Expand Up @@ -178,9 +180,7 @@ impl<S: StateReader> StateReader for OptionalStateReader<S> {
fn get_compiled_class(
&self,
class_hash: starknet_api::core::ClassHash,
) -> blockifier::state::state_api::StateResult<
RunnableCompiledClass,
> {
) -> blockifier::state::state_api::StateResult<RunnableCompiledClass> {
self.get_inner().get_compiled_class(class_hash)
}

Expand Down
26 changes: 17 additions & 9 deletions replay/src/state_dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion rpc-state-reader/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion rpc-state-reader/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 506ca9a

Please sign in to comment.