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

Impl SAVE_OUTPUT_POINTER #27

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Changes from 1 commit
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
Next Next commit
Impl SAVE_OUTPUT_POINTER hint
notlesh committed Nov 28, 2023
commit 7bbf08a6597156cec668f32a1cb428106554a8d1
24 changes: 23 additions & 1 deletion madara-prover-rpc-server/src/hints.rs
Original file line number Diff line number Diff line change
@@ -105,6 +105,26 @@ fn unimplemented_hint(
Ok(())
}

/*
Implements hint:
%{
output_start = ids.output_ptr
%}
*/
odesenfans marked this conversation as resolved.
Show resolved Hide resolved
fn save_output_pointer_hint(
_vm: &mut VirtualMachine,
exec_scopes: &mut ExecutionScopes,
ids_data: &HashMap<String, HintReference>,
_ap_tracking: &ApTracking,
_constants: &HashMap<String, Felt252>,
) -> Result<(), HintError> {
let output_ptr = ids_data.get("output_ptr")
.ok_or(HintError::CustomHint("output_ptr unavailable".to_owned().into_boxed_str()))?
notlesh marked this conversation as resolved.
Show resolved Hide resolved
.clone();
exec_scopes.insert_value("output_start", output_ptr);
Ok(())
}

pub fn hint_processor() -> BuiltinHintProcessor {
let mut hint_processor = BuiltinHintProcessor::new_empty();

@@ -126,7 +146,9 @@ pub fn hint_processor() -> BuiltinHintProcessor {
LOAD_BOOTLOADER_CONFIG.to_string(),
unimplemented_hint.clone(),
);
hint_processor.add_hint(SAVE_OUTPUT_POINTER.to_string(), unimplemented_hint.clone());
hint_processor.add_hint(
SAVE_OUTPUT_POINTER.to_string(),
Rc::new(HintFunc(Box::new(save_output_pointer_hint.clone()))));
notlesh marked this conversation as resolved.
Show resolved Hide resolved
hint_processor.add_hint(SAVE_PACKED_OUTPUTS.to_string(), unimplemented_hint.clone());
hint_processor.add_hint(
COMPUTE_FACT_TOPOLOGIES.to_string(),