From 102aaef47fbdff1827b65601086b0bb31e2125f6 Mon Sep 17 00:00:00 2001 From: Filippo Costa Date: Wed, 23 Aug 2023 18:54:37 +0200 Subject: [PATCH] Fix merge issues Signed-off-by: Filippo Costa --- module-system/sov-state/src/map.rs | 15 ++++----------- module-system/sov-state/src/vec.rs | 9 +++------ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/module-system/sov-state/src/map.rs b/module-system/sov-state/src/map.rs index 23f1b083b..dee4a2ba3 100644 --- a/module-system/sov-state/src/map.rs +++ b/module-system/sov-state/src/map.rs @@ -37,16 +37,9 @@ impl StateMap { } } -impl StateMap -where - C: StateCodec, -{ - /// Creates a new [`StateMap`] with the given prefix and codec. - /// - /// Note that `codec` must implement [`StateCodec`]. You can use - /// [`PairOfCodecs`](crate::codec::PairOfCodecs) if you wish to decouple key - /// and value codecs. - pub fn with_codec(prefix: Prefix, codec: C) -> Self { +impl StateMap { + /// Creates a new [`StateMap`] with the given prefix and [`StateValueCodec`]. + pub fn with_codec(prefix: Prefix, codec: VC) -> Self { Self { _phantom: (PhantomData, PhantomData), value_codec: codec, @@ -124,7 +117,7 @@ where /// Returns the value corresponding to the key or [`StateMapError`] if key is absent in /// the map. - pub fn get_or_err( + pub fn get_or_err( &self, key: &Q, working_set: &mut WorkingSet, diff --git a/module-system/sov-state/src/vec.rs b/module-system/sov-state/src/vec.rs index 8201c761a..894363564 100644 --- a/module-system/sov-state/src/vec.rs +++ b/module-system/sov-state/src/vec.rs @@ -3,11 +3,9 @@ use std::marker::PhantomData; use thiserror::Error; -use crate::codec::{BorshCodec, PairOfCodecs, StateValueCodec}; +use crate::codec::{BorshCodec, StateValueCodec}; use crate::{Prefix, StateMap, StateValue, Storage, WorkingSet}; -type InternalCodec = PairOfCodecs; - #[derive(Debug, Clone)] pub struct StateVec where @@ -16,7 +14,7 @@ where _phantom: PhantomData, prefix: Prefix, len_value: StateValue, - elems: StateMap>, + elems: StateMap, } /// Error type for `StateVec` get method. @@ -50,8 +48,7 @@ where // details of `StateValue` and `StateMap` as they both have the right to // reserve the whole key space for themselves. let len_value = StateValue::::new(prefix.extended(b"l")); - let elems = - StateMap::with_codec(prefix.extended(b"e"), InternalCodec::new(BorshCodec, codec)); + let elems = StateMap::with_codec(prefix.extended(b"e"), codec); Self { _phantom: PhantomData, prefix,