Skip to content
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

Address alternative call failure #714

Draft
wants to merge 1 commit into
base: starknet-0.13.4
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions crates/starknet-devnet-core/src/stack_trace.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copied with minor modifications from blockifier/src/execution/stack_trace.rs.
// Try removing once included in a blockifier release.

use blockifier::execution::call_info::CallInfo;
use blockifier::execution::deprecated_syscalls::hint_processor::DeprecatedSyscallExecutionError;
use blockifier::execution::errors::{
ConstructorEntryPointExecutionError, EntryPointExecutionError,
Expand Down Expand Up @@ -56,6 +57,24 @@ impl ErrorStack {
Self { stack: vec![Frame::StringFrame(s.into())] }
}

pub fn from_inner_calls(_calls: &[CallInfo]) -> Self {
unimplemented!("Figure out how to get preamble_type")
// Self {
// stack: calls
// .iter()
// .map(|_call| {
// Frame::EntryPoint(EntryPointErrorFrame {
// depth: todo!(),
// preamble_type: todo!(),
// storage_address: todo!(),
// class_hash: todo!(),
// selector: todo!(),
// })
// })
// .collect(),
// }
}

pub fn push(&mut self, frame: Frame) {
self.stack.push(frame);
}
Expand Down
17 changes: 9 additions & 8 deletions crates/starknet-devnet-core/src/starknet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,16 @@ impl Starknet {
))
})?;

if res.execution.failed
&& res.execution.retdata.0.first() == Some(&ENTRYPOINT_NOT_FOUND_ERROR_ENCODED)
{
return Err(Error::EntrypointNotFound);
// Discussed in https://spaceshard.slack.com/archives/C03QN20522D/p1735547866439019
if res.execution.failed {
Err(if res.execution.retdata.0.first() == Some(&ENTRYPOINT_NOT_FOUND_ERROR_ENCODED) {
Error::EntrypointNotFound
} else {
Error::ContractExecutionError(ErrorStack::from_inner_calls(&res.inner_calls))
})
} else {
Ok(res.execution.retdata.0)
}

// TODO other cases: https://spaceshard.slack.com/archives/C03QN20522D/p1735547866439019

Ok(res.execution.retdata.0)
}

pub fn estimate_fee(
Expand Down