From f6edcc4c92f4e498b5f12202323db7b68dff5c72 Mon Sep 17 00:00:00 2001 From: Conrado Gouvea Date: Mon, 21 Feb 2022 22:17:21 -0300 Subject: [PATCH] replace unmantained multiset with mset (#3595) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- Cargo.lock | 9 +++++---- deny.toml | 3 --- zebra-state/Cargo.toml | 7 +------ .../src/service/non_finalized_state/chain.rs | 14 +++++++------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d5a21d2..0d6b4021 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2378,9 +2378,10 @@ dependencies = [ ] [[package]] -name = "multiset" -version = "0.0.5" -source = "git+https://github.com/jmitchell/multiset?rev=91ef8550b518f75ae87ae0d8771150f259fd34d5#91ef8550b518f75ae87ae0d8771150f259fd34d5" +name = "mset" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1cf737c48148e9956a9ea00710258dcf2a7afdedc34a2c672a44866f618dc" [[package]] name = "native-tls" @@ -5617,7 +5618,7 @@ dependencies = [ "jubjub", "lazy_static", "metrics", - "multiset", + "mset", "once_cell", "proptest", "proptest-derive", diff --git a/deny.toml b/deny.toml index 04404342..20247e4d 100644 --- a/deny.toml +++ b/deny.toml @@ -93,9 +93,6 @@ allow-registry = ["https://github.com/rust-lang/crates.io-index"] allow-git = [ # ticket #2982: librustzcash and orchard git versions "https://github.com/str4d/redjubjub", - - # ticket #2523: replace unmaintained multiset - "https://github.com/jmitchell/multiset", ] [sources.allow-org] diff --git a/zebra-state/Cargo.toml b/zebra-state/Cargo.toml index 76ad6706..d731a40a 100644 --- a/zebra-state/Cargo.toml +++ b/zebra-state/Cargo.toml @@ -17,12 +17,7 @@ futures = "0.3.21" hex = "0.4.3" lazy_static = "1.4.0" metrics = "0.17.1" -# TODO: this crate is not maintained anymore. Replace it? -# https://github.com/ZcashFoundation/zebra/issues/2523 -# -# Pinned to a commit which includes bug fix https://github.com/jmitchell/multiset/pull/21 -# The fix should be included in multiset 0.0.6. -multiset = { git = "https://github.com/jmitchell/multiset", rev = "91ef8550b518f75ae87ae0d8771150f259fd34d5" } +mset = "0.1.0" proptest = { version = "0.10.1", optional = true } proptest-derive = { version = "0.3.0", optional = true } regex = "1" diff --git a/zebra-state/src/service/non_finalized_state/chain.rs b/zebra-state/src/service/non_finalized_state/chain.rs index d2d8c84a..27903148 100644 --- a/zebra-state/src/service/non_finalized_state/chain.rs +++ b/zebra-state/src/service/non_finalized_state/chain.rs @@ -6,7 +6,7 @@ use std::{ ops::Deref, }; -use multiset::HashMultiSet; +use mset::MultiSet; use tracing::instrument; use zebra_chain::{ @@ -60,7 +60,7 @@ pub struct Chain { pub(crate) history_tree: HistoryTree, /// The Sprout anchors created by `blocks`. - pub(crate) sprout_anchors: HashMultiSet, + pub(crate) sprout_anchors: MultiSet, /// The Sprout anchors created by each block in `blocks`. pub(crate) sprout_anchors_by_height: BTreeMap, /// The Sprout note commitment tree for each anchor. @@ -68,11 +68,11 @@ pub struct Chain { pub(crate) sprout_trees_by_anchor: HashMap, /// The Sapling anchors created by `blocks`. - pub(crate) sapling_anchors: HashMultiSet, + pub(crate) sapling_anchors: MultiSet, /// The Sapling anchors created by each block in `blocks`. pub(crate) sapling_anchors_by_height: BTreeMap, /// The Orchard anchors created by `blocks`. - pub(crate) orchard_anchors: HashMultiSet, + pub(crate) orchard_anchors: MultiSet, /// The Orchard anchors created by each block in `blocks`. pub(crate) orchard_anchors_by_height: BTreeMap, @@ -119,12 +119,12 @@ impl Chain { sapling_note_commitment_tree, orchard_note_commitment_tree, spent_utxos: Default::default(), - sprout_anchors: HashMultiSet::new(), + sprout_anchors: MultiSet::new(), sprout_anchors_by_height: Default::default(), sprout_trees_by_anchor: Default::default(), - sapling_anchors: HashMultiSet::new(), + sapling_anchors: MultiSet::new(), sapling_anchors_by_height: Default::default(), - orchard_anchors: HashMultiSet::new(), + orchard_anchors: MultiSet::new(), orchard_anchors_by_height: Default::default(), sprout_nullifiers: Default::default(), sapling_nullifiers: Default::default(),