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

Method remove

vb_accumulator/src/universal.rs:318–335  ·  view source on GitHub ↗

Remove an element from the accumulator and state. Reads and writes to state. Described in section 2 of the paper

(
        &self,
        element: &G::ScalarField,
        sk: &SecretKey<G::ScalarField>,
        initial_elements_store: &dyn InitialElementsStore<G::ScalarField>,
        state: &mut dyn State<G::S

Source from the content-addressed store, hash-verified

316
317 /// Remove an element from the accumulator and state. Reads and writes to state. Described in section 2 of the paper
318 pub fn remove(
319 &self,
320 element: &G::ScalarField,
321 sk: &SecretKey<G::ScalarField>,
322 initial_elements_store: &dyn InitialElementsStore<G::ScalarField>,
323 state: &mut dyn State<G::ScalarField>,
324 ) -> Result<Self, VBAccumulatorError> {
325 if !self.is_element_acceptable(element, initial_elements_store) {
326 return Err(VBAccumulatorError::ProhibitedElement);
327 }
328
329 // TODO: Check if its more efficient to always have a window table of setup parameter `P` and
330 // multiply `P` by `f_V` rather than multiplying `y_plus_alpha_inv` by `V`. Use `windowed_mul` from FixedBase
331 let (mut y_plus_alpha_inv, V) = self._remove(element, sk, state)?;
332 let f_V = y_plus_alpha_inv * self.f_V;
333 y_plus_alpha_inv.zeroize();
334 Ok(self.get_updated(f_V, V))
335 }
336
337 /// Compute new accumulated value after batch removal
338 pub fn compute_new_post_remove_batch(

Callers 2

Calls 4

is_element_acceptableMethod · 0.80
_removeMethod · 0.80
get_updatedMethod · 0.80
zeroizeMethod · 0.45

Tested by 2