Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
969 changes: 953 additions & 16 deletions backend-lib/Cargo.lock

Large diffs are not rendered by default.

41 changes: 31 additions & 10 deletions backend-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ zcash_protocol = "0.7"
zcash_script = "0.4"
zip32 = "0.2"

# Shielded voting (valargroup/zcash_voting)
zcash_voting = { git = "https://github.com/valargroup/zcash_voting.git", branch = "greg/orchard-0.12" }

# Serialization (needed for voting JSON FFI)
serde = { version = "1", features = ["derive"] }
serde_json = "1"
hex = "0.4"

# Merkle tree
incrementalmerkletree = "0.8"

# OpenSSL vendored — needed for cross-compilation to Android targets.
# pir-client (via zcash_voting) pulls in reqwest with native-tls default,
# which requires OpenSSL. Using the vendored feature compiles OpenSSL from
# source with the NDK toolchain instead of looking for a system library.
openssl = { version = "0.10", features = ["vendored"] }

# Infrastructure
prost = "0.14"
rusqlite = "0.37"
Expand Down Expand Up @@ -102,14 +119,18 @@ path = "src/main/rust/lib.rs"
crate-type = ["staticlib", "cdylib"]

[patch.crates-io]
pczt = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
orchard = { package = "orchard", git = "https://github.com/zcash/orchard.git", rev = "6b12c77260aa7fac0d804983fc31b71b584d48e0" }
# Voting-circuits fork of orchard — upstream 0.12 + pub visibility for constants/spec
# + shared_primitives gadget for voting ZKPs (same as iOS SDK shielded-vote-2.4.10).
orchard = { package = "orchard", git = "https://github.com/valargroup/voting-circuits.git", branch = "greg/orchard-0.12" }
sapling = { package = "sapling-crypto", git = "https://github.com/zcash/sapling-crypto.git", rev = "4f95c2286dbe90f05e6f44d634bc2924b992fab4" }
transparent = { package = "zcash_transparent", git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
zcash_client_backend = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
zcash_client_sqlite = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
zcash_keys = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
zcash_protocol = { git = "https://github.com/zcash/librustzcash.git", rev = "438657c52c7b5abd933c715e83f0289a79349c5a" }
# valargroup librustzcash fork — shielded-vote-main branch adds PCZT/key visibility
# changes required for voting delegation flows (mirrors iOS SDK patches).
pczt = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
transparent = { package = "zcash_transparent", git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
zcash_address = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
zcash_client_backend = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
zcash_client_sqlite = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
zcash_keys = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
zcash_primitives = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
zcash_proofs = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
zcash_protocol = { git = "https://github.com/valargroup/librustzcash.git", branch = "shielded-vote-main" }
7 changes: 7 additions & 0 deletions backend-lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ cargo {
// https://developer.android.com/about/versions/15/behavior-changes-all#16-kb
exec = { spec, _ ->
spec.environment["RUST_ANDROID_GRADLE_CC_LINK_ARG"] = "-Wl,-z,max-page-size=16384"
// NDK >= r23 ships llvm-ranlib instead of target-prefixed ranlib wrappers.
// openssl-sys vendored build looks for "arm-linux-androideabi-ranlib" which
// doesn't exist; point it at llvm-ranlib so OpenSSL cross-compiles correctly.
val ndkDir = android.ndkDirectory
val ndkBin = "$ndkDir/toolchains/llvm/prebuilt/darwin-x86_64/bin"
spec.environment["RANLIB"] = "$ndkBin/llvm-ranlib"
spec.environment["AR"] = "$ndkBin/llvm-ar"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ const val JNI_METADATA_KEY_SK_SIZE = 32
* The number of bytes in a chain code. It's used e.g. in [JniMetadataKey.chainCode]
*/
const val JNI_METADATA_KEY_CHAIN_CODE_SIZE = 32

/**
* The number of bytes in a voting hotkey secret key. It's used e.g. in [HotkeySecretKey.value]
*/
const val JNI_HOTKEY_SECRET_KEY_BYTES_SIZE = 32

/**
* The number of bytes in a voting hotkey public key. It's used e.g. in [HotkeyPublicKey.value]
*/
const val JNI_HOTKEY_PUBLIC_KEY_BYTES_SIZE = 32
1 change: 1 addition & 0 deletions backend-lib/src/main/rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ use crate::utils::{

mod tor;
mod utils;
mod voting;

#[cfg(debug_assertions)]
fn print_debug_state() {
Expand Down
Loading
Loading