Skip to content

Commit

Permalink
feat(blockifier): add entry point execution logic for native (#1158)
Browse files Browse the repository at this point in the history
* feat: entry point execution logic

* chore: remove rogue comments

* refactor: apply a so stylish format

* fix: import native error

* refactor: small code improvements

* chore: update Cargo.lock

* fix: compilation error after rebasing

* refactor: use ExecutionFailed error instead of NativeExecutionError

* fix: run codecov on ubuntu-large
  • Loading branch information
rodrigo-pino authored and guy-starkware committed Oct 22, 2024
1 parent 791b2f3 commit 120c7cc
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
SEED: 0

codecov:
runs-on: starkware-ubuntu-latest-medium
runs-on: starkware-ubuntu-latest-large
steps:
- uses: actions/checkout@v4
with:
Expand Down
109 changes: 55 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/blockifier/src/execution/errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::collections::HashSet;

use cairo_native::error::Error as NativeError;
use cairo_vm::types::builtin_name::BuiltinName;
use cairo_vm::types::errors::math_errors::MathError;
use cairo_vm::vm::errors::cairo_run_errors::CairoRunError;
Expand Down Expand Up @@ -86,6 +87,8 @@ pub enum EntryPointExecutionError {
#[error("Invalid input: {input_descriptor}; {info}")]
InvalidExecutionInput { input_descriptor: String, info: String },
#[error(transparent)]
NativeUnexpectedError(#[from] NativeError),
#[error(transparent)]
PostExecutionError(#[from] PostExecutionError),
#[error(transparent)]
PreExecutionError(#[from] PreExecutionError),
Expand Down
16 changes: 11 additions & 5 deletions crates/blockifier/src/execution/execution_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ use starknet_api::deprecated_contract_class::Program as DeprecatedProgram;
use starknet_api::transaction::Calldata;
use starknet_types_core::felt::Felt;

use super::entry_point::ConstructorEntryPointExecutionResult;
use super::errors::ConstructorEntryPointExecutionError;
use crate::execution::call_info::{CallInfo, Retdata};
use crate::execution::contract_class::{ContractClass, TrackedResource};
use crate::execution::entry_point::{
execute_constructor_entry_point,
CallEntryPoint,
ConstructorContext,
ConstructorEntryPointExecutionResult,
EntryPointExecutionContext,
EntryPointExecutionResult,
};
use crate::execution::errors::PostExecutionError;
use crate::execution::errors::{ConstructorEntryPointExecutionError, PostExecutionError};
use crate::execution::native::entry_point_execution as native_entry_point_execution;
use crate::execution::{deprecated_entry_point_execution, entry_point_execution};
use crate::state::errors::StateError;
use crate::state::state_api::State;
Expand Down Expand Up @@ -107,8 +107,14 @@ pub fn execute_entry_point_call(
resources,
context,
),
ContractClass::V1Native(_contract_class) => {
unimplemented!("Native contract entry point execution is not yet implemented.")
ContractClass::V1Native(contract_class) => {
native_entry_point_execution::execute_entry_point_call(
call,
contract_class,
state,
resources,
context,
)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/blockifier/src/execution/native.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod entry_point_execution;
pub mod syscall_handler;
pub mod utils;

Expand Down
Loading

0 comments on commit 120c7cc

Please sign in to comment.