Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit a8c6374

Browse files
committed
Remove unused max steps
1 parent 9c81834 commit a8c6374

26 files changed

+9
-100
lines changed

cli/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ fn call_parser(
256256
&mut ExecutionResourcesManager::default(),
257257
&mut TransactionExecutionContext::default(),
258258
false,
259-
block_context.invoke_tx_max_n_steps(),
260259
)?;
261260
Ok(call_info.retdata)
262261
}

fuzzer/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ fn main() {
190190
&mut resources_manager,
191191
&mut tx_execution_context,
192192
false,
193-
block_context.invoke_tx_max_n_steps()
194193
)
195194
.unwrap(),
196195
expected_call_info

src/execution/execution_entry_point.rs

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::services::api::contract_classes::deprecated_contract_class::{
22
ContractEntryPoint, EntryPointType,
33
};
44
use crate::state::cached_state::CachedState;
5-
use crate::state::StateDiff;
65
use crate::{
76
definitions::{block_context::BlockContext, constants::DEFAULT_ENTRY_POINT_SELECTOR},
87
runner::StarknetRunner,
@@ -92,7 +91,6 @@ impl ExecutionEntryPoint {
9291
resources_manager: &mut ExecutionResourcesManager,
9392
tx_execution_context: &mut TransactionExecutionContext,
9493
support_reverted: bool,
95-
max_steps: u64,
9694
) -> Result<CallInfo, TransactionError>
9795
where
9896
T: StateReader,
@@ -111,35 +109,15 @@ impl ExecutionEntryPoint {
111109
contract_class,
112110
class_hash,
113111
),
114-
CompiledClass::Casm(contract_class) => {
115-
let mut tmp_state = CachedState::new(
116-
state.state_reader.clone(),
117-
state.contract_classes.clone(),
118-
state.casm_contract_classes.clone(),
119-
);
120-
tmp_state.cache = state.cache.clone();
121-
122-
match self._execute(
123-
&mut tmp_state,
124-
resources_manager,
125-
block_context,
126-
tx_execution_context,
127-
contract_class,
128-
class_hash,
129-
support_reverted,
130-
) {
131-
Ok(call_info) => {
132-
let state_diff = StateDiff::from_cached_state(tmp_state)?;
133-
state.apply_state_update(&state_diff)?;
134-
Ok(call_info)
135-
}
136-
Err(e) => {
137-
let _n_reverted_steps =
138-
(max_steps as usize) - resources_manager.cairo_usage.n_steps;
139-
Err(e)
140-
}
141-
}
142-
}
112+
CompiledClass::Casm(contract_class) => self._execute(
113+
state,
114+
resources_manager,
115+
block_context,
116+
tx_execution_context,
117+
contract_class,
118+
class_hash,
119+
support_reverted,
120+
),
143121
}
144122
}
145123

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ pub fn call_contract<T: StateReader>(
149149
&mut ExecutionResourcesManager::default(),
150150
&mut tx_execution_context,
151151
false,
152-
block_context.invoke_tx_max_n_steps,
153152
)?;
154153

155154
Ok(call_info.retdata)

src/syscalls/business_logic_syscall_handler.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ impl<'a, S: StateReader> BusinessLogicSyscallHandler<'a, S> {
245245
&mut self.resources_manager,
246246
&mut self.tx_execution_context,
247247
self.support_reverted,
248-
self.block_context.invoke_tx_max_n_steps,
249248
)
250249
.map_err(|err| SyscallHandlerError::ExecutionError(err.to_string()))?;
251250

@@ -347,7 +346,6 @@ impl<'a, S: StateReader> BusinessLogicSyscallHandler<'a, S> {
347346
&mut self.resources_manager,
348347
&mut self.tx_execution_context,
349348
self.support_reverted,
350-
self.block_context.invoke_tx_max_n_steps,
351349
)
352350
.map_err(|_| StateError::ExecutionEntryPoint())?;
353351

src/syscalls/deprecated_business_logic_syscall_handler.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ impl<'a, S: StateReader> DeprecatedBLSyscallHandler<'a, S> {
236236
&mut self.resources_manager,
237237
&mut self.tx_execution_context,
238238
false,
239-
self.block_context.invoke_tx_max_n_steps,
240239
)
241240
.map_err(|_| StateError::ExecutionEntryPoint())?;
242241
Ok(())
@@ -440,7 +439,6 @@ impl<'a, S: StateReader> DeprecatedBLSyscallHandler<'a, S> {
440439
&mut self.resources_manager,
441440
&mut self.tx_execution_context,
442441
false,
443-
self.block_context.invoke_tx_max_n_steps,
444442
)
445443
.map(|x| {
446444
let retdata = x.retdata.clone();

src/testing/erc20.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ fn test_erc20_cairo2() {
125125
&mut resources_manager,
126126
&mut tx_execution_context,
127127
false,
128-
block_context.invoke_tx_max_n_steps,
129128
)
130129
.unwrap();
131130
let erc20_address = call_info.retdata.get(0).unwrap().clone();

src/testing/state.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ impl StarknetState {
153153
&mut resources_manager,
154154
&mut tx_execution_context,
155155
false,
156-
self.block_context.invoke_tx_max_n_steps,
157156
)?;
158157

159158
let exec_info = ExecutionInfo::Call(Box::new(call_info.clone()));

src/transaction/declare.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ impl Declare {
229229
resources_manager,
230230
&mut self.get_execution_context(block_context.invoke_tx_max_n_steps),
231231
false,
232-
block_context.validate_max_n_steps,
233232
)?;
234233

235234
verify_no_calls_to_other_contracts(&call_info)

src/transaction/declare_v2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ impl DeclareV2 {
360360
resources_manager,
361361
&mut tx_execution_context,
362362
false,
363-
block_context.validate_max_n_steps,
364363
)?)
365364
};
366365
let call_info = verify_no_calls_to_other_contracts(&call_info)?;

0 commit comments

Comments
 (0)