Skip to content

Commit

Permalink
rust: Migrate to latest revision of zcash/librustzcash crates
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Nov 8, 2023
1 parent 883fa68 commit 62e3cb0
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 276 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.offline
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ linker = "aarch64-linux-gnu-gcc"
[source.crates-io]
replace-with = "vendored-sources"

[source."https://github.com/zcash/librustzcash.git"]
git = "https://github.com/zcash/librustzcash.git"
rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4"
replace-with = "vendored-sources"

[source.vendored-sources]
# The directory for this source is set to RUST_VENDORED_SOURCES by src/Makefile.am
155 changes: 18 additions & 137 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ zcash_address = "0.3"
zcash_encoding = "0.2"
zcash_history = "0.3"
zcash_note_encryption = "0.4"
zcash_primitives = { version = "=0.13.0-rc.1", features = ["temporary-zcashd", "transparent-inputs"] }
zcash_proofs = { version = "=0.13.0-rc.1", features = ["directories"] }
zcash_primitives = { version = "0.13", features = ["temporary-zcashd", "transparent-inputs"] }
zcash_proofs = { version = "0.13", features = ["directories"] }
ed25519-zebra = "4"
zeroize = "1.4.2"
wagyu-zcash-parameters = "0.2"
Expand Down Expand Up @@ -109,7 +109,7 @@ time = { version = "0.3", features = ["formatting", "macros"] }
[dev-dependencies]
incrementalmerkletree = { version = "0.5", features = ["test-dependencies"] }
proptest = "1.0.0"
zcash_primitives = { version = "=0.13.0-rc.1", features = ["temporary-zcashd", "transparent-inputs", "test-dependencies"] }
zcash_primitives = { version = "0.13", features = ["temporary-zcashd", "transparent-inputs", "test-dependencies"] }

[dependencies.tracing-subscriber]
version = "0.3"
Expand All @@ -120,3 +120,12 @@ features = ["ansi", "env-filter", "fmt", "time"]
lto = 'thin'
panic = 'abort'
codegen-units = 1

[patch.crates-io]
equihash = { git = "https://github.com/zcash/librustzcash.git", rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4" }
zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4" }
zcash_encoding = { git = "https://github.com/zcash/librustzcash.git", rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4" }
zcash_history = { git = "https://github.com/zcash/librustzcash.git", rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4" }
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4" }
zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "64d657ed3157adfd0b6c68a61716fdfd9dd1a9a4" }
12 changes: 7 additions & 5 deletions src/rust/bin/inspect/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use serde::{
use zcash_primitives::{
consensus::Network,
legacy::Script,
transaction::components::{transparent, Amount, TxOut},
transaction::components::{amount::NonNegativeAmount, transparent, TxOut},
zip32::AccountId,
};

Expand Down Expand Up @@ -162,7 +162,7 @@ impl fmt::Display for ZUint256 {
}

#[derive(Clone, Debug)]
struct ZOutputValue(Amount);
struct ZOutputValue(NonNegativeAmount);

struct ZOutputValueVisitor;

Expand All @@ -177,9 +177,11 @@ impl<'de> Visitor<'de> for ZOutputValueVisitor {
where
E: serde::de::Error,
{
Amount::from_u64(v).map(ZOutputValue).map_err(|()| {
serde::de::Error::invalid_type(Unexpected::Unsigned(v), &"a valid zatoshi amount")
})
NonNegativeAmount::from_u64(v)
.map(ZOutputValue)
.map_err(|()| {
serde::de::Error::invalid_type(Unexpected::Unsigned(v), &"a valid zatoshi amount")
})
}
}

Expand Down
Loading

0 comments on commit 62e3cb0

Please sign in to comment.