devtools: Integrate `zcash-inspect` into workspace

This commit is contained in:
Jack Grigg 2024-07-20 01:51:02 +00:00
parent dc007ef47f
commit 8f26eb9de4
10 changed files with 462 additions and 27 deletions

148
Cargo.lock generated
View File

@ -471,6 +471,20 @@ dependencies = [
"subtle",
]
[[package]]
name = "bip0039"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e68a5a99c65851e7be249f5cf510c0a136f18c9bca32139576d59bd3f577b043"
dependencies = [
"hmac",
"pbkdf2",
"rand 0.8.5",
"sha2 0.10.8",
"unicode-normalization",
"zeroize",
]
[[package]]
name = "bip32"
version = "0.5.1"
@ -998,6 +1012,33 @@ dependencies = [
"zeroize",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
dependencies = [
"cfg-if",
"cpufeatures",
"curve25519-dalek-derive",
"digest 0.10.7",
"fiat-crypto",
"rustc_version",
"subtle",
"zeroize",
]
[[package]]
name = "curve25519-dalek-derive"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.63",
]
[[package]]
name = "daggy"
version = "0.8.0"
@ -1184,6 +1225,38 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "devtools"
version = "0.0.0"
dependencies = [
"bech32",
"bellman",
"bip0039",
"blake2b_simd",
"ed25519-zebra",
"equihash",
"group",
"gumdrop",
"hex",
"jubjub",
"lazy_static",
"orchard",
"sapling-crypto",
"secp256k1",
"secrecy",
"serde",
"serde_json",
"sha2 0.10.8",
"uint",
"zcash_address",
"zcash_encoding",
"zcash_keys",
"zcash_note_encryption",
"zcash_primitives",
"zcash_proofs",
"zcash_protocol",
]
[[package]]
name = "digest"
version = "0.9.0"
@ -1290,14 +1363,25 @@ dependencies = [
"signature 1.6.4",
]
[[package]]
name = "ed25519"
version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
dependencies = [
"pkcs8",
"serde",
"signature 2.2.0",
]
[[package]]
name = "ed25519-dalek"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
dependencies = [
"curve25519-dalek",
"ed25519",
"curve25519-dalek 3.2.0",
"ed25519 1.5.3",
"merlin",
"rand 0.7.3",
"serde",
@ -1305,6 +1389,22 @@ dependencies = [
"zeroize",
]
[[package]]
name = "ed25519-zebra"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9"
dependencies = [
"curve25519-dalek 4.1.3",
"ed25519 2.2.3",
"hashbrown 0.14.5",
"hex",
"rand_core 0.6.4",
"serde",
"sha2 0.10.8",
"zeroize",
]
[[package]]
name = "educe"
version = "0.4.23"
@ -1428,6 +1528,12 @@ dependencies = [
"subtle",
]
[[package]]
name = "fiat-crypto"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
[[package]]
name = "findshlibs"
version = "0.10.2"
@ -2634,6 +2740,17 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "password-hash"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
"rand_core 0.6.4",
"subtle",
]
[[package]]
name = "pasta_curves"
version = "0.5.1"
@ -2661,6 +2778,16 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "pbkdf2"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
"digest 0.10.7",
"password-hash",
]
[[package]]
name = "pem-rfc7468"
version = "0.7.0"
@ -2971,7 +3098,7 @@ checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1"
dependencies = [
"bytes",
"heck",
"itertools 0.11.0",
"itertools 0.12.1",
"log",
"multimap",
"once_cell",
@ -2991,7 +3118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca"
dependencies = [
"anyhow",
"itertools 0.11.0",
"itertools 0.12.1",
"proc-macro2",
"quote",
"syn 2.0.63",
@ -4701,7 +4828,7 @@ dependencies = [
"aes",
"base64ct",
"ctr",
"curve25519-dalek",
"curve25519-dalek 3.2.0",
"derive_more",
"digest 0.10.7",
"ed25519-dalek",
@ -5093,6 +5220,15 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-normalization"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
dependencies = [
"tinyvec",
]
[[package]]
name = "universal-hash"
version = "0.5.1"
@ -5541,7 +5677,7 @@ version = "2.0.0-pre.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df"
dependencies = [
"curve25519-dalek",
"curve25519-dalek 3.2.0",
"rand_core 0.6.4",
"zeroize",
]

View File

@ -6,6 +6,7 @@ members = [
"components/zcash_encoding",
"components/zcash_protocol",
"components/zip321",
"devtools",
"zcash",
"zcash_client_backend",
"zcash_client_sqlite",
@ -43,6 +44,7 @@ zcash_primitives = { version = "0.15", path = "zcash_primitives", default-featur
zcash_proofs = { version = "0.15", path = "zcash_proofs", default-features = false }
# Shielded protocols
bellman = { version = "0.14", default-features = false, features = ["groth16"] }
ff = "0.13"
group = "0.13"
incrementalmerkletree = "0.5.1"

51
devtools/Cargo.toml Normal file
View File

@ -0,0 +1,51 @@
[package]
name = "devtools"
version = "0.0.0"
edition.workspace = true
license.workspace = true
publish = false
[dependencies]
# General tool dependencies
gumdrop = "0.8"
# General Zcash dependencies
bech32.workspace = true
bip0039 = "0.11"
blake2b_simd.workspace = true
equihash.workspace = true
group.workspace = true
sha2.workspace = true
zcash_address.workspace = true
zcash_encoding.workspace = true
zcash_keys.workspace = true
zcash_note_encryption.workspace = true
zcash_primitives = { workspace = true, features = ["transparent-inputs"] }
zcash_proofs.workspace = true
zcash_protocol.workspace = true
# Transparent
secp256k1.workspace = true
# Sprout
ed25519-zebra = "4"
# Sapling
bellman.workspace = true
jubjub.workspace = true
sapling.workspace = true
# Orchard
orchard.workspace = true
# zcash-inspect tool
hex.workspace = true
lazy_static.workspace = true
secrecy.workspace = true
serde.workspace = true
serde_json.workspace = true
uint = "0.9"
[[bin]]
name = "zcash-inspect"
path = "src/bin/inspect/main.rs"

View File

@ -12,19 +12,15 @@ use zcash_primitives::{
keys::{AccountPrivKey, IncomingViewingKey},
TransparentAddress,
},
zip32, zip339,
zip32,
};
use zcash_protocol::consensus::NetworkConstants;
use crate::Context;
pub(crate) fn inspect_mnemonic(
mnemonic: zip339::Mnemonic,
lang: zip339::Language,
context: Option<Context>,
) {
pub(crate) fn inspect_mnemonic(mnemonic: bip0039::Mnemonic, context: Option<Context>) {
eprintln!("Mnemonic phrase");
eprintln!(" - Language: {}", lang);
eprintln!(" - Language: English");
if let Some(((network, addr_net), accounts)) =
context.and_then(|c| c.network().zip(c.addr_network()).zip(c.accounts()))

View File

@ -7,7 +7,6 @@ use gumdrop::{Options, ParsingStyle};
use lazy_static::lazy_static;
use secrecy::Zeroize;
use zcash_address::ZcashAddress;
use zcash_primitives::zip339;
use zcash_primitives::{block::BlockHeader, consensus::BranchId, transaction::Transaction};
use zcash_proofs::{default_params_folder, load_parameters, ZcashParameters};
@ -61,11 +60,9 @@ fn main() {
return;
}
let lang = zip339::Language::English;
if let Ok(mnemonic) = zip339::Mnemonic::from_phrase_in(lang, &opts.data) {
if let Ok(mnemonic) = bip0039::Mnemonic::from_phrase(&opts.data) {
opts.data.zeroize();
keys::inspect_mnemonic(mnemonic, lang, opts.context);
keys::inspect_mnemonic(mnemonic, opts.context);
} else if let Ok(bytes) = hex::decode(&opts.data) {
inspect_bytes(bytes, opts.context);
} else if let Ok(addr) = ZcashAddress::try_from_encoded(&opts.data) {

View File

@ -31,6 +31,9 @@ use crate::{
GROTH16_PARAMS, ORCHARD_VK,
};
#[cfg(zcash_unstable = "zfuture")]
use zcash_primitives::transaction::components::tze;
pub fn is_coinbase(tx: &Transaction) -> bool {
tx.transparent_bundle()
.map(|b| b.is_coinbase())
@ -144,6 +147,9 @@ impl Authorization for PrecomputedAuth {
type TransparentAuth = TransparentAuth;
type SaplingAuth = sapling::bundle::Authorized;
type OrchardAuth = orchard::bundle::Authorized;
#[cfg(zcash_unstable = "zfuture")]
type TzeAuth = tze::Authorized;
}
pub(crate) fn inspect(tx: Transaction, context: Option<Context>) {
@ -156,6 +162,10 @@ pub(crate) fn inspect(tx: Transaction, context: Option<Context>) {
TxVersion::Zip225 => {
eprintln!(" - Consensus branch ID: {:?}", tx.consensus_branch_id());
}
#[cfg(zcash_unstable = "zfuture")]
TxVersion::ZFuture => {
eprintln!(" - Consensus branch ID: {:?}", tx.consensus_branch_id());
}
}
let is_coinbase = is_coinbase(&tx);
@ -190,8 +200,13 @@ pub(crate) fn inspect(tx: Transaction, context: Option<Context>) {
tx.write(&mut buf).unwrap();
let tx = Transaction::read(&buf[..], tx.consensus_branch_id()).unwrap();
let tx: TransactionData<PrecomputedAuth> =
tx.into_data().map_authorization(f_transparent, (), ());
let tx: TransactionData<PrecomputedAuth> = tx.into_data().map_authorization(
f_transparent,
(),
(),
#[cfg(zcash_unstable = "zfuture")]
(),
);
let txid_parts = tx.digest(TxIdDigester);
(tx, txid_parts)
});

View File

@ -191,6 +191,10 @@ criteria = "safe-to-deploy"
version = "0.14.0"
criteria = "safe-to-deploy"
[[exemptions.bip0039]]
version = "0.11.0"
criteria = "safe-to-deploy"
[[exemptions.bitflags]]
version = "1.3.2"
criteria = "safe-to-run"
@ -287,10 +291,6 @@ criteria = "safe-to-deploy"
version = "0.9.6"
criteria = "safe-to-deploy"
[[exemptions.cpp_demangle]]
version = "0.4.3"
criteria = "safe-to-run"
[[exemptions.cpufeatures]]
version = "0.2.11"
criteria = "safe-to-deploy"
@ -335,6 +335,14 @@ criteria = "safe-to-deploy"
version = "3.2.0"
criteria = "safe-to-deploy"
[[exemptions.curve25519-dalek]]
version = "4.1.0"
criteria = "safe-to-deploy"
[[exemptions.curve25519-dalek-derive]]
version = "0.1.0"
criteria = "safe-to-deploy"
[[exemptions.daggy]]
version = "0.8.0"
criteria = "safe-to-deploy"
@ -423,10 +431,18 @@ criteria = "safe-to-deploy"
version = "1.4.1"
criteria = "safe-to-deploy"
[[exemptions.ed25519]]
version = "2.2.1"
criteria = "safe-to-deploy"
[[exemptions.ed25519-dalek]]
version = "1.0.1"
criteria = "safe-to-deploy"
[[exemptions.ed25519-zebra]]
version = "3.0.0"
criteria = "safe-to-deploy"
[[exemptions.educe]]
version = "0.4.23"
criteria = "safe-to-deploy"
@ -533,11 +549,11 @@ criteria = "safe-to-deploy"
[[exemptions.gumdrop]]
version = "0.8.1"
criteria = "safe-to-run"
criteria = "safe-to-deploy"
[[exemptions.gumdrop_derive]]
version = "0.8.1"
criteria = "safe-to-run"
criteria = "safe-to-deploy"
[[exemptions.h2]]
version = "0.3.21"
@ -763,6 +779,10 @@ criteria = "safe-to-deploy"
version = "0.9.10"
criteria = "safe-to-deploy"
[[exemptions.password-hash]]
version = "0.3.2"
criteria = "safe-to-deploy"
[[exemptions.pasta_curves]]
version = "0.5.1"
criteria = "safe-to-deploy"
@ -775,6 +795,10 @@ criteria = "safe-to-deploy"
version = "0.2.1"
criteria = "safe-to-deploy"
[[exemptions.pbkdf2]]
version = "0.9.0"
criteria = "safe-to-deploy"
[[exemptions.pem-rfc7468]]
version = "0.7.0"
criteria = "safe-to-deploy"

View File

@ -72,6 +72,13 @@ user-id = 169181
user-login = "nuttycom"
user-name = "Kris Nuttycombe"
[[publisher.unicode-normalization]]
version = "0.1.23"
when = "2024-02-20"
user-id = 1139
user-login = "Manishearth"
user-name = "Manish Goregaokar"
[[publisher.windows-sys]]
version = "0.48.0"
when = "2023-03-31"
@ -951,6 +958,12 @@ Previously reviewed during security review and the audit is grandparented in.
"""
aggregated-from = "https://chromium.googlesource.com/chromium/src/+/main/third_party/rust/chromium_crates_io/supply-chain/audits.toml?format=TEXT"
[[audits.google.audits.cpp_demangle]]
who = "Hidenori Kobayashi <hidenorik@chromium.org>"
criteria = "safe-to-run"
version = "0.4.3"
aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT"
[[audits.google.audits.equivalent]]
who = "George Burgess IV <gbiv@google.com>"
criteria = "safe-to-deploy"
@ -1099,6 +1112,18 @@ criteria = "safe-to-deploy"
version = "0.1.43"
aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT"
[[audits.google.audits.password-hash]]
who = "Joshua Liebow-Feeser <joshlf@google.com>"
criteria = "safe-to-deploy"
delta = "0.3.2 -> 0.4.2"
aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT"
[[audits.google.audits.pbkdf2]]
who = "Joshua Liebow-Feeser <joshlf@google.com>"
criteria = "safe-to-deploy"
delta = "0.9.0 -> 0.11.0"
aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT"
[[audits.google.audits.pin-project-lite]]
who = "David Koloski <dkoloski@google.com>"
criteria = "safe-to-deploy"
@ -1497,6 +1522,86 @@ who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
version = "1.6.1"
[[audits.isrg.audits.fiat-crypto]]
who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
version = "0.1.17"
notes = """
This crate does not contain any unsafe code, and does not use any items from
the standard library or other crates, aside from operations backed by
`std::ops`. All paths with array indexing use integer literals for indexes, so
there are no panics due to indexes out of bounds (as rustc would catch an
out-of-bounds literal index). I did not check whether arithmetic overflows
could cause a panic, and I am relying on the Coq code having satisfied the
necessary preconditions to ensure panics due to overflows are unreachable.
"""
[[audits.isrg.audits.fiat-crypto]]
who = "Brandon Pitman <bran@bran.land>"
criteria = "safe-to-deploy"
delta = "0.1.17 -> 0.1.18"
[[audits.isrg.audits.fiat-crypto]]
who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
delta = "0.1.18 -> 0.1.19"
notes = """
This release renames many items and adds a new module. The code in the new
module is entirely composed of arithmetic and array accesses.
"""
[[audits.isrg.audits.fiat-crypto]]
who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
delta = "0.1.19 -> 0.1.20"
[[audits.isrg.audits.fiat-crypto]]
who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
delta = "0.1.20 -> 0.2.0"
[[audits.isrg.audits.fiat-crypto]]
who = "Brandon Pitman <bran@bran.land>"
criteria = "safe-to-deploy"
delta = "0.2.0 -> 0.2.1"
[[audits.isrg.audits.fiat-crypto]]
who = "Tim Geoghegan <timg@divviup.org>"
criteria = "safe-to-deploy"
delta = "0.2.1 -> 0.2.2"
notes = "No changes to `unsafe` code, or any functional changes that I can detect at all."
[[audits.isrg.audits.fiat-crypto]]
who = "Brandon Pitman <bran@bran.land>"
criteria = "safe-to-deploy"
delta = "0.2.2 -> 0.2.4"
[[audits.isrg.audits.fiat-crypto]]
who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
delta = "0.2.4 -> 0.2.5"
[[audits.isrg.audits.fiat-crypto]]
who = "Brandon Pitman <bran@bran.land>"
criteria = "safe-to-deploy"
delta = "0.2.5 -> 0.2.6"
[[audits.isrg.audits.fiat-crypto]]
who = "Brandon Pitman <bran@bran.land>"
criteria = "safe-to-deploy"
delta = "0.2.6 -> 0.2.7"
[[audits.isrg.audits.fiat-crypto]]
who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
delta = "0.2.7 -> 0.2.8"
[[audits.isrg.audits.fiat-crypto]]
who = "Tim Geoghegan <timg@divviup.org>"
criteria = "safe-to-deploy"
delta = "0.2.8 -> 0.2.9"
notes = "No changes to Rust code between 0.2.8 and 0.2.9"
[[audits.isrg.audits.getrandom]]
who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy"
@ -1682,6 +1787,15 @@ renew = false
notes = "I've reviewed every source contribution that was neither authored nor reviewed by Mozilla."
aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml"
[[audits.mozilla.wildcard-audits.unicode-normalization]]
who = "Manish Goregaokar <manishsmail@gmail.com>"
criteria = "safe-to-deploy"
user-id = 1139 # Manish Goregaokar (Manishearth)
start = "2019-11-06"
end = "2024-05-03"
notes = "All code written or reviewed by Manish"
aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml"
[[audits.mozilla.audits.ahash]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
@ -2482,6 +2596,36 @@ criteria = "safe-to-deploy"
delta = "0.9.17 -> 0.9.18"
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.curve25519-dalek]]
who = "Jack Grigg <jack@electriccoin.co>"
criteria = "safe-to-deploy"
delta = "4.1.0 -> 4.1.1"
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.curve25519-dalek]]
who = "Daira-Emma Hopwood <daira@jacaranda.org>"
criteria = "safe-to-deploy"
delta = "4.1.1 -> 4.1.2"
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.curve25519-dalek]]
who = "Jack Grigg <jack@electriccoin.co>"
criteria = "safe-to-deploy"
delta = "4.1.2 -> 4.1.3"
notes = """
- New unsafe is adding `core::ptr::read_volatile` calls for black box
optimization barriers.
- `build.rs` changes are to use `CARGO_CFG_TARGET_POINTER_WIDTH` instead of
`TARGET` and the `platforms` crate for deciding on the target pointer width.
"""
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.curve25519-dalek-derive]]
who = "Jack Grigg <jack@electriccoin.co>"
criteria = "safe-to-deploy"
delta = "0.1.0 -> 0.1.1"
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.der]]
who = "Daira-Emma Hopwood <daira@jacaranda.org>"
criteria = "safe-to-deploy"
@ -2489,6 +2633,57 @@ delta = "0.7.8 -> 0.7.9"
notes = "The change to ignore RUSTSEC-2023-0071 is correct for this crate."
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.ed25519]]
who = "Jack Grigg <jack@electriccoin.co>"
criteria = "safe-to-deploy"
delta = "2.2.1 -> 2.2.2"
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.ed25519]]
who = "Jack Grigg <jack@electriccoin.co>"
criteria = "safe-to-deploy"
delta = "2.2.2 -> 2.2.3"
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.ed25519-zebra]]
who = "Jack Grigg <jack@z.cash>"
criteria = "safe-to-deploy"
delta = "3.0.0 -> 3.1.0"
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.ed25519-zebra]]
who = "Daira Emma Hopwood <daira@jacaranda.org>"
criteria = "safe-to-deploy"
delta = "3.1.0 -> 4.0.0"
notes = """
Changes are mainly in the pem and pkcs8 features and in Java or Scala code. These do not introduce unsafe code,
but I cannot vouch for their cryptographic correctness or conformance to PEM or PKCS8 standards. I reviewed the
remaining changes from 3.1.0 to 4.0.0 fully.
"""
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.ed25519-zebra]]
who = "Jack Grigg <jack@electriccoin.co>"
criteria = "safe-to-deploy"
delta = "4.0.0 -> 4.0.3"
notes = """
`SigningKey::from([u8; 32])` parsing now uses `Scalar::from_bytes_mod_order` instead of
`Scalar::from_bits`. This means that the clamped scalar bits are now reduced before they
are used, which removes the implicit mul-by-cofactor during scalar multiplication (as the
last 3 bits of the scalar are no longer guaranteed to be zero). However, this happens to
be fine in the context of this crate:
- `SigningKey` does not expose its inner `Scalar` directly, so we only need to consider
how it is used within the crate.
- For multiplication within a prime-order (sub)group, we get the same result whether we
reduce before or not. This means that the field-element multiplication during signing,
and the prime-order subgroup component of any group-element scalar multiplication, are
unaffected.
- The only group element that the `Scalar` is multiplied by is the Ed25519 basepoint,
which is torsion free (so the implicit mul-by-cofactor is unnecessary).
"""
aggregated-from = "https://raw.githubusercontent.com/zcash/zcash/master/qa/supply-chain/audits.toml"
[[audits.zcash.audits.either]]
who = "Jack Grigg <jack@electriccoin.co>"
criteria = "safe-to-deploy"

View File

@ -32,6 +32,25 @@ pub trait MapAuth<A: Authorization, B: Authorization> {
fn map_authorization(&self, s: A) -> B;
}
/// The identity map.
///
/// This can be used with [`TransactionData::map_authorization`] when you want to map the
/// authorization of a subset of the transaction's bundles.
///
/// [`TransactionData::map_authorization`]: crate::transaction::TransactionData::map_authorization
impl MapAuth<Authorized, Authorized> for () {
fn map_witness(
&self,
s: <Authorized as Authorization>::Witness,
) -> <Authorized as Authorization>::Witness {
s
}
fn map_authorization(&self, a: Authorized) -> Authorized {
a
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Bundle<A: Authorization> {
pub vin: Vec<TzeIn<A::Witness>>,

View File

@ -22,7 +22,7 @@ zcash_primitives.workspace = true
# Dependencies exposed in a public API:
# (Breaking upgrades to these require a breaking upgrade to this crate.)
bellman = { version = "0.14", default-features = false, features = ["groth16"] }
bellman.workspace = true
bls12_381.workspace = true
group.workspace = true
jubjub.workspace = true