Merge pull request #808 from zcash/orchard-0.4

Update dependencies
This commit is contained in:
str4d 2023-04-11 19:25:41 +01:00 committed by GitHub
commit f2f99038db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 201 additions and 57 deletions

View File

@ -21,4 +21,3 @@ codegen-units = 1
[patch.crates-io]
zcash_encoding = { path = "components/zcash_encoding" }
zcash_note_encryption = { path = "components/zcash_note_encryption" }
orchard = { git = "https://github.com/zcash/orchard.git", rev = "bdcf15ba2141f94f031c195140219a99335d96d5" }

View File

@ -15,7 +15,7 @@ categories = ["cryptography::cryptocurrencies", "encoding"]
keywords = ["zcash", "address", "sapling", "unified"]
[dependencies]
bech32 = "0.8"
bech32 = "0.9"
bs58 = { version = "0.4", features = ["check"] }
f4jumble = { version = "0.1", path = "../f4jumble" }
zcash_encoding = { version = "0.2", path = "../zcash_encoding" }

View File

@ -8,7 +8,8 @@ and this library adheres to Rust's notion of
## [Unreleased]
### Changed
- Bumped dependencies to `bls12_381 0.8`, `group 0.13`,
- Bumped dependencies to `bls12_381 0.8`, `group 0.13`, `orchard 0.4`,
`tonic 0.9`, `base64 0.21`, `bech32 0.9`.
- The dependency on `zcash_primitives` no longer enables the `multicore` feature
by default in order to support compilation under `wasm32-wasi`. Users of other
platforms may need to include an explicit dependency on `zcash_primitives`

View File

@ -31,8 +31,8 @@ zcash_primitives = { version = "0.10", path = "../zcash_primitives", default-fea
time = "0.2"
# - Encodings
base64 = "0.13"
bech32 = "0.8"
base64 = "0.21"
bech32 = "0.9"
bs58 = { version = "0.4", features = ["check"] }
# - Errors
@ -44,7 +44,7 @@ tracing = "0.1"
# - Protobuf interfaces and gRPC bindings
prost = "0.11"
tonic = { version = "0.8", optional = true }
tonic = { version = "0.9", optional = true }
# - Secret management
secrecy = "0.8"
@ -53,7 +53,7 @@ subtle = "2.2.3"
# - Shielded protocols
bls12_381 = "0.8"
group = "0.13"
orchard = { version = "0.3", default-features = false }
orchard = { version = "0.4", default-features = false }
# - Test dependencies
proptest = { version = "1.0.0", optional = true }
@ -72,7 +72,7 @@ crossbeam-channel = "0.5"
rayon = "1.5"
[build-dependencies]
tonic-build = "0.8"
tonic-build = "0.9"
which = "4"
[dev-dependencies]

View File

@ -235,7 +235,7 @@ pub mod compact_tx_streamer_client {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
@ -291,11 +291,27 @@ pub mod compact_tx_streamer_client {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Return the height of the tip of the best chain
pub async fn get_latest_block(
&mut self,
request: impl tonic::IntoRequest<super::ChainSpec>,
) -> Result<tonic::Response<super::BlockId>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::BlockId>, tonic::Status> {
self.inner
.ready()
.await
@ -309,13 +325,21 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetLatestBlock",
),
);
self.inner.unary(req, path, codec).await
}
/// Return the compact block corresponding to the given block identifier
pub async fn get_block(
&mut self,
request: impl tonic::IntoRequest<super::BlockId>,
) -> Result<
) -> std::result::Result<
tonic::Response<crate::proto::compact_formats::CompactBlock>,
tonic::Status,
> {
@ -332,13 +356,21 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetBlock",
),
);
self.inner.unary(req, path, codec).await
}
/// Return a list of consecutive compact blocks
pub async fn get_block_range(
&mut self,
request: impl tonic::IntoRequest<super::BlockRange>,
) -> Result<
) -> std::result::Result<
tonic::Response<
tonic::codec::Streaming<crate::proto::compact_formats::CompactBlock>,
>,
@ -357,13 +389,21 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange",
);
self.inner.server_streaming(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetBlockRange",
),
);
self.inner.server_streaming(req, path, codec).await
}
/// Return the requested full (not compact) transaction (as from zcashd)
pub async fn get_transaction(
&mut self,
request: impl tonic::IntoRequest<super::TxFilter>,
) -> Result<tonic::Response<super::RawTransaction>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::RawTransaction>, tonic::Status> {
self.inner
.ready()
.await
@ -377,13 +417,21 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetTransaction",
),
);
self.inner.unary(req, path, codec).await
}
/// Submit the given transaction to the Zcash network
pub async fn send_transaction(
&mut self,
request: impl tonic::IntoRequest<super::RawTransaction>,
) -> Result<tonic::Response<super::SendResponse>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::SendResponse>, tonic::Status> {
self.inner
.ready()
.await
@ -397,13 +445,21 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"SendTransaction",
),
);
self.inner.unary(req, path, codec).await
}
/// Return the txids corresponding to the given t-address within the given block range
pub async fn get_taddress_txids(
&mut self,
request: impl tonic::IntoRequest<super::TransparentAddressBlockFilter>,
) -> Result<
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::RawTransaction>>,
tonic::Status,
> {
@ -420,12 +476,20 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids",
);
self.inner.server_streaming(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetTaddressTxids",
),
);
self.inner.server_streaming(req, path, codec).await
}
pub async fn get_taddress_balance(
&mut self,
request: impl tonic::IntoRequest<super::AddressList>,
) -> Result<tonic::Response<super::Balance>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::Balance>, tonic::Status> {
self.inner
.ready()
.await
@ -439,12 +503,20 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetTaddressBalance",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_taddress_balance_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::Address>,
) -> Result<tonic::Response<super::Balance>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::Balance>, tonic::Status> {
self.inner
.ready()
.await
@ -458,9 +530,15 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream",
);
self.inner
.client_streaming(request.into_streaming_request(), path, codec)
.await
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetTaddressBalanceStream",
),
);
self.inner.client_streaming(req, path, codec).await
}
/// Return the compact transactions currently in the mempool; the results
/// can be a few seconds out of date. If the Exclude list is empty, return
@ -474,7 +552,7 @@ pub mod compact_tx_streamer_client {
pub async fn get_mempool_tx(
&mut self,
request: impl tonic::IntoRequest<super::Exclude>,
) -> Result<
) -> std::result::Result<
tonic::Response<
tonic::codec::Streaming<crate::proto::compact_formats::CompactTx>,
>,
@ -493,14 +571,22 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx",
);
self.inner.server_streaming(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetMempoolTx",
),
);
self.inner.server_streaming(req, path, codec).await
}
/// Return a stream of current Mempool transactions. This will keep the output stream open while
/// there are mempool transactions. It will close the returned stream when a new block is mined.
pub async fn get_mempool_stream(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> Result<
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::RawTransaction>>,
tonic::Status,
> {
@ -517,7 +603,15 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream",
);
self.inner.server_streaming(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetMempoolStream",
),
);
self.inner.server_streaming(req, path, codec).await
}
/// GetTreeState returns the note commitment tree state corresponding to the given block.
/// See section 3.7 of the Zcash protocol specification. It returns several other useful
@ -526,7 +620,7 @@ pub mod compact_tx_streamer_client {
pub async fn get_tree_state(
&mut self,
request: impl tonic::IntoRequest<super::BlockId>,
) -> Result<tonic::Response<super::TreeState>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::TreeState>, tonic::Status> {
self.inner
.ready()
.await
@ -540,12 +634,20 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetTreeState",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_latest_tree_state(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> Result<tonic::Response<super::TreeState>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::TreeState>, tonic::Status> {
self.inner
.ready()
.await
@ -559,12 +661,23 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestTreeState",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetLatestTreeState",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_address_utxos(
&mut self,
request: impl tonic::IntoRequest<super::GetAddressUtxosArg>,
) -> Result<tonic::Response<super::GetAddressUtxosReplyList>, tonic::Status> {
) -> std::result::Result<
tonic::Response<super::GetAddressUtxosReplyList>,
tonic::Status,
> {
self.inner
.ready()
.await
@ -578,12 +691,20 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetAddressUtxos",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_address_utxos_stream(
&mut self,
request: impl tonic::IntoRequest<super::GetAddressUtxosArg>,
) -> Result<
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::GetAddressUtxosReply>>,
tonic::Status,
> {
@ -600,13 +721,21 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream",
);
self.inner.server_streaming(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetAddressUtxosStream",
),
);
self.inner.server_streaming(req, path, codec).await
}
/// Return information about this lightwalletd instance and the blockchain
pub async fn get_lightd_info(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> Result<tonic::Response<super::LightdInfo>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::LightdInfo>, tonic::Status> {
self.inner
.ready()
.await
@ -620,13 +749,21 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cash.z.wallet.sdk.rpc.CompactTxStreamer",
"GetLightdInfo",
),
);
self.inner.unary(req, path, codec).await
}
/// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production)
pub async fn ping(
&mut self,
request: impl tonic::IntoRequest<super::Duration>,
) -> Result<tonic::Response<super::PingResponse>, tonic::Status> {
) -> std::result::Result<tonic::Response<super::PingResponse>, tonic::Status> {
self.inner
.ready()
.await
@ -640,7 +777,12 @@ pub mod compact_tx_streamer_client {
let path = http::uri::PathAndQuery::from_static(
"/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("cash.z.wallet.sdk.rpc.CompactTxStreamer", "Ping"),
);
self.inner.unary(req, path, codec).await
}
}
}

View File

@ -7,6 +7,7 @@
use core::fmt::Debug;
use std::collections::HashMap;
use base64::{prelude::BASE64_URL_SAFE_NO_PAD, Engine};
use nom::{
character::complete::char, combinator::all_consuming, multi::separated_list0,
sequence::preceded,
@ -38,14 +39,15 @@ pub enum Zip321Error {
///
/// [`MemoBytes`]: zcash_primitives::memo::MemoBytes
pub fn memo_to_base64(memo: &MemoBytes) -> String {
base64::encode_config(memo.as_slice(), base64::URL_SAFE_NO_PAD)
BASE64_URL_SAFE_NO_PAD.encode(memo.as_slice())
}
/// Parse a [`MemoBytes`] value from a ZIP 321 compatible base64-encoded string.
///
/// [`MemoBytes`]: zcash_primitives::memo::MemoBytes
pub fn memo_from_base64(s: &str) -> Result<MemoBytes, Zip321Error> {
base64::decode_config(s, base64::URL_SAFE_NO_PAD)
BASE64_URL_SAFE_NO_PAD
.decode(s)
.map_err(Zip321Error::InvalidBase64)
.and_then(|b| MemoBytes::from_bytes(&b).map_err(Zip321Error::MemoBytesError))
}

View File

@ -8,7 +8,8 @@ and this library adheres to Rust's notion of
## [Unreleased]
### Changed
- Bumped dependencies to `bls12_381 0.8`, `ff 0.13`, `group 0.13`, `jubjub 0.10`
- Bumped dependencies to `bls12_381 0.8`, `ff 0.13`, `group 0.13`,
`jubjub 0.10`, `orchard 0.4`, `sha2 0.10`, `bip0039 0.11`.
## [0.10.2] - 2023-03-16
### Added

View File

@ -30,7 +30,7 @@ rand_core = "0.6"
# - Digests (output types exposed)
blake2b_simd = "1"
sha2 = "0.9"
sha2 = "0.10"
# - Metrics
memuse = "0.2.1"
@ -45,7 +45,7 @@ group = { version = "0.13", features = ["wnaf-memuse"] }
incrementalmerkletree = "0.3"
jubjub = "0.10"
nonempty = "0.7"
orchard = { version = "0.3", default-features = false }
orchard = { version = "0.4", default-features = false }
# - Static constants
lazy_static = "1"
@ -60,7 +60,7 @@ hdwallet = { version = "0.3.1", optional = true }
secp256k1 = { version = "0.21", optional = true }
# - ZIP 339
bip0039 = { version = "0.9", features = ["std", "all-languages"] }
bip0039 = { version = "0.11", features = ["std", "all-languages"] }
# Dependencies used internally:
# (Breaking upgrades to these are usually backwards-compatible, but check MSRVs.)
@ -76,8 +76,8 @@ blake2s_simd = "1"
ripemd = { version = "0.1", optional = true }
# - ZIP 32
aes = "0.7"
fpe = "0.5"
aes = "0.8"
fpe = "0.6"
[dependencies.zcash_note_encryption]
version = "0.3"
@ -89,7 +89,7 @@ criterion = "0.4"
proptest = "1.0.0"
assert_matches = "1.3.0"
rand_xorshift = "0.3"
orchard = { version = "0.3", default-features = false, features = ["test-dependencies"] }
orchard = { version = "0.4", default-features = false, features = ["test-dependencies"] }
[target.'cfg(unix)'.dev-dependencies]
pprof = { version = "0.11", features = ["criterion", "flamegraph"] } # MSRV 1.56

View File

@ -2,9 +2,8 @@ use hdwallet::{
traits::{Deserialize, Serialize},
ExtendedPrivKey, ExtendedPubKey, KeyIndex,
};
use ripemd::Digest as RipemdDigest;
use secp256k1::PublicKey;
use sha2::{Digest as Sha2Digest, Sha256};
use sha2::{Digest, Sha256};
use crate::{consensus, keys::prf_expand_vec, zip32::AccountId};

View File

@ -22,7 +22,7 @@ use {
TransactionData, TxDigests,
},
blake2b_simd::Hash as Blake2bHash,
ripemd::Digest,
sha2::Digest,
};
#[derive(Debug, PartialEq, Eq)]
@ -144,7 +144,7 @@ impl TransparentBuilder {
match coin.script_pubkey.address() {
Some(TransparentAddress::PublicKey(hash)) => {
use ripemd::Ripemd160;
use sha2::{Digest, Sha256};
use sha2::Sha256;
if hash[..] != Ripemd160::digest(Sha256::digest(&pubkey))[..] {
return Err(Error::InvalidAddress);

View File

@ -33,7 +33,7 @@ tracing = "0.1"
# Dependencies used internally:
# (Breaking upgrades to these are usually backwards-compatible, but check MSRVs.)
blake2b_simd = "1"
directories = { version = "4", optional = true }
directories = { version = "5", optional = true }
redjubjub = "0.7"
wagyu-zcash-parameters = { version = "0.2", optional = true }