Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
style: Remove some unnecessary variables
Browse files Browse the repository at this point in the history
  • Loading branch information
elintul committed Jan 23, 2024
1 parent 016c165 commit 60e02ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
7 changes: 4 additions & 3 deletions crates/blockifier/src/abi/sierra_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ impl SierraU256 {

impl SierraType for SierraU256 {
fn from_memory(vm: &VirtualMachine, ptr: &mut Relocatable) -> Result<Self, SierraTypeError> {
let low_val = SierraU128::from_memory(vm, ptr)?.as_value();
let high_val = SierraU128::from_memory(vm, ptr)?.as_value();
Ok(Self { low_val, high_val })
Ok(Self {
low_val: SierraU128::from_memory(vm, ptr)?.as_value(),
high_val: SierraU128::from_memory(vm, ptr)?.as_value(),
})
}

fn from_storage(
Expand Down
3 changes: 1 addition & 2 deletions crates/blockifier/src/execution/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ impl<T: SyscallRequest> SyscallRequest for SyscallRequestWrapper<T> {
input: felt_to_stark_felt(&gas_counter),
info: String::from("Unexpected gas."),
})?;
let request = T::read(vm, ptr)?;
Ok(Self { gas_counter, request })
Ok(Self { gas_counter, request: T::read(vm, ptr)? })
}
}

Expand Down
5 changes: 2 additions & 3 deletions crates/native_blockifier/src/py_block_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ impl PyBlockExecutor {
target_storage_config: StorageConfig,
) -> Self {
log::debug!("Initializing Block Executor...");
let tx_executor = None;
let storage =
PapyrusStorage::new(target_storage_config).expect("Failed to initialize storage");

log::debug!("Initialized Block Executor.");

Self {
general_config,
max_recursion_depth,
tx_executor,
tx_executor: None,
storage: Box::new(storage),
global_contract_cache: GlobalContractCache::default(),
}
Expand Down
11 changes: 6 additions & 5 deletions crates/native_blockifier/src/py_transaction_execution_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ pub struct PyOrderedEvent {

impl From<OrderedEvent> for PyOrderedEvent {
fn from(ordered_event: OrderedEvent) -> Self {
let keys = to_py_vec(ordered_event.event.keys, |x| PyFelt(x.0));
let data = to_py_vec(ordered_event.event.data.0, PyFelt);
Self { order: ordered_event.order, keys, data }
Self {
order: ordered_event.order,
keys: to_py_vec(ordered_event.event.keys, |x| PyFelt(x.0)),
data: to_py_vec(ordered_event.event.data.0, PyFelt),
}
}
}

Expand All @@ -149,11 +151,10 @@ pub struct PyOrderedL2ToL1Message {

impl From<OrderedL2ToL1Message> for PyOrderedL2ToL1Message {
fn from(ordered_message: OrderedL2ToL1Message) -> Self {
let payload = to_py_vec(ordered_message.message.payload.0, PyFelt);
Self {
order: ordered_message.order,
to_address: PyFelt::from(ordered_message.message.to_address),
payload,
payload: to_py_vec(ordered_message.message.payload.0, PyFelt),
}
}
}
Expand Down

0 comments on commit 60e02ed

Please sign in to comment.