Skip to content

Commit

Permalink
rust: Add zcash-inspect binary for inspecting Zcash data
Browse files Browse the repository at this point in the history
Currently supports Zcash blocks, block headers, and transactions. Some
consensus rules are also checked, and a JSON context object can be
optionally passed to provide any necessary details for extra contextual
consensus checks.
  • Loading branch information
str4d committed Aug 19, 2022
1 parent e9b4a1a commit 8d82cee
Show file tree
Hide file tree
Showing 10 changed files with 1,221 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ src/zcashd
src/zcashd-wallet-tool
src/zcash-cli
src/zcash-gtest
src/zcash-inspect
src/zcash-tx
src/test/test_bitcoin
zcutil/bin/
Expand Down
24 changes: 24 additions & 0 deletions Cargo.lock

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

19 changes: 17 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ name = "rustzcash"
path = "src/rust/src/rustzcash.rs"
crate-type = ["staticlib"]

[[bin]]
name = "zcash-inspect"
path = "src/rust/bin/inspect/main.rs"

[[bin]]
name = "zcashd-wallet-tool"
path = "src/rust/bin/wallet_tool.rs"
Expand Down Expand Up @@ -57,7 +61,7 @@ zcash_encoding = "0.1"
zcash_history = "0.3"
zcash_note_encryption = "0.1"
zcash_primitives = { version = "0.7", features = ["transparent-inputs"] }
zcash_proofs = "0.7.1"
zcash_proofs = { version = "0.7.1", features = ["directories"] }
ed25519-zebra = "3"
zeroize = "1.4.2"

Expand All @@ -73,12 +77,23 @@ ipnet = "2"
metrics = "0.19"
metrics-exporter-prometheus = "0.10"

# General tool dependencies
gumdrop = "0.8"

# zcash-inspect tool
equihash = "0.2"
hex = "0.4"
lazy_static = "1.4"
serde = "1.0"
serde_json = "1.0"
sha2 = "0.9"
uint = "0.9"

# Wallet tool
# (also depends on tracing, and tracing-subscriber with "env-filter" and "fmt" features)
anyhow = "1.0"
backtrace = "0.3"
clearscreen = "1.0"
gumdrop = "0.8"
rand = "0.8"
secrecy = "0.8"
thiserror = "1"
Expand Down
8 changes: 8 additions & 0 deletions qa/supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ criteria = "safe-to-deploy"
version = "2.1.0"
criteria = "safe-to-deploy"

[[exemptions.ryu]]
version = "1.0.10"
criteria = "safe-to-deploy"

[[exemptions.scopeguard]]
version = "1.1.0"
criteria = "safe-to-deploy"
Expand All @@ -681,6 +685,10 @@ criteria = "safe-to-deploy"
version = "1.0.136"
criteria = "safe-to-deploy"

[[exemptions.serde_json]]
version = "1.0.81"
criteria = "safe-to-deploy"

[[exemptions.sha2]]
version = "0.9.9"
criteria = "safe-to-deploy"
Expand Down
8 changes: 7 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ LIBSECP256K1=secp256k1/libsecp256k1.la
LIBUNIVALUE=univalue/libunivalue.la
LIBZCASH=libzcash.a

INSPECT_TOOL_BIN=zcash-inspect$(EXEEXT)
INSPECT_TOOL_BUILD=$(top_builddir)/target/$(RUST_TARGET)/release/zcash-inspect$(EXEEXT)

WALLET_TOOL_BIN=zcashd-wallet-tool$(EXEEXT)
WALLET_TOOL_BUILD=$(top_builddir)/target/$(RUST_TARGET)/release/zcashd-wallet-tool$(EXEEXT)

Expand Down Expand Up @@ -135,6 +138,9 @@ cargo-build-lib: $(CARGO_CONFIGURED)
cargo-build-bins: $(CARGO_CONFIGURED)
$(rust_verbose)$(RUST_ENV_VARS) $(CARGO) build --bins $(RUST_BUILD_OPTS) $(cargo_verbose)

$(INSPECT_TOOL_BIN): cargo-build-bins
$(AM_V_at)cp $(INSPECT_TOOL_BUILD) $@

$(WALLET_TOOL_BIN): cargo-build-bins
$(AM_V_at)cp $(WALLET_TOOL_BUILD) $@

Expand Down Expand Up @@ -174,7 +180,7 @@ endif

if BUILD_BITCOIN_UTILS
bin_PROGRAMS += zcash-cli zcash-tx
bin_SCRIPTS += $(WALLET_TOOL_BIN)
bin_SCRIPTS += $(INSPECT_TOOL_BIN) $(WALLET_TOOL_BIN)
endif

LIBZCASH_H = \
Expand Down
Loading

0 comments on commit 8d82cee

Please sign in to comment.