build(deps): bump serde from 1.0.156 to 1.0.158 (#6358)

* build(deps): bump serde from 1.0.156 to 1.0.158

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.156 to 1.0.158.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.156...v1.0.158)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Make MERKLE_DEPTH into a u8 to avoid a spurious serde_derive warning

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: teor <teor@riseup.net>
This commit is contained in:
dependabot[bot] 2023-03-22 17:12:34 +00:00 committed by GitHub
parent 8003116882
commit 45a96b5adc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 40 additions and 42 deletions

View File

@ -4010,9 +4010,9 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.156" version = "1.0.158"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4" checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -4028,13 +4028,13 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.156" version = "1.0.158"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad"
dependencies = [ dependencies = [
"proc-macro2 1.0.52", "proc-macro2 1.0.52",
"quote 1.0.26", "quote 1.0.26",
"syn 1.0.104", "syn 2.0.3",
] ]
[[package]] [[package]]

View File

@ -74,7 +74,7 @@ tracing = "0.1.37"
# Serialization # Serialization
hex = { version = "0.4.3", features = ["serde"] } hex = { version = "0.4.3", features = ["serde"] }
serde = { version = "1.0.156", features = ["serde_derive", "rc"] } serde = { version = "1.0.158", features = ["serde_derive", "rc"] }
serde_with = "2.3.1" serde_with = "2.3.1"
serde-big-array = "0.5.1" serde-big-array = "0.5.1"

View File

@ -11,7 +11,7 @@ fn empty_roots() {
assert_eq!( assert_eq!(
EMPTY_ROOTS[i].to_repr(), EMPTY_ROOTS[i].to_repr(),
// The test vector is in reversed order. // The test vector is in reversed order.
vectors::EMPTY_ROOTS[MERKLE_DEPTH - i] vectors::EMPTY_ROOTS[usize::from(MERKLE_DEPTH) - i]
); );
} }
} }

View File

@ -36,7 +36,7 @@ use crate::serialization::{
/// Unfortunately, this is not the same as `orchard::NoteCommitment`. /// Unfortunately, this is not the same as `orchard::NoteCommitment`.
pub type NoteCommitmentUpdate = pallas::Base; pub type NoteCommitmentUpdate = pallas::Base;
pub(super) const MERKLE_DEPTH: usize = 32; pub(super) const MERKLE_DEPTH: u8 = 32;
/// MerkleCRH^Orchard Hash Function /// MerkleCRH^Orchard Hash Function
/// ///
@ -56,7 +56,7 @@ fn merkle_crh_orchard(layer: u8, left: pallas::Base, right: pallas::Base) -> pal
let mut s = bitvec![u8, Lsb0;]; let mut s = bitvec![u8, Lsb0;];
// Prefix: l = I2LEBSP_10(MerkleDepth^Orchard 1 layer) // Prefix: l = I2LEBSP_10(MerkleDepth^Orchard 1 layer)
let l = MERKLE_DEPTH - 1 - layer as usize; let l = MERKLE_DEPTH - 1 - layer;
s.extend_from_bitslice(&BitArray::<_, Lsb0>::from([l, 0])[0..10]); s.extend_from_bitslice(&BitArray::<_, Lsb0>::from([l, 0])[0..10]);
s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(left.to_repr())[0..255]); s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(left.to_repr())[0..255]);
s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(right.to_repr())[0..255]); s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(right.to_repr())[0..255]);
@ -83,7 +83,7 @@ lazy_static! {
{ {
// The vector is generated from the end, pushing new nodes to its beginning. // The vector is generated from the end, pushing new nodes to its beginning.
// For this reason, the layer below is v[0]. // For this reason, the layer below is v[0].
let next = merkle_crh_orchard(layer as u8, v[0], v[0]); let next = merkle_crh_orchard(layer, v[0], v[0]);
v.insert(0, next); v.insert(0, next);
} }
@ -196,7 +196,7 @@ impl merkle_tree::Hashable for Node {
fn combine(level: usize, a: &Self, b: &Self) -> Self { fn combine(level: usize, a: &Self, b: &Self) -> Self {
let level = u8::try_from(level).expect("level must fit into u8"); let level = u8::try_from(level).expect("level must fit into u8");
let layer = (MERKLE_DEPTH - 1) as u8 - level; let layer = MERKLE_DEPTH - 1 - level;
Self(merkle_crh_orchard(layer, a.0, b.0)) Self(merkle_crh_orchard(layer, a.0, b.0))
} }
@ -205,7 +205,7 @@ impl merkle_tree::Hashable for Node {
} }
fn empty_root(level: usize) -> Self { fn empty_root(level: usize) -> Self {
let layer_below: usize = MERKLE_DEPTH - level; let layer_below = usize::from(MERKLE_DEPTH) - level;
Self(EMPTY_ROOTS[layer_below]) Self(EMPTY_ROOTS[layer_below])
} }
} }
@ -219,13 +219,13 @@ impl incrementalmerkletree::Hashable for Node {
/// Level 0 is the layer above the leaves (layer 31). /// Level 0 is the layer above the leaves (layer 31).
/// Level 31 is the root (layer 0). /// Level 31 is the root (layer 0).
fn combine(level: incrementalmerkletree::Altitude, a: &Self, b: &Self) -> Self { fn combine(level: incrementalmerkletree::Altitude, a: &Self, b: &Self) -> Self {
let layer = (MERKLE_DEPTH - 1) as u8 - u8::from(level); let layer = MERKLE_DEPTH - 1 - u8::from(level);
Self(merkle_crh_orchard(layer, a.0, b.0)) Self(merkle_crh_orchard(layer, a.0, b.0))
} }
/// Return the node for the level below the given level. (A quirk of the API) /// Return the node for the level below the given level. (A quirk of the API)
fn empty_root(level: incrementalmerkletree::Altitude) -> Self { fn empty_root(level: incrementalmerkletree::Altitude) -> Self {
let layer_below: usize = MERKLE_DEPTH - usize::from(level); let layer_below = usize::from(MERKLE_DEPTH) - usize::from(level);
Self(EMPTY_ROOTS[layer_below]) Self(EMPTY_ROOTS[layer_below])
} }
} }
@ -282,7 +282,7 @@ pub struct NoteCommitmentTree {
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree> /// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
/// ///
/// Note: MerkleDepth^Orchard = MERKLE_DEPTH = 32. /// Note: MerkleDepth^Orchard = MERKLE_DEPTH = 32.
inner: bridgetree::Frontier<Node, { MERKLE_DEPTH as u8 }>, inner: bridgetree::Frontier<Node, MERKLE_DEPTH>,
/// A cached root of the tree. /// A cached root of the tree.
/// ///

View File

@ -21,7 +21,7 @@ fn empty_roots() {
assert_eq!( assert_eq!(
hex::encode(EMPTY_ROOTS[i]), hex::encode(EMPTY_ROOTS[i]),
// The test vector is in reversed order. // The test vector is in reversed order.
test_vectors::HEX_EMPTY_ROOTS[MERKLE_DEPTH - i] test_vectors::HEX_EMPTY_ROOTS[usize::from(MERKLE_DEPTH) - i]
); );
} }
} }

View File

@ -19,13 +19,11 @@ use std::{
}; };
use bitvec::prelude::*; use bitvec::prelude::*;
use incrementalmerkletree::{ use incrementalmerkletree::{
bridgetree::{self, Leaf}, bridgetree::{self, Leaf},
Frontier, Frontier,
}; };
use lazy_static::lazy_static; use lazy_static::lazy_static;
use thiserror::Error; use thiserror::Error;
use zcash_encoding::{Optional, Vector}; use zcash_encoding::{Optional, Vector};
use zcash_primitives::merkle_tree::{self, Hashable}; use zcash_primitives::merkle_tree::{self, Hashable};
@ -41,7 +39,7 @@ use crate::serialization::{
/// Unfortunately, this is not the same as `sapling::NoteCommitment`. /// Unfortunately, this is not the same as `sapling::NoteCommitment`.
pub type NoteCommitmentUpdate = jubjub::Fq; pub type NoteCommitmentUpdate = jubjub::Fq;
pub(super) const MERKLE_DEPTH: usize = 32; pub(super) const MERKLE_DEPTH: u8 = 32;
/// MerkleCRH^Sapling Hash Function /// MerkleCRH^Sapling Hash Function
/// ///
@ -56,7 +54,7 @@ fn merkle_crh_sapling(layer: u8, left: [u8; 32], right: [u8; 32]) -> [u8; 32] {
let mut s = bitvec![u8, Lsb0;]; let mut s = bitvec![u8, Lsb0;];
// Prefix: l = I2LEBSP_6(MerkleDepth^Sapling 1 layer) // Prefix: l = I2LEBSP_6(MerkleDepth^Sapling 1 layer)
let l = (MERKLE_DEPTH - 1) as u8 - layer; let l = MERKLE_DEPTH - 1 - layer;
s.extend_from_bitslice(&BitSlice::<_, Lsb0>::from_element(&l)[0..6]); s.extend_from_bitslice(&BitSlice::<_, Lsb0>::from_element(&l)[0..6]);
s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(left)[0..255]); s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(left)[0..255]);
s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(right)[0..255]); s.extend_from_bitslice(&BitArray::<_, Lsb0>::from(right)[0..255]);
@ -79,7 +77,7 @@ lazy_static! {
for layer in (0..MERKLE_DEPTH).rev() { for layer in (0..MERKLE_DEPTH).rev() {
// The vector is generated from the end, pushing new nodes to its beginning. // The vector is generated from the end, pushing new nodes to its beginning.
// For this reason, the layer below is v[0]. // For this reason, the layer below is v[0].
let next = merkle_crh_sapling(layer as u8, v[0], v[0]); let next = merkle_crh_sapling(layer, v[0], v[0]);
v.insert(0, next); v.insert(0, next);
} }
@ -200,7 +198,7 @@ impl merkle_tree::Hashable for Node {
fn combine(level: usize, a: &Self, b: &Self) -> Self { fn combine(level: usize, a: &Self, b: &Self) -> Self {
let level = u8::try_from(level).expect("level must fit into u8"); let level = u8::try_from(level).expect("level must fit into u8");
let layer = (MERKLE_DEPTH - 1) as u8 - level; let layer = MERKLE_DEPTH - 1 - level;
Self(merkle_crh_sapling(layer, a.0, b.0)) Self(merkle_crh_sapling(layer, a.0, b.0))
} }
@ -209,7 +207,7 @@ impl merkle_tree::Hashable for Node {
} }
fn empty_root(level: usize) -> Self { fn empty_root(level: usize) -> Self {
let layer_below = MERKLE_DEPTH - level; let layer_below = usize::from(MERKLE_DEPTH) - level;
Self(EMPTY_ROOTS[layer_below]) Self(EMPTY_ROOTS[layer_below])
} }
} }
@ -223,13 +221,13 @@ impl incrementalmerkletree::Hashable for Node {
/// Level 0 is the layer above the leaves (layer 31). /// Level 0 is the layer above the leaves (layer 31).
/// Level 31 is the root (layer 0). /// Level 31 is the root (layer 0).
fn combine(level: incrementalmerkletree::Altitude, a: &Self, b: &Self) -> Self { fn combine(level: incrementalmerkletree::Altitude, a: &Self, b: &Self) -> Self {
let layer = (MERKLE_DEPTH - 1) as u8 - u8::from(level); let layer = MERKLE_DEPTH - 1 - u8::from(level);
Self(merkle_crh_sapling(layer, a.0, b.0)) Self(merkle_crh_sapling(layer, a.0, b.0))
} }
/// Return the node for the level below the given level. (A quirk of the API) /// Return the node for the level below the given level. (A quirk of the API)
fn empty_root(level: incrementalmerkletree::Altitude) -> Self { fn empty_root(level: incrementalmerkletree::Altitude) -> Self {
let layer_below: usize = MERKLE_DEPTH - usize::from(level); let layer_below = usize::from(MERKLE_DEPTH) - usize::from(level);
Self(EMPTY_ROOTS[layer_below]) Self(EMPTY_ROOTS[layer_below])
} }
} }
@ -287,7 +285,7 @@ pub struct NoteCommitmentTree {
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree> /// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
/// ///
/// Note: MerkleDepth^Sapling = MERKLE_DEPTH = 32. /// Note: MerkleDepth^Sapling = MERKLE_DEPTH = 32.
inner: bridgetree::Frontier<Node, { MERKLE_DEPTH as u8 }>, inner: bridgetree::Frontier<Node, MERKLE_DEPTH>,
/// A cached root of the tree. /// A cached root of the tree.
/// ///

View File

@ -4,16 +4,16 @@ use std::sync::Arc;
use color_eyre::eyre; use color_eyre::eyre;
use eyre::Result; use eyre::Result;
use hex::FromHex; use hex::FromHex;
use zebra_test::vectors; use zebra_test::vectors;
use crate::block::Block; use crate::{
use crate::parameters::{Network, NetworkUpgrade}; block::Block,
use crate::serialization::ZcashDeserializeInto; parameters::{Network, NetworkUpgrade},
use crate::sprout::commitment::NoteCommitment; serialization::ZcashDeserializeInto,
use crate::sprout::tests::test_vectors; sprout::{commitment::NoteCommitment, tests::test_vectors, tree},
use crate::sprout::tree; };
/// Tests if empty roots are generated correctly. /// Tests if empty roots are generated correctly.
#[test] #[test]
@ -24,7 +24,7 @@ fn empty_roots() {
assert_eq!( assert_eq!(
hex::encode(tree::EMPTY_ROOTS[i]), hex::encode(tree::EMPTY_ROOTS[i]),
// The test vector is in reversed order. // The test vector is in reversed order.
test_vectors::HEX_EMPTY_ROOTS[tree::MERKLE_DEPTH - i] test_vectors::HEX_EMPTY_ROOTS[usize::from(tree::MERKLE_DEPTH) - i]
); );
} }
} }

View File

@ -26,7 +26,7 @@ use proptest_derive::Arbitrary;
/// Sprout note commitment trees have a max depth of 29. /// Sprout note commitment trees have a max depth of 29.
/// ///
/// <https://zips.z.cash/protocol/protocol.pdf#constants> /// <https://zips.z.cash/protocol/protocol.pdf#constants>
pub(super) const MERKLE_DEPTH: usize = 29; pub(super) const MERKLE_DEPTH: u8 = 29;
/// [MerkleCRH^Sprout] Hash Function. /// [MerkleCRH^Sprout] Hash Function.
/// ///
@ -153,7 +153,7 @@ impl incrementalmerkletree::Hashable for Node {
/// Returns the node for the level below the given level. (A quirk of the API) /// Returns the node for the level below the given level. (A quirk of the API)
fn empty_root(level: incrementalmerkletree::Altitude) -> Self { fn empty_root(level: incrementalmerkletree::Altitude) -> Self {
let layer_below: usize = MERKLE_DEPTH - usize::from(level); let layer_below = usize::from(MERKLE_DEPTH) - usize::from(level);
Self(EMPTY_ROOTS[layer_below]) Self(EMPTY_ROOTS[layer_below])
} }
} }
@ -222,7 +222,7 @@ pub struct NoteCommitmentTree {
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree> /// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
/// ///
/// Note: MerkleDepth^Sprout = MERKLE_DEPTH = 29. /// Note: MerkleDepth^Sprout = MERKLE_DEPTH = 29.
inner: bridgetree::Frontier<Node, { MERKLE_DEPTH as u8 }>, inner: bridgetree::Frontier<Node, MERKLE_DEPTH>,
/// A cached root of the tree. /// A cached root of the tree.
/// ///

View File

@ -33,7 +33,7 @@ chrono = { version = "0.4.24", default-features = false, features = ["clock", "s
displaydoc = "0.2.3" displaydoc = "0.2.3"
lazy_static = "1.4.0" lazy_static = "1.4.0"
once_cell = "1.17.1" once_cell = "1.17.1"
serde = { version = "1.0.156", features = ["serde_derive"] } serde = { version = "1.0.158", features = ["serde_derive"] }
futures = "0.3.27" futures = "0.3.27"
futures-util = "0.3.26" futures-util = "0.3.26"

View File

@ -27,7 +27,7 @@ pin-project = "1.0.12"
rand = { version = "0.8.5", package = "rand" } rand = { version = "0.8.5", package = "rand" }
rayon = "1.7.0" rayon = "1.7.0"
regex = "1.7.2" regex = "1.7.2"
serde = { version = "1.0.156", features = ["serde_derive"] } serde = { version = "1.0.158", features = ["serde_derive"] }
thiserror = "1.0.40" thiserror = "1.0.40"
futures = "0.3.27" futures = "0.3.27"

View File

@ -53,7 +53,7 @@ tower = "0.4.13"
tracing = "0.1.37" tracing = "0.1.37"
hex = { version = "0.4.3", features = ["serde"] } hex = { version = "0.4.3", features = ["serde"] }
serde = { version = "1.0.156", features = ["serde_derive"] } serde = { version = "1.0.158", features = ["serde_derive"] }
# Experimental feature getblocktemplate-rpcs # Experimental feature getblocktemplate-rpcs
rand = { version = "0.8.5", package = "rand", optional = true } rand = { version = "0.8.5", package = "rand", optional = true }

View File

@ -42,7 +42,7 @@ mset = "0.1.1"
regex = "1.7.2" regex = "1.7.2"
rlimit = "0.9.1" rlimit = "0.9.1"
rocksdb = { version = "0.20.1", default_features = false, features = ["lz4"] } rocksdb = { version = "0.20.1", default_features = false, features = ["lz4"] }
serde = { version = "1.0.156", features = ["serde_derive"] } serde = { version = "1.0.158", features = ["serde_derive"] }
tempfile = "3.4.0" tempfile = "3.4.0"
thiserror = "1.0.40" thiserror = "1.0.40"

View File

@ -108,7 +108,7 @@ chrono = { version = "0.4.24", default-features = false, features = ["clock", "s
humantime-serde = "1.1.1" humantime-serde = "1.1.1"
indexmap = "1.9.2" indexmap = "1.9.2"
lazy_static = "1.4.0" lazy_static = "1.4.0"
serde = { version = "1.0.156", features = ["serde_derive"] } serde = { version = "1.0.158", features = ["serde_derive"] }
toml = "0.7.3" toml = "0.7.3"
futures = "0.3.27" futures = "0.3.27"