MCPcopy Create free account
hub / github.com/docknetwork/crypto / compute_random_initial

Method compute_random_initial

vb_accumulator/src/universal.rs:668–683  ·  view source on GitHub ↗
(
        rng: &mut R,
        max_size: u64,
        sk: &SecretKey<G::ScalarField>,
        initial_elements_store: &mut dyn InitialElementsStore<G::ScalarField>,
    )

Source from the content-addressed store, hash-verified

666 }
667
668 fn compute_random_initial<R: RngCore>(
669 rng: &mut R,
670 max_size: u64,
671 sk: &SecretKey<G::ScalarField>,
672 initial_elements_store: &mut dyn InitialElementsStore<G::ScalarField>,
673 ) -> G::ScalarField {
674 let mut f_V = G::ScalarField::one();
675 for _ in 0..max_size + 1 {
676 // Each of the random values should be preserved by the manager and should not be removed (check before removing)
677 // from the accumulator
678 let elem = G::ScalarField::rand(rng);
679 f_V *= elem + sk.0;
680 initial_elements_store.add(elem);
681 }
682 f_V
683 }
684}
685
686#[cfg(test)]

Callers

nothing calls this directly

Calls 2

randFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected