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

simplify ValidityPredicate trait #201

Merged
merged 5 commits into from
Sep 4, 2023
Merged

Conversation

XuyangSong
Copy link
Collaborator

@XuyangSong XuyangSong commented Aug 18, 2023

  • merge the ValidityPredicateInfo trait into ValidityPredicateCircuit trait. Can not merge the ValidityPredicateVerifyingInfo trait because it causes an "unsafe object" compile error when creating a dynamic object.
  • Remove the ValidityPredicateConfig trait and use the concrete ValidityPredicateConfig struct instead since we've unified the VP config. TODO: fix the Sudoku example later, which uses the deprecated ValidityPredicateConfig trait.
  • Rename the confusing app_vp_verifying_info/app_vp_verifying_info_dynamic in the Input/OuputNoteProvingInfo to application_vp/dynamic_vps
  • tried to replace dynamic VP objects to construct partial transactions but failed. I want to keep the flexibility of Taiga VP so that we can support different kinds of circuits(e.g., native halo2 circuit, Vampir circuit, etc.). We could design an upper API that compiles the uniform format(binary or any other intermediate forms) to a concrete VP(circuit) and call/wrap the underlying Taiga API. Like how we did to support Vampir, Vampir compiles the DSL to a uniform and concrete VampirVP(circuit), which implements the ValidityPredicateCircuit of Taiga.

Copy link
Member

@mariari mariari left a comment

Choose a reason for hiding this comment

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

Overall the changes are fine,

It's just that the dyn traits are still there, but this is a good first step

Comment on lines +58 to +59
pub type ValidityPredicate = dyn ValidityPredicateVerifyingInfo;

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this is a fine simplification, seems it is still used everywhere, however this does bring up a question.

Comment on lines 99 to 100
app_vp_verifying_info: Box<dyn ValidityPredicateVerifyingInfo>,
app_vp_verifying_info_dynamic: Vec<Box<dyn ValidityPredicateVerifyingInfo>>,
app_vp_verifying_info: Box<ValidityPredicate>,
app_vp_verifying_info_dynamic: Vec<Box<ValidityPredicate>>,
Copy link
Member

Choose a reason for hiding this comment

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

It seems here we are still essentially being reliant upon a dyn trait, if we were to expand this alias, it ends up being

app_vp_verifying_info: Box<dyn ValidityPredicateVerifyingInfo>
app_vp_verifying_info_dynamic: Vec,Box<dyn ValidityPredicateVerifyingInfo>>

meaning that binding to this is still hard if this is exposed as the outside interface

Comment on lines 106 to 107
app_vp_verifying_info: Box<dyn ValidityPredicateVerifyingInfo>,
app_vp_verifying_info_dynamic: Vec<Box<dyn ValidityPredicateVerifyingInfo>>,
app_vp_verifying_info: Box<ValidityPredicate>,
app_vp_verifying_info_dynamic: Vec<Box<ValidityPredicate>>,
Copy link
Member

Choose a reason for hiding this comment

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

Ditto here

circuit::{vp_circuit::ValidityPredicateInfo, vp_examples::TrivialValidityPredicateCircuit},
circuit::{vp_circuit::ValidityPredicateCircuit, vp_examples::TrivialValidityPredicateCircuit},
Copy link
Member

@mariari mariari Aug 23, 2023

Choose a reason for hiding this comment

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

Probably should have changed with the commit that removed the type,, but good that the bench still works.

@XuyangSong XuyangSong merged commit fc9717a into main Sep 4, 2023
7 checks passed
@XuyangSong XuyangSong deleted the xuyang/simplify_vp_trait branch October 6, 2023 13:45
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.

Refine the ValidityPredicateVerifyingInfo and ValidityPredicateConfig traits
2 participants