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

Fixes to run the bootloader integration tests #37

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7698c76
Fix: make the project compile
odesenfans Dec 21, 2023
7c3c338
Fix: use correct type when setting `simple_bootloader_input`
odesenfans Dec 21, 2023
7b5b3df
Fix: use correct hint code for %{ 0 %}
odesenfans Dec 21, 2023
8d6ccf6
Fix: use correct hint code for validate_hash
odesenfans Dec 21, 2023
baac9ef
Inner select builtins hint: select builtin
odesenfans Dec 21, 2023
9cdcdc5
Fix: consider output_ptr as a relocatable instead of a value
odesenfans Dec 21, 2023
0e7c781
Fix: do not force integer type when copying builtins
odesenfans Dec 26, 2023
4a4d1fb
Fix: output_runner_data is an optional
odesenfans Dec 26, 2023
b1055e4
Fix tests: use relocatables for builtin pointers
odesenfans Dec 26, 2023
615866b
Fix: treat output pointers as relocatables in append_fact_topologies
odesenfans Dec 26, 2023
0c5c9de
Fix: use correct hint code for nondet %{ ids.num // 2 %}
odesenfans Dec 26, 2023
67d3b46
Fix: use correct hint code for isinstance(packed_output, PlainPackedO…
odesenfans Dec 26, 2023
9fd7790
Fix: remove useless clone() and commented code
odesenfans Jan 3, 2024
640bee9
Fix: hardcode return PC for Cairo PIE
odesenfans Jan 3, 2024
97ebd55
Fix: use pointer instead of integer in write_return_builtins, again
odesenfans Jan 3, 2024
392c4b6
Fix: use program identifiers to determine ret_pc for Cairo PIEs
odesenfans Jan 4, 2024
25d35b1
Fix: deserialize PIE additional data as struct instead of hashmap
odesenfans Jan 11, 2024
c95396d
Fix: call_task test
odesenfans Jan 14, 2024
b7685a1
Fix: deserialize ECDSA builtin data from Python VM format
odesenfans Jan 14, 2024
76622d8
Fix: support loading PIE memory files > 32KB
odesenfans Jan 14, 2024
d3a33c2
Feature: support output pages in public input memory
odesenfans Jan 17, 2024
e0a4653
Feature: deserialize Cairo PIE from bytes
odesenfans Jan 23, 2024
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
50 changes: 50 additions & 0 deletions cairo_programs/manually_compiled/pie_additional_data_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"output_builtin": {
"pages": {
"1": [
18,
46
]
},
"attributes": {
"gps_fact_topology": [
2,
1,
0,
2
]
}
},
"pedersen_builtin": [
[
3,
2
],
[
3,
5
],
[
3,
8
],
[
3,
11
],
[
3,
14
],
[
3,
17
]
],
"range_check_builtin": null,
"ecdsa_builtin": [],
"bitwise_builtin": null,
"ec_op_builtin": null,
"keccak_builtin": null,
"poseidon_builtin": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ pub fn prepare_simple_bootloader_output_segment(
/// Implements %{ simple_bootloader_input = bootloader_input %}
pub fn prepare_simple_bootloader_input(exec_scopes: &mut ExecutionScopes) -> Result<(), HintError> {
let bootloader_input: BootloaderInput = exec_scopes.get(vars::BOOTLOADER_INPUT)?;
exec_scopes.insert_value(vars::SIMPLE_BOOTLOADER_INPUT, bootloader_input);
exec_scopes.insert_value(
vars::SIMPLE_BOOTLOADER_INPUT,
bootloader_input.simple_bootloader_input,
);

Ok(())
}
Expand Down Expand Up @@ -226,6 +229,7 @@ pub fn import_packed_output_schemas() -> Result<(), HintError> {
}

/// Implements %{ isinstance(packed_output, PlainPackedOutput) %}
/// (compiled to %{ memory[ap] = to_felt_or_relocatable(isinstance(packed_output, PlainPackedOutput)) %}).
///
/// Stores the result in the `ap` register to be accessed by the program.
pub fn is_plain_packed_output(
Expand Down Expand Up @@ -564,18 +568,21 @@ mod tests {

prepare_simple_bootloader_input(&mut exec_scopes).expect("Hint failed unexpectedly");

let simple_bootloader_input: BootloaderInput = exec_scopes
let simple_bootloader_input: SimpleBootloaderInput = exec_scopes
.get(vars::SIMPLE_BOOTLOADER_INPUT)
.expect("Simple bootloader input not in scope");
assert_eq!(simple_bootloader_input, bootloader_input);
assert_eq!(
simple_bootloader_input,
bootloader_input.simple_bootloader_input
);
}

#[test]
fn test_restore_bootloader_output() {
let mut vm: VirtualMachine = vm!();
// The VM must have an existing output segment
vm.builtin_runners =
vec![OutputBuiltinRunner::from_segment(&vm.add_memory_segment(), true).into()];
let output_segment = vm.add_memory_segment();
vm.builtin_runners = vec![OutputBuiltinRunner::from_segment(&output_segment, true).into()];

let mut exec_scopes = ExecutionScopes::new();
let new_segment = vm.add_memory_segment();
Expand Down
Loading
Loading