Split Params into base and developer-defined (#458)
I thought it would be nice to have a Predicate for the typed value so that the developer can work with predicates as values comfortably. Then I noticed that hashing a predicate required `Params` which would have been annoying for converting a `TypedValue::Predicate` to `RawValue` and this led to a small refactor over how `Params` work. We already had some fields in the `Params` struct that determine compatibility between encoded data. They can be seen as determining a kind of ABI compatibility. In general it's better if those parameters don't change so that different circuit configurations can still verify proofs from each other. So I decided to force those parameters to be constant in the code base and not allow the user of our library to change them. Many field element serialization/deserialization functions in our code depended on those parameters, and since now they are constant many functions get rid of the `Params` argument, which simplifies the code. This includes the serialization of a `Predicate` which was required to calculate its hash.
This commit is contained in:
parent
498e946612
commit
a7a30176a7
20 changed files with 376 additions and 468 deletions
|
|
@ -258,21 +258,21 @@ pub fn great_boy_pod_builder(
|
|||
|
||||
let mut great_boy = MainPodBuilder::new(params, vd_set);
|
||||
for good_boy_signed_dict in good_boy_signed_dicts {
|
||||
great_boy.pub_op(Operation::dict_signed_by(good_boy_signed_dict))?;
|
||||
great_boy.priv_op(Operation::dict_signed_by(good_boy_signed_dict))?;
|
||||
}
|
||||
for friend_signed_dict in friend_signed_dicts {
|
||||
great_boy.pub_op(Operation::dict_signed_by(friend_signed_dict))?;
|
||||
great_boy.priv_op(Operation::dict_signed_by(friend_signed_dict))?;
|
||||
}
|
||||
|
||||
for good_boy_idx in 0..2 {
|
||||
for issuer_idx in 0..2 {
|
||||
// Each good boy POD comes from a valid issuer
|
||||
great_boy.pub_op(Operation::set_contains(
|
||||
great_boy.priv_op(Operation::set_contains(
|
||||
good_boy_issuers,
|
||||
good_boy_signed_dicts[good_boy_idx * 2 + issuer_idx].public_key,
|
||||
))?;
|
||||
// Each good boy has 2 good boy pods
|
||||
great_boy.pub_op(Operation::eq(
|
||||
great_boy.priv_op(Operation::eq(
|
||||
(good_boy_signed_dicts[good_boy_idx * 2 + issuer_idx], "user"),
|
||||
friend_signed_dicts[good_boy_idx].public_key,
|
||||
))?;
|
||||
|
|
@ -302,8 +302,6 @@ pub fn great_boy_pod_full_flow() -> Result<MainPodBuilder> {
|
|||
max_signed_by: 6,
|
||||
max_input_pods: 0,
|
||||
max_statements: 100,
|
||||
max_public_statements: 50,
|
||||
num_public_statements_hash: 50,
|
||||
..Default::default()
|
||||
};
|
||||
let vd_set = &*MOCK_VD_SET;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue