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:
parent
8003116882
commit
45a96b5adc
10
Cargo.lock
10
Cargo.lock
|
@ -4010,9 +4010,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.156"
|
||||
version = "1.0.158"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4"
|
||||
checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -4028,13 +4028,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.156"
|
||||
version = "1.0.158"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d"
|
||||
checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.52",
|
||||
"quote 1.0.26",
|
||||
"syn 1.0.104",
|
||||
"syn 2.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -74,7 +74,7 @@ tracing = "0.1.37"
|
|||
|
||||
# Serialization
|
||||
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-big-array = "0.5.1"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ fn empty_roots() {
|
|||
assert_eq!(
|
||||
EMPTY_ROOTS[i].to_repr(),
|
||||
// The test vector is in reversed order.
|
||||
vectors::EMPTY_ROOTS[MERKLE_DEPTH - i]
|
||||
vectors::EMPTY_ROOTS[usize::from(MERKLE_DEPTH) - i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ use crate::serialization::{
|
|||
/// Unfortunately, this is not the same as `orchard::NoteCommitment`.
|
||||
pub type NoteCommitmentUpdate = pallas::Base;
|
||||
|
||||
pub(super) const MERKLE_DEPTH: usize = 32;
|
||||
pub(super) const MERKLE_DEPTH: u8 = 32;
|
||||
|
||||
/// 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;];
|
||||
|
||||
// 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(left.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.
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ impl merkle_tree::Hashable for Node {
|
|||
|
||||
fn combine(level: usize, a: &Self, b: &Self) -> Self {
|
||||
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))
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ impl merkle_tree::Hashable for Node {
|
|||
}
|
||||
|
||||
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])
|
||||
}
|
||||
}
|
||||
|
@ -219,13 +219,13 @@ impl incrementalmerkletree::Hashable for Node {
|
|||
/// Level 0 is the layer above the leaves (layer 31).
|
||||
/// Level 31 is the root (layer 0).
|
||||
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))
|
||||
}
|
||||
|
||||
/// Return the node for the level below the given level. (A quirk of the API)
|
||||
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])
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ pub struct NoteCommitmentTree {
|
|||
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
|
|
|
@ -21,7 +21,7 @@ fn empty_roots() {
|
|||
assert_eq!(
|
||||
hex::encode(EMPTY_ROOTS[i]),
|
||||
// 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]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,11 @@ use std::{
|
|||
};
|
||||
|
||||
use bitvec::prelude::*;
|
||||
|
||||
use incrementalmerkletree::{
|
||||
bridgetree::{self, Leaf},
|
||||
Frontier,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use thiserror::Error;
|
||||
use zcash_encoding::{Optional, Vector};
|
||||
use zcash_primitives::merkle_tree::{self, Hashable};
|
||||
|
@ -41,7 +39,7 @@ use crate::serialization::{
|
|||
/// Unfortunately, this is not the same as `sapling::NoteCommitment`.
|
||||
pub type NoteCommitmentUpdate = jubjub::Fq;
|
||||
|
||||
pub(super) const MERKLE_DEPTH: usize = 32;
|
||||
pub(super) const MERKLE_DEPTH: u8 = 32;
|
||||
|
||||
/// 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;];
|
||||
|
||||
// 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(&BitArray::<_, Lsb0>::from(left)[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() {
|
||||
// The vector is generated from the end, pushing new nodes to its beginning.
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -200,7 +198,7 @@ impl merkle_tree::Hashable for Node {
|
|||
|
||||
fn combine(level: usize, a: &Self, b: &Self) -> Self {
|
||||
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))
|
||||
}
|
||||
|
||||
|
@ -209,7 +207,7 @@ impl merkle_tree::Hashable for Node {
|
|||
}
|
||||
|
||||
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])
|
||||
}
|
||||
}
|
||||
|
@ -223,13 +221,13 @@ impl incrementalmerkletree::Hashable for Node {
|
|||
/// Level 0 is the layer above the leaves (layer 31).
|
||||
/// Level 31 is the root (layer 0).
|
||||
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))
|
||||
}
|
||||
|
||||
/// Return the node for the level below the given level. (A quirk of the API)
|
||||
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])
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +285,7 @@ pub struct NoteCommitmentTree {
|
|||
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
|
|
|
@ -4,16 +4,16 @@ use std::sync::Arc;
|
|||
|
||||
use color_eyre::eyre;
|
||||
use eyre::Result;
|
||||
|
||||
use hex::FromHex;
|
||||
|
||||
use zebra_test::vectors;
|
||||
|
||||
use crate::block::Block;
|
||||
use crate::parameters::{Network, NetworkUpgrade};
|
||||
use crate::serialization::ZcashDeserializeInto;
|
||||
use crate::sprout::commitment::NoteCommitment;
|
||||
use crate::sprout::tests::test_vectors;
|
||||
use crate::sprout::tree;
|
||||
use crate::{
|
||||
block::Block,
|
||||
parameters::{Network, NetworkUpgrade},
|
||||
serialization::ZcashDeserializeInto,
|
||||
sprout::{commitment::NoteCommitment, tests::test_vectors, tree},
|
||||
};
|
||||
|
||||
/// Tests if empty roots are generated correctly.
|
||||
#[test]
|
||||
|
@ -24,7 +24,7 @@ fn empty_roots() {
|
|||
assert_eq!(
|
||||
hex::encode(tree::EMPTY_ROOTS[i]),
|
||||
// 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]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ use proptest_derive::Arbitrary;
|
|||
/// Sprout note commitment trees have a max depth of 29.
|
||||
///
|
||||
/// <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.
|
||||
///
|
||||
|
@ -153,7 +153,7 @@ impl incrementalmerkletree::Hashable for Node {
|
|||
|
||||
/// Returns the node for the level below the given level. (A quirk of the API)
|
||||
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])
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ pub struct NoteCommitmentTree {
|
|||
/// <https://zips.z.cash/protocol/protocol.pdf#merkletree>
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
|
|
|
@ -33,7 +33,7 @@ chrono = { version = "0.4.24", default-features = false, features = ["clock", "s
|
|||
displaydoc = "0.2.3"
|
||||
lazy_static = "1.4.0"
|
||||
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-util = "0.3.26"
|
||||
|
|
|
@ -27,7 +27,7 @@ pin-project = "1.0.12"
|
|||
rand = { version = "0.8.5", package = "rand" }
|
||||
rayon = "1.7.0"
|
||||
regex = "1.7.2"
|
||||
serde = { version = "1.0.156", features = ["serde_derive"] }
|
||||
serde = { version = "1.0.158", features = ["serde_derive"] }
|
||||
thiserror = "1.0.40"
|
||||
|
||||
futures = "0.3.27"
|
||||
|
|
|
@ -53,7 +53,7 @@ tower = "0.4.13"
|
|||
tracing = "0.1.37"
|
||||
|
||||
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
|
||||
rand = { version = "0.8.5", package = "rand", optional = true }
|
||||
|
|
|
@ -42,7 +42,7 @@ mset = "0.1.1"
|
|||
regex = "1.7.2"
|
||||
rlimit = "0.9.1"
|
||||
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"
|
||||
thiserror = "1.0.40"
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ chrono = { version = "0.4.24", default-features = false, features = ["clock", "s
|
|||
humantime-serde = "1.1.1"
|
||||
indexmap = "1.9.2"
|
||||
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"
|
||||
|
||||
futures = "0.3.27"
|
||||
|
|
Loading…
Reference in New Issue