Skip to content

Commit 81794e2

Browse files
Use CallEntryPoint.into_executable() (#3417)
<!-- Reference any GitHub issues resolved by this PR --> Towards #3174 Closes #3162 **Stack**: - #3417 ⬅ - #3416 ## Introduced changes Use `CallEntryPoint.into_executable()` which is now public ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [x] Added relevant tests - [x] Performed self-review of the code - [x] Added changes to `CHANGELOG.md`
1 parent cb6778a commit 81794e2

File tree

2 files changed

+9
-30
lines changed
  • crates/cheatnet
    • src/runtime_extensions/call_to_blockifier_runtime_extension/execution
    • tests/common

2 files changed

+9
-30
lines changed

crates/cheatnet/src/runtime_extensions/call_to_blockifier_runtime_extension/execution/entry_point.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,7 @@ pub fn execute_call_entry_point(
144144
return Err(PreExecutionError::FraudAttempt.into());
145145
}
146146

147-
let entry_point = ExecutableCallEntryPoint {
148-
class_hash,
149-
code_address: entry_point.code_address,
150-
entry_point_type: entry_point.entry_point_type,
151-
entry_point_selector: entry_point.entry_point_selector,
152-
calldata: entry_point.calldata.clone(),
153-
storage_address: entry_point.storage_address,
154-
caller_address: entry_point.caller_address,
155-
call_type: entry_point.call_type,
156-
initial_gas: entry_point.initial_gas,
157-
};
158-
147+
let entry_point = entry_point.clone().into_executable(class_hash);
159148
let contract_class = state.get_compiled_class(class_hash)?;
160149

161150
context.revert_infos.0.push(EntryPointRevertInfo::new(

crates/cheatnet/tests/common/mod.rs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use blockifier::execution::call_info::CallInfo;
33
use blockifier::execution::contract_class::TrackedResource;
44
use blockifier::execution::entry_point::{
55
CallEntryPoint, CallType, EntryPointExecutionContext, EntryPointExecutionResult,
6-
ExecutableCallEntryPoint,
76
};
87
use blockifier::execution::execution_utils::ReadOnlySegments;
98
use blockifier::execution::syscalls::hint_processor::SyscallHintProcessor;
@@ -45,22 +44,13 @@ pub mod cache;
4544
pub mod state;
4645

4746
fn build_syscall_hint_processor<'a>(
48-
call_entry_point: CallEntryPoint,
47+
call_entry_point: &CallEntryPoint,
4948
state: &'a mut dyn State,
5049
entry_point_execution_context: &'a mut EntryPointExecutionContext,
5150
hints: &'a HashMap<String, Hint>,
5251
) -> SyscallHintProcessor<'a> {
53-
let call_entry_point = ExecutableCallEntryPoint {
54-
class_hash: call_entry_point.class_hash.unwrap_or_default(),
55-
code_address: call_entry_point.code_address,
56-
entry_point_type: call_entry_point.entry_point_type,
57-
entry_point_selector: call_entry_point.entry_point_selector,
58-
calldata: call_entry_point.calldata,
59-
storage_address: call_entry_point.storage_address,
60-
caller_address: call_entry_point.caller_address,
61-
call_type: call_entry_point.call_type,
62-
initial_gas: call_entry_point.initial_gas,
63-
};
52+
let class_hash = call_entry_point.class_hash.unwrap_or_default();
53+
let call_entry_point = call_entry_point.clone().into_executable(class_hash);
6454

6555
SyscallHintProcessor::new(
6656
state,
@@ -120,7 +110,7 @@ pub fn deploy_contract(
120110
let hints = HashMap::new();
121111

122112
let mut syscall_hint_processor = build_syscall_hint_processor(
123-
CallEntryPoint::default(),
113+
&CallEntryPoint::default(),
124114
state,
125115
&mut entry_point_execution_context,
126116
&hints,
@@ -151,7 +141,7 @@ pub fn deploy_wrapper(
151141
let hints = HashMap::new();
152142

153143
let mut syscall_hint_processor = build_syscall_hint_processor(
154-
CallEntryPoint::default(),
144+
&CallEntryPoint::default(),
155145
state,
156146
&mut entry_point_execution_context,
157147
&hints,
@@ -182,7 +172,7 @@ pub fn deploy_at_wrapper(
182172
let hints = HashMap::new();
183173

184174
let mut syscall_hint_processor = build_syscall_hint_processor(
185-
CallEntryPoint::default(),
175+
&CallEntryPoint::default(),
186176
state,
187177
&mut entry_point_execution_context,
188178
&hints,
@@ -230,7 +220,7 @@ pub fn call_contract(
230220
let hints = HashMap::new();
231221

232222
let mut syscall_hint_processor = build_syscall_hint_processor(
233-
entry_point.clone(),
223+
&entry_point,
234224
state,
235225
&mut entry_point_execution_context,
236226
&hints,
@@ -271,7 +261,7 @@ pub fn call_contract_raw(
271261
let hints = HashMap::new();
272262

273263
let syscall_hint_processor = build_syscall_hint_processor(
274-
entry_point.clone(),
264+
&entry_point,
275265
state,
276266
&mut entry_point_execution_context,
277267
&hints,

0 commit comments

Comments
 (0)