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

Sandboxed Fallback #1215

Open
wants to merge 15 commits into
base: sandboxed_native
Choose a base branch
from
Open

Conversation

fborello-lambda
Copy link

@fborello-lambda fborello-lambda commented Jan 30, 2024

Sandbox_Fallback

Description

The change implements a fallback mechanism, if the sandboxed cairo_native fails, the cairoVM should run instead.

The current test depends on the OS, lsof is used to check the status of the process invoked by the IsolatedExecutor instance.

A better way to test may be:

Change ExecutironResult struct in order to return some info related to the environment used to run the contract whenever execution_entry_point.rs::execute() is used.

pub struct ExecutionResult {
    pub call_info: Option<CallInfo>,
    pub revert_error: Option<String>,
		pub native_or_casm: Option<String>, // <- For example 
    pub n_reverted_steps: usize,
}

Checklist

  • [N/A] Linked to Github Issue
  • [N/A] Unit tests added
  • Integration tests added.
  • [N/A] This change requires new documentation.
  • [N/A] Documentation has been added/updated.

@fborello-lambda fborello-lambda marked this pull request as draft January 30, 2024 21:13
fborello-lambda and others added 6 commits January 31, 2024 15:07
The test proposed kills `sandbox.proc` == `std::process:Child`.
This kill makes the `sandbox` instance unusable. The current testbench checks with `lsof` command, using the `sandbox.proc`'s pid, comparing the outputs, before `sandbox.kill()` and after.

A better way to test may be adding an extra field to the `ExecutionResult` struct:

```rust
pub struct ExecutionResult {
    pub call_info: Option<CallInfo>,
    pub revert_error: Option<String>,
		pub native_or_casm: Option<String>, // <- For example
    pub n_reverted_steps: usize,
}
```

in order to return some info related to the environment used to run the contract whenever `execution_entry_point.rs::execute()` is used.
@fborello-lambda fborello-lambda marked this pull request as ready for review February 2, 2024 15:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants