Skip to content

Commit 2ea8e1c

Browse files
committed
Replaced vec to slice
1 parent 6730792 commit 2ea8e1c

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
lines changed

crates/blockifier/src/state/cached_state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<S: StateReader, V: VisitedPcs> State for CachedState<S, V> {
278278
Ok(())
279279
}
280280

281-
fn add_visited_pcs(&mut self, class_hash: ClassHash, pcs: &Vec<usize>) {
281+
fn add_visited_pcs(&mut self, class_hash: ClassHash, pcs: &[usize]) {
282282
self.visited_pcs.insert(&class_hash, pcs);
283283
}
284284
}

crates/blockifier/src/state/state_api.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub trait State: StateReader {
105105
/// Marks the given set of PC values as visited for the given class hash.
106106
// TODO(lior): Once we have a BlockResources object, move this logic there. Make sure reverted
107107
// entry points do not affect the final set of PCs.
108-
fn add_visited_pcs(&mut self, class_hash: ClassHash, pcs: &Vec<usize>);
108+
fn add_visited_pcs(&mut self, class_hash: ClassHash, pcs: &[usize]);
109109
}
110110

111111
/// A class defining the API for updating a state with transactions writes.
@@ -119,14 +119,3 @@ pub trait UpdatableState: StateReader {
119119
visited_pcs: &Self::T,
120120
);
121121
}
122-
123-
pub trait UpdatableStatetTest: StateReader {
124-
type T;
125-
126-
fn apply_writes(
127-
&mut self,
128-
writes: &StateMaps,
129-
class_hash_to_class: &ContractClassMapping,
130-
visited_pcs: &Self::T,
131-
);
132-
}

crates/blockifier/src/transaction/execution_flavors_test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ fn test_simulate_validate_charge_fee_pre_validate(
296296

297297
// Fourth scenario: L1 gas price bound lower than the price on the block.
298298
if !is_deprecated {
299-
let account_tx = account_invoke_tx(invoke_tx_args! {
299+
let result = account_invoke_tx(invoke_tx_args! {
300300
resource_bounds: l1_resource_bounds(MAX_L1_GAS_AMOUNT, u128::from(gas_price) - 1),
301301
nonce: nonce_manager.next(account_address),
302302
..pre_validation_base_args
303-
});
304-
let result = account_tx.execute(&mut state, &block_context, charge_fee, validate);
303+
})
304+
.execute(&mut state, &block_context, charge_fee, validate);
305305
if !charge_fee {
306306
check_gas_and_fee(
307307
&block_context,

crates/blockifier/src/transaction/test_utils.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ pub fn run_invoke_tx(
273273
block_context: &BlockContext,
274274
invoke_args: InvokeTxArgs,
275275
) -> TransactionExecutionResult<TransactionExecutionInfo> {
276-
let account_tx = account_invoke_tx(invoke_args);
277-
account_tx.execute(state, block_context, true, true)
276+
account_invoke_tx(invoke_args).execute(state, block_context, true, true)
278277
}
279278

280279
/// Creates a `ResourceBoundsMapping` with the given `max_amount` and `max_price` for L1 gas limits.

crates/blockifier/src/transaction/transactions_test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ fn assert_failure_if_resource_bounds_exceed_balance(
748748
match block_context.to_tx_context(&invalid_tx).tx_info {
749749
TransactionInfo::Deprecated(context) => {
750750
assert_matches!(
751-
invalid_tx.execute( state, block_context, true, true).unwrap_err(),
751+
invalid_tx.execute(state, block_context, true, true).unwrap_err(),
752752
TransactionExecutionError::TransactionPreValidationError(
753753
TransactionPreValidationError::TransactionFeeError(
754754
TransactionFeeError::MaxFeeExceedsBalance{ max_fee, .. }))
@@ -758,7 +758,7 @@ fn assert_failure_if_resource_bounds_exceed_balance(
758758
TransactionInfo::Current(context) => {
759759
let l1_bounds = context.l1_resource_bounds().unwrap();
760760
assert_matches!(
761-
invalid_tx.execute( state, block_context, true, true).unwrap_err(),
761+
invalid_tx.execute(state, block_context, true, true).unwrap_err(),
762762
TransactionExecutionError::TransactionPreValidationError(
763763
TransactionPreValidationError::TransactionFeeError(
764764
TransactionFeeError::L1GasBoundsExceedBalance{ max_amount, max_price, .. }))

0 commit comments

Comments
 (0)