calculate MainPod id in a dynamic-friendly way (#241)
* calculate MainPod id in a dynamic-friendly way The MainPod id is now calculated with front padding and a fixed size independent of max_public_statements so that introduction gadgets can be verified by a MainPod while paying only for the number of statements they use. This is because with front padding of none-statements we can precompute the poseidon state corresponding to absorbing all the padding statements and only pay constraints for the non-padding statements. The id is calculated as follows: `id = hash(serialize(reverse(statements || none-statements)))` * fix test
This commit is contained in:
parent
82481e88d7
commit
d3fef8392e
6 changed files with 245 additions and 26 deletions
|
|
@ -296,11 +296,12 @@ pub fn great_boy_pod_builder(
|
|||
Ok(great_boy)
|
||||
}
|
||||
|
||||
pub fn great_boy_pod_full_flow() -> Result<MainPodBuilder> {
|
||||
pub fn great_boy_pod_full_flow() -> Result<(Params, MainPodBuilder)> {
|
||||
let params = Params {
|
||||
max_input_signed_pods: 6,
|
||||
max_statements: 100,
|
||||
max_public_statements: 50,
|
||||
num_public_statements_id: 50,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
@ -349,7 +350,7 @@ pub fn great_boy_pod_full_flow() -> Result<MainPodBuilder> {
|
|||
good_boy_issuers.into_iter().map(Value::from).collect(),
|
||||
)?);
|
||||
|
||||
great_boy_pod_builder(
|
||||
let builder = great_boy_pod_builder(
|
||||
¶ms,
|
||||
[
|
||||
&bob_good_boys[0],
|
||||
|
|
@ -360,7 +361,9 @@ pub fn great_boy_pod_full_flow() -> Result<MainPodBuilder> {
|
|||
[&alice_friend_pods[0], &alice_friend_pods[1]],
|
||||
&good_boy_issuers,
|
||||
alice,
|
||||
)
|
||||
)?;
|
||||
|
||||
Ok((params, builder))
|
||||
}
|
||||
|
||||
// Tickets
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue