deps(librustzcash): Upgrade zcash dependencies for NU6 (#8746)

* temporally upgrade zcash primitives to github main branch

* add allowed git repo in deny.toml

* add quotes to url

* fix denies

* change issue number for TODOs

* fix test name

* Apply suggestions from code review

Co-authored-by: Marek <mail@marek.onl>

---------

Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
Co-authored-by: Marek <mail@marek.onl>
This commit is contained in:
Alfredo Garcia 2024-08-12 10:21:57 -03:00 committed by GitHub
parent 6a4c47ec06
commit a57557625a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 186 additions and 98 deletions

View File

@ -442,6 +442,22 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "bip32"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa13fae8b6255872fd86f7faf4b41168661d7d78609f7bfe6771b85c6739a15b"
dependencies = [
"bs58",
"hmac",
"rand_core 0.6.4",
"ripemd",
"secp256k1 0.27.0",
"sha2",
"subtle",
"zeroize",
]
[[package]] [[package]]
name = "bit-set" name = "bit-set"
version = "0.5.3" version = "0.5.3"
@ -1312,6 +1328,15 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "equihash"
version = "0.2.0"
source = "git+https://github.com/zcash/librustzcash/?branch=main#5a4a3e06dcd2cf5bdf79a7cd48709b58693c65f0"
dependencies = [
"blake2b_simd",
"byteorder",
]
[[package]] [[package]]
name = "equivalent" name = "equivalent"
version = "1.0.1" version = "1.0.1"
@ -1347,6 +1372,14 @@ dependencies = [
"blake2b_simd", "blake2b_simd",
] ]
[[package]]
name = "f4jumble"
version = "0.1.0"
source = "git+https://github.com/zcash/librustzcash/?branch=main#5a4a3e06dcd2cf5bdf79a7cd48709b58693c65f0"
dependencies = [
"blake2b_simd",
]
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.1.0" version = "2.1.0"
@ -1408,7 +1441,7 @@ dependencies = [
"futures-sink", "futures-sink",
"nanorand", "nanorand",
"pin-project", "pin-project",
"spin 0.9.8", "spin",
] ]
[[package]] [[package]]
@ -1745,19 +1778,6 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "hdwallet"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a03ba7d4c9ea41552cd4351965ff96883e629693ae85005c501bb4b9e1c48a7"
dependencies = [
"lazy_static",
"rand_core 0.6.4",
"ring 0.16.20",
"secp256k1",
"thiserror",
]
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.3" version = "0.3.3"
@ -2360,7 +2380,7 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
dependencies = [ dependencies = [
"spin 0.9.8", "spin",
] ]
[[package]] [[package]]
@ -3659,21 +3679,6 @@ dependencies = [
"bytemuck", "bytemuck",
] ]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin 0.5.2",
"untrusted 0.7.1",
"web-sys",
"winapi",
]
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.17.8" version = "0.17.8"
@ -3684,8 +3689,8 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"getrandom 0.2.15", "getrandom 0.2.15",
"libc", "libc",
"spin 0.9.8", "spin",
"untrusted 0.9.0", "untrusted",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
@ -3784,7 +3789,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [ dependencies = [
"log", "log",
"ring 0.17.8", "ring",
"rustls-webpki", "rustls-webpki",
"sct", "sct",
] ]
@ -3804,8 +3809,8 @@ version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [ dependencies = [
"ring 0.17.8", "ring",
"untrusted 0.9.0", "untrusted",
] ]
[[package]] [[package]]
@ -3885,8 +3890,8 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
dependencies = [ dependencies = [
"ring 0.17.8", "ring",
"untrusted 0.9.0", "untrusted",
] ]
[[package]] [[package]]
@ -3899,6 +3904,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "secp256k1"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f"
dependencies = [
"secp256k1-sys",
]
[[package]] [[package]]
name = "secp256k1-sys" name = "secp256k1-sys"
version = "0.8.1" version = "0.8.1"
@ -4271,12 +4285,6 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.8"
@ -5116,12 +5124,6 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.9.0" version = "0.9.0"
@ -5652,9 +5654,21 @@ checksum = "827c17a1f7e3a69f0d44e991ff610c7a842228afdc9dc2325ffdd1a67fee01e9"
dependencies = [ dependencies = [
"bech32", "bech32",
"bs58", "bs58",
"f4jumble", "f4jumble 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_encoding", "zcash_encoding 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_protocol", "zcash_protocol 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "zcash_address"
version = "0.3.2"
source = "git+https://github.com/zcash/librustzcash/?branch=main#5a4a3e06dcd2cf5bdf79a7cd48709b58693c65f0"
dependencies = [
"bech32",
"bs58",
"f4jumble 0.1.0 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_encoding 0.2.0 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_protocol 0.1.1 (git+https://github.com/zcash/librustzcash/?branch=main)",
] ]
[[package]] [[package]]
@ -5687,12 +5701,12 @@ dependencies = [
"tonic-build 0.10.2", "tonic-build 0.10.2",
"tracing", "tracing",
"which", "which",
"zcash_address", "zcash_address 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_encoding", "zcash_encoding 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_keys", "zcash_keys",
"zcash_note_encryption", "zcash_note_encryption",
"zcash_primitives", "zcash_primitives 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_protocol", "zcash_protocol 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zip32", "zip32",
] ]
@ -5706,6 +5720,15 @@ dependencies = [
"nonempty", "nonempty",
] ]
[[package]]
name = "zcash_encoding"
version = "0.2.0"
source = "git+https://github.com/zcash/librustzcash/?branch=main#5a4a3e06dcd2cf5bdf79a7cd48709b58693c65f0"
dependencies = [
"byteorder",
"nonempty",
]
[[package]] [[package]]
name = "zcash_history" name = "zcash_history"
version = "0.4.0" version = "0.4.0"
@ -5736,10 +5759,10 @@ dependencies = [
"secrecy", "secrecy",
"subtle", "subtle",
"tracing", "tracing",
"zcash_address", "zcash_address 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_encoding", "zcash_encoding 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_primitives", "zcash_primitives 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_protocol", "zcash_protocol 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zip32", "zip32",
] ]
@ -5767,11 +5790,46 @@ dependencies = [
"blake2b_simd", "blake2b_simd",
"byteorder", "byteorder",
"document-features", "document-features",
"equihash", "equihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ff",
"fpe",
"group",
"hex",
"incrementalmerkletree",
"jubjub",
"memuse",
"nonempty",
"orchard",
"rand 0.8.5",
"rand_core 0.6.4",
"redjubjub",
"sapling-crypto",
"sha2",
"subtle",
"tracing",
"zcash_address 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_encoding 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_note_encryption",
"zcash_protocol 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_spec",
"zip32",
]
[[package]]
name = "zcash_primitives"
version = "0.15.1"
source = "git+https://github.com/zcash/librustzcash/?branch=main#5a4a3e06dcd2cf5bdf79a7cd48709b58693c65f0"
dependencies = [
"aes",
"bip32",
"blake2b_simd",
"bs58",
"byteorder",
"document-features",
"equihash 0.2.0 (git+https://github.com/zcash/librustzcash/?branch=main)",
"ff", "ff",
"fpe", "fpe",
"group", "group",
"hdwallet",
"hex", "hex",
"incrementalmerkletree", "incrementalmerkletree",
"jubjub", "jubjub",
@ -5783,14 +5841,14 @@ dependencies = [
"redjubjub", "redjubjub",
"ripemd", "ripemd",
"sapling-crypto", "sapling-crypto",
"secp256k1", "secp256k1 0.27.0",
"sha2", "sha2",
"subtle", "subtle",
"tracing", "tracing",
"zcash_address", "zcash_address 0.3.2 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_encoding", "zcash_encoding 0.2.0 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_note_encryption", "zcash_note_encryption",
"zcash_protocol", "zcash_protocol 0.1.1 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_spec", "zcash_spec",
"zip32", "zip32",
] ]
@ -5815,7 +5873,7 @@ dependencies = [
"sapling-crypto", "sapling-crypto",
"tracing", "tracing",
"xdg", "xdg",
"zcash_primitives", "zcash_primitives 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -5828,6 +5886,15 @@ dependencies = [
"memuse", "memuse",
] ]
[[package]]
name = "zcash_protocol"
version = "0.1.1"
source = "git+https://github.com/zcash/librustzcash/?branch=main#5a4a3e06dcd2cf5bdf79a7cd48709b58693c65f0"
dependencies = [
"document-features",
"memuse",
]
[[package]] [[package]]
name = "zcash_script" name = "zcash_script"
version = "0.2.0" version = "0.2.0"
@ -5863,7 +5930,7 @@ dependencies = [
"color-eyre", "color-eyre",
"criterion", "criterion",
"ed25519-zebra", "ed25519-zebra",
"equihash", "equihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures", "futures",
"group", "group",
"halo2_proofs", "halo2_proofs",
@ -5886,7 +5953,7 @@ dependencies = [
"redjubjub", "redjubjub",
"ripemd", "ripemd",
"sapling-crypto", "sapling-crypto",
"secp256k1", "secp256k1 0.26.0",
"serde", "serde",
"serde-big-array", "serde-big-array",
"serde_json", "serde_json",
@ -5900,13 +5967,13 @@ dependencies = [
"tracing", "tracing",
"uint", "uint",
"x25519-dalek", "x25519-dalek",
"zcash_address", "zcash_address 0.3.2 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_client_backend", "zcash_client_backend",
"zcash_encoding", "zcash_encoding 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_history", "zcash_history",
"zcash_note_encryption", "zcash_note_encryption",
"zcash_primitives", "zcash_primitives 0.15.1 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_protocol", "zcash_protocol 0.1.1 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zebra-test", "zebra-test",
] ]
@ -5971,7 +6038,7 @@ dependencies = [
"tonic-build 0.12.1", "tonic-build 0.12.1",
"tonic-reflection", "tonic-reflection",
"tower", "tower",
"zcash_primitives", "zcash_primitives 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zebra-chain", "zebra-chain",
"zebra-node-services", "zebra-node-services",
"zebra-state", "zebra-state",
@ -6057,8 +6124,8 @@ dependencies = [
"tonic-reflection", "tonic-reflection",
"tower", "tower",
"tracing", "tracing",
"zcash_address", "zcash_address 0.3.2 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zcash_primitives", "zcash_primitives 0.15.1 (git+https://github.com/zcash/librustzcash/?branch=main)",
"zebra-chain", "zebra-chain",
"zebra-consensus", "zebra-consensus",
"zebra-network", "zebra-network",
@ -6100,11 +6167,11 @@ dependencies = [
"tower", "tower",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"zcash_address", "zcash_address 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_client_backend", "zcash_client_backend",
"zcash_keys", "zcash_keys",
"zcash_note_encryption", "zcash_note_encryption",
"zcash_primitives", "zcash_primitives 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zebra-chain", "zebra-chain",
"zebra-grpc", "zebra-grpc",
"zebra-node-services", "zebra-node-services",
@ -6222,8 +6289,8 @@ dependencies = [
"tracing-error", "tracing-error",
"tracing-subscriber", "tracing-subscriber",
"zcash_client_backend", "zcash_client_backend",
"zcash_primitives", "zcash_primitives 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_protocol", "zcash_protocol 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zebra-chain", "zebra-chain",
"zebra-node-services", "zebra-node-services",
"zebra-rpc", "zebra-rpc",

View File

@ -12,7 +12,8 @@
multiple-versions = "deny" multiple-versions = "deny"
# Don't allow wildcard ("any version") dependencies # Don't allow wildcard ("any version") dependencies
wildcards = "deny" # TODO: Change to `deny` after we upgrade to crates.io version of the ECC dependencies (#8749).
wildcards = "allow"
# Allow private and dev wildcard dependencies. # Allow private and dev wildcard dependencies.
# Switch this to `false` when #6924 is implemented. # Switch this to `false` when #6924 is implemented.
allow-wildcard-paths = true allow-wildcard-paths = true
@ -92,6 +93,15 @@ skip-tree = [
{ name = "http", version = "=0.2.12" }, { name = "http", version = "=0.2.12" },
{ name = "http-body", version = "=0.4.6" }, { name = "http-body", version = "=0.4.6" },
{ name = "hyper", version = "=0.14.30" }, { name = "hyper", version = "=0.14.30" },
# TODO: Remove this after we upgrade ECC dependencies to a crates.io version (#8749)
{ name = "equihash", version = "=0.2.0" },
{ name = "f4jumble", version = "=0.1.0" },
{ name = "secp256k1", version = "=0.26.0" },
{ name = "zcash_address", version = "=0.3.2" },
{ name = "zcash_encoding", version = "=0.2.0" },
{ name = "zcash_primitives", version = "=0.15.1" },
{ name = "zcash_protocol", version = "=0.1.1" },
] ]
# This section is considered when running `cargo deny check sources`. # This section is considered when running `cargo deny check sources`.
@ -109,6 +119,7 @@ unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"] allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# List of URLs for allowed Git repositories # List of URLs for allowed Git repositories
allow-git = [ allow-git = [
"https://github.com/zcash/librustzcash.git"
] ]
[sources.allow-org] [sources.allow-org]

View File

@ -97,10 +97,13 @@ orchard = "0.8.0"
zcash_encoding = "0.2.0" zcash_encoding = "0.2.0"
zcash_history = "0.4.0" zcash_history = "0.4.0"
zcash_note_encryption = "0.4.0" zcash_note_encryption = "0.4.0"
zcash_primitives = { version = "0.15.0", features = ["transparent-inputs"] } # TODO: Revert to a release once librustzcash is released (#8749).
zcash_primitives = { git = "https://github.com/zcash/librustzcash/", branch = "main", features = ["transparent-inputs"] }
sapling = { package = "sapling-crypto", version = "0.1" } sapling = { package = "sapling-crypto", version = "0.1" }
zcash_protocol = { version = "0.1.1" } # TODO: Revert to a release once librustzcash is released (#8749).
zcash_address = { version = "0.3.2" } zcash_protocol = { git = "https://github.com/zcash/librustzcash/", branch = "main"}
# TODO: Revert to a release once librustzcash is released (#8749).
zcash_address = { git = "https://github.com/zcash/librustzcash/", branch = "main"}
# Time # Time
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std", "serde"] } chrono = { version = "0.4.38", default-features = false, features = ["clock", "std", "serde"] }
@ -176,7 +179,3 @@ required-features = ["bench"]
[[bench]] [[bench]]
name = "redpallas" name = "redpallas"
harness = false harness = false
[lints.rust]
# TODO: Remove this once it's no longer needed for NU6.
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("nu6"))'] }

View File

@ -531,7 +531,6 @@ impl From<zcash_protocol::consensus::NetworkUpgrade> for NetworkUpgrade {
zcash_protocol::consensus::NetworkUpgrade::Heartwood => Self::Heartwood, zcash_protocol::consensus::NetworkUpgrade::Heartwood => Self::Heartwood,
zcash_protocol::consensus::NetworkUpgrade::Canopy => Self::Canopy, zcash_protocol::consensus::NetworkUpgrade::Canopy => Self::Canopy,
zcash_protocol::consensus::NetworkUpgrade::Nu5 => Self::Nu5, zcash_protocol::consensus::NetworkUpgrade::Nu5 => Self::Nu5,
#[cfg(zcash_unstable = "nu6")]
zcash_protocol::consensus::NetworkUpgrade::Nu6 => Self::Nu6, zcash_protocol::consensus::NetworkUpgrade::Nu6 => Self::Nu6,
} }
} }

View File

@ -88,12 +88,14 @@ hex = { version = "0.4.3", features = ["serde"] }
serde = { version = "1.0.204", features = ["serde_derive"] } serde = { version = "1.0.204", features = ["serde_derive"] }
zcash_primitives = { version = "0.15.0" } # TODO: Revert to a release once librustzcash is released (#8749).
zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", branch = "main", features = ["transparent-inputs"] }
# Experimental feature getblocktemplate-rpcs # Experimental feature getblocktemplate-rpcs
rand = { version = "0.8.5", optional = true } rand = { version = "0.8.5", optional = true }
# ECC deps used by getblocktemplate-rpcs feature # ECC deps used by getblocktemplate-rpcs feature
zcash_address = { version = "0.3.2", optional = true } # TODO: Revert to a release once librustzcash is released (#8749).
zcash_address = { git = "https://github.com/zcash/librustzcash.git", branch = "main", optional = true}
# Test-only feature proptest-impl # Test-only feature proptest-impl
proptest = { version = "1.4.0", optional = true } proptest = { version = "1.4.0", optional = true }

View File

@ -40,6 +40,7 @@ use zebra_scan::{storage::Storage, Config};
#[allow(clippy::print_stdout)] #[allow(clippy::print_stdout)]
pub fn main() { pub fn main() {
let network = zebra_chain::parameters::Network::Mainnet; let network = zebra_chain::parameters::Network::Mainnet;
let zp_network = zebra_scan::scan::zp_network(&network);
let storage = Storage::new(&Config::default(), &network, true); let storage = Storage::new(&Config::default(), &network, true);
// If the first memo is empty, it doesn't get printed. But we never print empty memos anyway. // If the first memo is empty, it doesn't get printed. But we never print empty memos anyway.
let mut prev_memo = "".to_owned(); let mut prev_memo = "".to_owned();
@ -57,11 +58,13 @@ pub fn main() {
let tx = Transaction::read( let tx = Transaction::read(
&hex::decode(fetch_tx_via_rpc(txid.encode_hex())) &hex::decode(fetch_tx_via_rpc(txid.encode_hex()))
.expect("RPC response should be decodable from hex string to bytes")[..], .expect("RPC response should be decodable from hex string to bytes")[..],
BranchId::for_height(&network, height), BranchId::for_height(&zp_network, height),
) )
.expect("TX fetched via RPC should be deserializable from raw bytes"); .expect("TX fetched via RPC should be deserializable from raw bytes");
for output in decrypt_transaction(&network, height, &tx, &ufvks).sapling_outputs() { for output in
decrypt_transaction(&zp_network, height, &tx, &ufvks).sapling_outputs()
{
let memo = memo_bytes_to_string(output.memo().as_array()); let memo = memo_bytes_to_string(output.memo().as_array());
if !memo.is_empty() if !memo.is_empty()

View File

@ -377,7 +377,7 @@ pub fn scan_block(
}; };
zcash_client_backend::scanning::scan_block( zcash_client_backend::scanning::scan_block(
network, &zp_network(network),
block_to_compact(block, chain_metadata), block_to_compact(block, chain_metadata),
scanning_key, scanning_key,
// Ignore whether notes are change from a viewer's own spends for now. // Ignore whether notes are change from a viewer's own spends for now.
@ -555,3 +555,11 @@ pub fn dfvk_to_ufvk(dfvk: &DiversifiableFullViewingKey) -> Result<UnifiedFullVie
))?])?) ))?])?)
.map_err(|e| eyre!(e)) .map_err(|e| eyre!(e))
} }
/// Returns the [`zcash_primitives::consensus::Network`] for this network.
pub fn zp_network(network: &Network) -> zcash_primitives::consensus::Network {
match network {
Network::Mainnet => zcash_primitives::consensus::Network::MainNetwork,
Network::Testnet(_) => zcash_primitives::consensus::Network::TestNetwork,
}
}

View File

@ -299,5 +299,4 @@ zebra-grpc = { path = "../zebra-grpc", version = "0.1.0-alpha.5" }
zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.38" } zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.38" }
[lints.rust] [lints.rust]
# TODO: Remove 'cfg(zcash_unstable, values("nu6"))' once it's no longer needed for NU6. unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)', 'cfg(zcash_unstable, values("nu6"))'] }

View File

@ -3236,9 +3236,9 @@ async fn trusted_chain_sync_handles_forks_correctly() -> Result<()> {
/// Test successful block template submission as a block proposal or submission on a custom Testnet. /// Test successful block template submission as a block proposal or submission on a custom Testnet.
/// ///
/// This test can be run locally with: /// This test can be run locally with:
/// `RUSTFLAGS='--cfg zcash_unstable="nu6"' cargo test --package zebrad --test acceptance --features getblocktemplate-rpcs -- nu6_funding_streams_and_coinbase_balance --exact --show-output` /// `cargo test --package zebrad --test acceptance --features getblocktemplate-rpcs -- nu6_funding_streams_and_coinbase_balance --exact --show-output`
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
#[cfg(all(feature = "getblocktemplate-rpcs", zcash_unstable = "nu6"))] #[cfg(feature = "getblocktemplate-rpcs")]
async fn nu6_funding_streams_and_coinbase_balance() -> Result<()> { async fn nu6_funding_streams_and_coinbase_balance() -> Result<()> {
use zebra_chain::{ use zebra_chain::{
chain_sync_status::MockSyncStatus, chain_sync_status::MockSyncStatus,