-
Notifications
You must be signed in to change notification settings - Fork 239
feat: mock_call with dynamic return data #2904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 10 commits
0ff1663
f21e510
3c37814
d1921ea
9594b5a
c097e3c
e70b4b1
02a7dcd
3498701
f4bc282
e15e00f
90cff00
2cd43a4
e1293a8
2c5ec93
3aeb496
1a20bbd
f235bd7
da9bc28
3ae2a28
7bbed0d
02604f9
9a93ca3
86811c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2,7 +2,7 @@ use std::cell::RefCell; | |||
use super::cairo1_execution::execute_entry_point_call_cairo1; | ||||
use crate::runtime_extensions::call_to_blockifier_runtime_extension::execution::deprecated::cairo0_execution::execute_entry_point_call_cairo0; | ||||
use crate::runtime_extensions::call_to_blockifier_runtime_extension::CheatnetState; | ||||
use crate::state::{CallTrace, CallTraceNode, CheatStatus, EncounteredError}; | ||||
use crate::state::{CallTrace, CallTraceNode, CheatSpan, CheatStatus, EncounteredError}; | ||||
use blockifier::execution::call_info::{CallExecution, Retdata}; | ||||
use blockifier::{ | ||||
execution::{ | ||||
|
@@ -18,11 +18,13 @@ use blockifier::{ | |||
state::state_api::State, | ||||
}; | ||||
use cairo_vm::vm::runners::cairo_runner::{CairoRunner, ExecutionResources}; | ||||
use num_traits::Zero; | ||||
use starknet_api::{ | ||||
core::ClassHash, | ||||
deprecated_contract_class::EntryPointType, | ||||
transaction::{Calldata, TransactionVersion}, | ||||
}; | ||||
use starknet_crypto::poseidon_hash_many; | ||||
use std::collections::HashSet; | ||||
use std::rc::Rc; | ||||
use blockifier::execution::deprecated_syscalls::hint_processor::SyscallCounter; | ||||
|
@@ -268,11 +270,25 @@ fn get_mocked_function_cheat_status<'a>( | |||
if call.call_type == CallType::Delegate { | ||||
return None; | ||||
} | ||||
|
||||
cheatnet_state | ||||
match cheatnet_state | ||||
.mocked_functions | ||||
.get_mut(&call.storage_address) | ||||
.and_then(|contract_functions| contract_functions.get_mut(&call.entry_point_selector)) | ||||
{ | ||||
None => None, | ||||
Some(contract_functions) => { | ||||
let calldata_hash = poseidon_hash_many(call.calldata.0.iter()); | ||||
let key = (call.entry_point_selector, calldata_hash); | ||||
let key_zero = (call.entry_point_selector, Felt::zero()); | ||||
|
||||
match contract_functions.get(&key) { | ||||
Some(CheatStatus::Cheated(_, CheatSpan::TargetCalls(0))) => { | ||||
|
pub fn decrement_cheat_span(&mut self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workaround removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be under unreleased version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done