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

Different errors when calling unknown entry point selector error from contract and from test #1812

Closed
drknzz opened this issue Mar 4, 2024 · 2 comments · Fixed by #2606
Closed
Assignees
Labels
bug Something isn't working snforge

Comments

@drknzz
Copy link
Contributor

drknzz commented Mar 4, 2024

Which components does the task require to be changed? (think hard pls)

snforge

Description

Calling inexistent entry point:

When calling from test this is the entered arm:

EntryPointExecutionError::PreExecutionError(PreExecutionError::EntryPointNotFound(

However when calling from another contract, this is the entered arm:

EntryPointExecutionError::VirtualMachineExecutionErrorWithTrace { trace, .. } => {

It enters try_extract_panic_data

One solution would be to match the entry point error message via a regex in there.


The use case for calling an inexistent entry point is testing entry points after calling replace_class.

Example error message:

Failure data:
    Got an exception while executing a hint: Hint Error: Error in the called contract (0x0480ddec869b0aa42b46971088ba8701df26fcabb2d3e9d324fd6fd3d013fef7):
Error at pc=0:927:
Got an exception while executing a hint.
Cairo traceback (most recent call last):
Unknown location (pc=0:358)
Unknown location (pc=0:739)

Error in the called contract (0x01f78e70f8b1e91ac2c327a35e451c1985ba46c4c8f4f19488e5a5e135e5be74):
Error at pc=0:1197:
Got an exception while executing a hint: Hint Error: Entry point EntryPointSelector(StarkFelt("0x0017c00f03de8b5bd58d2016b59d251c13056b989171c5852949903bc043bc27")) not found in contract.
Cairo traceback (most recent call last):
Unknown location (pc=0:475)
Unknown location (pc=0:926)
@drknzz drknzz added the snforge label Mar 4, 2024
@drknzz drknzz moved this to Backlog in Starknet foundry Mar 4, 2024
@github-actions github-actions bot added the new label Mar 4, 2024
@drknzz drknzz added bug Something isn't working and removed new labels Mar 4, 2024
@drknzz drknzz moved this from Backlog to TODO in Starknet foundry Mar 4, 2024
@Arcticae
Copy link
Contributor

Arcticae commented Mar 4, 2024

The same happens when you call a contract that is not deployed. It's not being able to handle the result, it panics immediately.

@Arcticae
Copy link
Contributor

Arcticae commented Mar 4, 2024

BTW: I would wonder if that's the behavior that is possible to replicate on contract-contract basis on starknet currently, before we implement it (for both of those cases)

@Arcticae Arcticae assigned drknzz and unassigned drknzz Mar 11, 2024
@cptartur cptartur moved this from TODO to Backlog in Starknet foundry Aug 29, 2024
@cptartur cptartur changed the title Unkown entry point selector error from contract Different errors when calling unknown entry point selector error from contract and from test Sep 23, 2024
@cptartur cptartur assigned cptartur and kkawula and unassigned cptartur Oct 17, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 4, 2024
<!-- Reference any GitHub issues resolved by this PR -->

Closes #1812

The `Err` message chosen to be thrown by `safe-dispatcher` is intended
to replicate `cairo-test` behavior. These felts are taken explicitly
from
[`CairoHintProcessor`](https://github.com/starkware-libs/cairo/blob/2ad7718591a8d2896fec2b435c509ee5a3da9fad/crates/cairo-lang-runner/src/casm_run/mod.rs#L1055-L1057)

## Introduced changes

<!-- A brief description of the changes -->

- Add proper regex to catch falling error message

## 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`
@github-project-automation github-project-automation bot moved this from In Progress to Done in Starknet foundry Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working snforge
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants