From b858bd89a51575b4122740ba73009302473b76a0 Mon Sep 17 00:00:00 2001 From: Alan Szepieniec Date: Tue, 25 Jul 2023 17:33:33 +0200 Subject: [PATCH] derive BFieldCodec for MutatorSetAccumulator --- src/util_types/mutator_set/active_window.rs | 1 + .../mutator_set/mutator_set_accumulator.rs | 19 +------------------ 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/util_types/mutator_set/active_window.rs b/src/util_types/mutator_set/active_window.rs index 066d2551..a11aa25c 100644 --- a/src/util_types/mutator_set/active_window.rs +++ b/src/util_types/mutator_set/active_window.rs @@ -13,6 +13,7 @@ use super::shared::{CHUNK_SIZE, WINDOW_SIZE}; pub struct ActiveWindow { // It's OK to store this in memory, since it's on the size of kilobytes, not gigabytes. pub sbf: Vec, + #[bfield_codec(ignore)] _hasher: PhantomData, } diff --git a/src/util_types/mutator_set/mutator_set_accumulator.rs b/src/util_types/mutator_set/mutator_set_accumulator.rs index 4cea6b92..6921a11c 100644 --- a/src/util_types/mutator_set/mutator_set_accumulator.rs +++ b/src/util_types/mutator_set/mutator_set_accumulator.rs @@ -13,7 +13,7 @@ use super::{ mutator_set_trait::MutatorSet, removal_record::RemovalRecord, }; -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, GetSize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, GetSize, BFieldCodec)] pub struct MutatorSetAccumulator { pub kernel: MutatorSetKernel>, } @@ -95,23 +95,6 @@ impl MutatorSet for MutatorSetAccumulator BFieldCodec for MutatorSetAccumulator { - fn decode( - sequence: &[twenty_first::shared_math::b_field_element::BFieldElement], - ) -> anyhow::Result> { - let kernel = *MutatorSetKernel::decode(sequence)?; - Ok(Box::new(Self { kernel })) - } - - fn encode(&self) -> Vec { - self.kernel.encode() - } - - fn static_length() -> Option { - None - } -} - #[cfg(test)] mod ms_accumulator_tests { use crate::util_types::test_shared::mutator_set::*;