Create 2 `Omega`s for KB universal accumulator. As this accumulator comprises of 2 positive accumulators, this returns 2 `Omega`s, one for each of those accumulators
(
additions: &[G::ScalarField],
removals: &[G::ScalarField],
old_mem_accumulator: &G,
old_non_mem_accumulator: &G,
sk: &SecretKey<G::ScalarField>,
)
| 529 | /// Create 2 `Omega`s for KB universal accumulator. As this accumulator comprises of 2 positive accumulators, this |
| 530 | /// returns 2 `Omega`s, one for each of those accumulators |
| 531 | pub fn new_for_kb_universal_accumulator( |
| 532 | additions: &[G::ScalarField], |
| 533 | removals: &[G::ScalarField], |
| 534 | old_mem_accumulator: &G, |
| 535 | old_non_mem_accumulator: &G, |
| 536 | sk: &SecretKey<G::ScalarField>, |
| 537 | ) -> (Self, Self) { |
| 538 | let m = additions.len(); |
| 539 | let n = removals.len(); |
| 540 | let alpha = &sk.0; |
| 541 | |
| 542 | // mem_add_poly and mem_rem_poly are used to create v_A and v_D for the membership accumulator |
| 543 | |
| 544 | // (additions[0] + alpha), (additions[0] + alpha)*(additions[1] + alpha), ..., (additions[0] + alpha)*(additions[1] + alpha)*...(additions[m-1] + alpha) |
| 545 | let mut factors_add = vec![G::ScalarField::one(); m]; |
| 546 | // (additions[1] - x)*(additions[2] - x)*...(additions[m-1] - x), (additions[2] - x)*(additions[3] - x)*...(additions[m-1] - x), .., 1. For v_A polynomial for membership accumulator |
| 547 | let mut mem_add_poly = |
| 548 | vec![DensePolynomial::from_coefficients_vec(vec![G::ScalarField::one()]); m]; |
| 549 | // 1, (additions[0] - x), (additions[0] - x)*(additions[1] - x), ..., (additions[0] - x)*(additions[1] - x)*...(additions[m-2] - x). For v_D polynomial for non-membership accumulator |
| 550 | let mut non_mem_rem_poly = |
| 551 | vec![DensePolynomial::from_coefficients_vec(vec![G::ScalarField::one()]); m]; |
| 552 | |
| 553 | // (removals[0] + alpha), (removals[0] + alpha)*(removals[1] + alpha), ..., (removals[0] + alpha)*(removals[1] + alpha)*...(removals[n-1] + alpha) |
| 554 | let mut factors_rem = vec![G::ScalarField::one(); n]; |
| 555 | // 1, (removals[0] - x), (removals[0] - x)*(removals[1] - x), ..., (removals[0] - x)*(removals[1] - x)*...(removals[n-2] - x). For v_D polynomial for membership accumulator |
| 556 | let mut mem_rem_poly = |
| 557 | vec![DensePolynomial::from_coefficients_vec(vec![G::ScalarField::one()]); n]; |
| 558 | // (removals[1] - x)*(removals[2] - x)*...(removals[n-1] - x), (removals[2] - x)*(removals[3] - x)*...(removals[n-1] - x), .., 1. For v_A polynomial for non-membership accumulator |
| 559 | let mut non_mem_add_poly = |
| 560 | vec![DensePolynomial::from_coefficients_vec(vec![G::ScalarField::one()]); n]; |
| 561 | |
| 562 | let minus_1 = -G::ScalarField::one(); |
| 563 | |
| 564 | if !additions.is_empty() { |
| 565 | factors_add[0] = additions[0] + alpha; |
| 566 | } |
| 567 | if !removals.is_empty() { |
| 568 | factors_rem[0] = removals[0] + alpha; |
| 569 | } |
| 570 | |
| 571 | for s in 1..m { |
| 572 | factors_add[s] = factors_add[s - 1] * (additions[s] + alpha); |
| 573 | mem_add_poly[m - s - 1] = multiply_poly( |
| 574 | &mem_add_poly[m - s], |
| 575 | &DensePolynomial::from_coefficients_vec(vec![additions[m - s], minus_1]), |
| 576 | ); |
| 577 | non_mem_rem_poly[s] = multiply_poly( |
| 578 | &non_mem_rem_poly[s - 1], |
| 579 | &DensePolynomial::from_coefficients_vec(vec![additions[s - 1], minus_1]), |
| 580 | ); |
| 581 | } |
| 582 | for s in 1..n { |
| 583 | factors_rem[s] = factors_rem[s - 1] * (removals[s] + alpha); |
| 584 | non_mem_add_poly[n - s - 1] = multiply_poly( |
| 585 | &non_mem_add_poly[n - s], |
| 586 | &DensePolynomial::from_coefficients_vec(vec![removals[n - s], minus_1]), |
| 587 | ); |
| 588 | mem_rem_poly[s] = multiply_poly( |
nothing calls this directly
no test coverage detected