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

feat: remove FALCON_SIG_TO_STACK event #1703

Merged
merged 10 commits into from
Mar 19, 2025
Merged

Conversation

plafer
Copy link
Contributor

@plafer plafer commented Mar 18, 2025

Supersedes #1647

The issue with #1647 is that we still don't package the event handlers with the library. Hence, users still cannot define event handlers with their libraries, since they won't be able to ship them e.g. to some delegated prover.

This PR then applies this suggestion in isolation, effectively cleaning up the tech debt associated with the FALCON_SIG_TO_STACK event.

@plafer plafer requested a review from bobbinth March 18, 2025 19:29
Comment on lines 220 to 217
// key is in the advice provider and uses it to in signature generation
#[cfg(any(test, feature = "testing"))]
if event_id == crate::utils::EVENT_FALCON_SIG_TO_STACK {
let advice_provider = self.advice_provider_mut();
push_signature(advice_provider, process, SignatureKind::RpoFalcon512)
} else {
#[cfg(feature = "std")]
std::println!(
"Event with id {} emitted at step {} in context {}",
event_id,
process.clk(),
process.ctx()
);
Ok(())
return test::push_falcon_signature(advice_provider, process);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this here since our Test struct uses DefaultHost instead of some TestHost. But I don't think anyone uses DefaultHost anyways, so its main use is probably just tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe add a very brief comment here as well (basically, saying what you said in the comment above).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy
@plafer plafer force-pushed the plafer-cleanup-falcon-event branch from f49818b to eeca630 Compare March 18, 2025 19:33

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good! I added some comments inline - but nothing too significant.

We'll probably also need a parallel PR in miden-base to introduce the signature verification event there.

The issue with #1647 is that we still don't package the event handlers with the library. Hence, users still cannot define event handlers with their libraries, since they won't be able to ship them e.g. to some delegated prover.

I think we still may want to do this - but the event handlers could probably be much simpler. So, I wouldn't close #1584 just yet.

Comment on lines 220 to 217
// key is in the advice provider and uses it to in signature generation
#[cfg(any(test, feature = "testing"))]
if event_id == crate::utils::EVENT_FALCON_SIG_TO_STACK {
let advice_provider = self.advice_provider_mut();
push_signature(advice_provider, process, SignatureKind::RpoFalcon512)
} else {
#[cfg(feature = "std")]
std::println!(
"Event with id {} emitted at step {} in context {}",
event_id,
process.clk(),
process.ctx()
);
Ok(())
return test::push_falcon_signature(advice_provider, process);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe add a very brief comment here as well (basically, saying what you said in the comment above).

Copy link
Collaborator

@Al-Kindi-0 Al-Kindi-0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

plafer added 2 commits March 19, 2025 11:00

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy
@plafer
Copy link
Contributor Author

plafer commented Mar 19, 2025

Also added move_sig_from_map_to_adv_stack procedure, as discussed in #1703 (comment)

@plafer plafer requested a review from bobbinth March 19, 2025 16:31
plafer added 4 commits March 19, 2025 12:50

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy

Verified

This commit was signed with the committer’s verified signature.
a-mccarthy Abigail McCarthy
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you! I left a couple of nits inline - some of them can be ignored.

@plafer
Copy link
Contributor Author

plafer commented Mar 19, 2025

miden-base PR: 0xPolygonMiden/miden-base#1232

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good! Thank you!

@plafer plafer merged commit 4437ab5 into next Mar 19, 2025
9 checks passed
@plafer plafer deleted the plafer-cleanup-falcon-event branch March 19, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants