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

bugfix: Mark program extra data as accessed #774

Merged
merged 4 commits into from
Jul 5, 2023
Merged
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
4 changes: 4 additions & 0 deletions src/execution/execution_entry_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,10 @@ impl ExecutionEntryPoint {
Some(program.data_len() + program_extra_data.len()),
)?;

runner
.vm
.mark_address_range_as_accessed(core_program_end_ptr, program_extra_data.len())?;

runner.validate_and_process_os_context(os_context)?;

// When execution starts the stack holds entry_points_args + [ret_fp, ret_pc].
Expand Down
8 changes: 4 additions & 4 deletions tests/cairo_1_syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,15 @@ fn library_call() {
n_steps: 255,
#[cfg(feature = "cairo_1_tests")]
n_steps: 259,
n_memory_holes: 10,
n_memory_holes: 8,
builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 12)]),
};
let expected_execution_resources_internal_call = ExecutionResources {
#[cfg(not(feature = "cairo_1_tests"))]
n_steps: 84,
#[cfg(feature = "cairo_1_tests")]
n_steps: 85,
n_memory_holes: 6,
n_memory_holes: 5,
builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 7)]),
};

Expand Down Expand Up @@ -1130,7 +1130,7 @@ fn test_send_message_to_l1_syscall() {

let expected_execution_resources = ExecutionResources {
n_steps: 50,
n_memory_holes: 1,
n_memory_holes: 0,
builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 2)]),
};

Expand Down Expand Up @@ -1237,7 +1237,7 @@ fn test_get_execution_info() {

let expected_execution_resources = ExecutionResources {
n_steps: 268,
n_memory_holes: 5,
n_memory_holes: 4,
builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 4)]),
};

Expand Down
4 changes: 2 additions & 2 deletions tests/deploy_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn internal_deploy_account_cairo1() {
n_steps: 152,
#[cfg(feature="cairo_1_tests")]
n_steps: 155,
n_memory_holes: 18,
n_memory_holes: 17,
builtin_instance_counter:
[
("range_check_builtin", 2),
Expand Down Expand Up @@ -230,7 +230,7 @@ fn internal_deploy_account_cairo1() {
n_steps: 92,
#[cfg(feature="cairo_1_tests")]
n_steps: 93,
n_memory_holes: 1,
n_memory_holes: 0,
builtin_instance_counter:
[
("range_check_builtin", 2),
Expand Down
2 changes: 1 addition & 1 deletion tests/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ fn integration_test_cairo1() {
retdata: [144.into()].to_vec(),
execution_resources: ExecutionResources {
n_steps: 418,
n_memory_holes: 1,
n_memory_holes: 0,
builtin_instance_counter: HashMap::from([(RANGE_CHECK_BUILTIN_NAME.to_string(), 15)]),
},
class_hash: Some(class_hash),
Expand Down
8 changes: 4 additions & 4 deletions tests/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ fn expected_fib_execute_call_info() -> CallInfo {
n_steps: 157,
#[cfg(feature = "cairo_1_tests")]
n_steps: 160,
n_memory_holes: 1,
n_memory_holes: 0,
builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 4)]),
},
l2_to_l1_messages: vec![],
Expand All @@ -988,7 +988,7 @@ fn expected_fib_execute_call_info() -> CallInfo {
n_steps: 118,
#[cfg(feature = "cairo_1_tests")]
n_steps: 121,
n_memory_holes: 1,
n_memory_holes: 0,
builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 3)]),
},
..Default::default()
Expand Down Expand Up @@ -1826,7 +1826,7 @@ fn test_library_call_with_declare_v2() {
n_steps: 368,
#[cfg(feature = "cairo_1_tests")]
n_steps: 371,
n_memory_holes: 1,
n_memory_holes: 0,
builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 13)]),
},
..Default::default()
Expand All @@ -1850,7 +1850,7 @@ fn test_library_call_with_declare_v2() {
n_steps: 578,
#[cfg(feature = "cairo_1_tests")]
n_steps: 587,
n_memory_holes: 3,
n_memory_holes: 1,
builtin_instance_counter: HashMap::from([("range_check_builtin".to_string(), 16)]),
},
internal_calls: vec![expected_internal_call_info],
Expand Down