Migrate to latest revisions of orchard and the zcash_* crates

This commit is contained in:
Jack Grigg 2021-09-16 23:58:18 +01:00
parent bfd7b31efe
commit 2aa9f766b2
9 changed files with 112 additions and 103 deletions

17
Cargo.lock generated
View File

@ -538,7 +538,7 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
[[package]]
name = "equihash"
version = "0.1.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=a3df9dd47d6c3fa89b08483cb8276515464de321#a3df9dd47d6c3fa89b08483cb8276515464de321"
source = "git+https://github.com/zcash/librustzcash.git?rev=ba3f13bbedd95908419f104f67b9fcd3b3e13111#ba3f13bbedd95908419f104f67b9fcd3b3e13111"
dependencies = [
"blake2b_simd",
"byteorder",
@ -1110,7 +1110,7 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "orchard"
version = "0.0.0"
source = "git+https://github.com/zcash/orchard.git?rev=78e22f6325d00ba69e3cb0860c6de27f5129ac04#78e22f6325d00ba69e3cb0860c6de27f5129ac04"
source = "git+https://github.com/zcash/orchard.git?rev=f8280c98a3d0e41b8ff5b7f615802bd197f781e1#f8280c98a3d0e41b8ff5b7f615802bd197f781e1"
dependencies = [
"aes",
"arrayvec 0.7.1",
@ -1817,17 +1817,18 @@ dependencies = [
[[package]]
name = "zcash_address"
version = "0.0.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=a3df9dd47d6c3fa89b08483cb8276515464de321#a3df9dd47d6c3fa89b08483cb8276515464de321"
source = "git+https://github.com/zcash/librustzcash.git?rev=ba3f13bbedd95908419f104f67b9fcd3b3e13111#ba3f13bbedd95908419f104f67b9fcd3b3e13111"
dependencies = [
"bech32",
"blake2b_simd",
"bs58",
"zcash_encoding",
]
[[package]]
name = "zcash_encoding"
version = "0.0.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=a3df9dd47d6c3fa89b08483cb8276515464de321#a3df9dd47d6c3fa89b08483cb8276515464de321"
source = "git+https://github.com/zcash/librustzcash.git?rev=ba3f13bbedd95908419f104f67b9fcd3b3e13111#ba3f13bbedd95908419f104f67b9fcd3b3e13111"
dependencies = [
"byteorder",
"nonempty",
@ -1836,7 +1837,7 @@ dependencies = [
[[package]]
name = "zcash_history"
version = "0.2.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=a3df9dd47d6c3fa89b08483cb8276515464de321#a3df9dd47d6c3fa89b08483cb8276515464de321"
source = "git+https://github.com/zcash/librustzcash.git?rev=ba3f13bbedd95908419f104f67b9fcd3b3e13111#ba3f13bbedd95908419f104f67b9fcd3b3e13111"
dependencies = [
"bigint",
"blake2b_simd",
@ -1846,7 +1847,7 @@ dependencies = [
[[package]]
name = "zcash_note_encryption"
version = "0.0.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=a3df9dd47d6c3fa89b08483cb8276515464de321#a3df9dd47d6c3fa89b08483cb8276515464de321"
source = "git+https://github.com/zcash/librustzcash.git?rev=ba3f13bbedd95908419f104f67b9fcd3b3e13111#ba3f13bbedd95908419f104f67b9fcd3b3e13111"
dependencies = [
"blake2b_simd",
"byteorder",
@ -1861,7 +1862,7 @@ dependencies = [
[[package]]
name = "zcash_primitives"
version = "0.5.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=a3df9dd47d6c3fa89b08483cb8276515464de321#a3df9dd47d6c3fa89b08483cb8276515464de321"
source = "git+https://github.com/zcash/librustzcash.git?rev=ba3f13bbedd95908419f104f67b9fcd3b3e13111#ba3f13bbedd95908419f104f67b9fcd3b3e13111"
dependencies = [
"aes",
"bip0039",
@ -1895,7 +1896,7 @@ dependencies = [
[[package]]
name = "zcash_proofs"
version = "0.5.0"
source = "git+https://github.com/zcash/librustzcash.git?rev=a3df9dd47d6c3fa89b08483cb8276515464de321#a3df9dd47d6c3fa89b08483cb8276515464de321"
source = "git+https://github.com/zcash/librustzcash.git?rev=ba3f13bbedd95908419f104f67b9fcd3b3e13111#ba3f13bbedd95908419f104f67b9fcd3b3e13111"
dependencies = [
"bellman",
"blake2b_simd",

View File

@ -71,9 +71,9 @@ codegen-units = 1
ed25519-zebra = { git = "https://github.com/ZcashFoundation/ed25519-zebra.git", rev = "d3512400227a362d08367088ffaa9bd4142a69c7" }
halo2 = { git = "https://github.com/zcash/halo2.git", rev = "26047eaf323929935fd1e6aa3ae100b1113706e0" }
incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "b7bd6246122a6e9ace8edb51553fbf5228906cbb" }
orchard = { git = "https://github.com/zcash/orchard.git", rev = "78e22f6325d00ba69e3cb0860c6de27f5129ac04" }
zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "a3df9dd47d6c3fa89b08483cb8276515464de321" }
zcash_history = { git = "https://github.com/zcash/librustzcash.git", rev = "a3df9dd47d6c3fa89b08483cb8276515464de321" }
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "a3df9dd47d6c3fa89b08483cb8276515464de321" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "a3df9dd47d6c3fa89b08483cb8276515464de321" }
zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "a3df9dd47d6c3fa89b08483cb8276515464de321" }
orchard = { git = "https://github.com/zcash/orchard.git", rev = "f8280c98a3d0e41b8ff5b7f615802bd197f781e1" }
zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "ba3f13bbedd95908419f104f67b9fcd3b3e13111" }
zcash_history = { git = "https://github.com/zcash/librustzcash.git", rev = "ba3f13bbedd95908419f104f67b9fcd3b3e13111" }
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "ba3f13bbedd95908419f104f67b9fcd3b3e13111" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "ba3f13bbedd95908419f104f67b9fcd3b3e13111" }
zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "ba3f13bbedd95908419f104f67b9fcd3b3e13111" }

View File

@ -44,7 +44,7 @@ public:
std::string operator()(const CNoDestination& no) const { return {}; }
};
static uint8_t GetTypecode(const void* ua, size_t index)
static uint32_t GetTypecode(const void* ua, size_t index)
{
return std::visit(
TypecodeForReceiver(),
@ -441,7 +441,7 @@ static bool AddP2PKHReceiver(void* ua, const unsigned char* raw)
return reinterpret_cast<libzcash::UnifiedAddress*>(ua)->AddReceiver(receiver);
}
static bool AddUnknownReceiver(void* ua, uint8_t typecode, const unsigned char* data, size_t len)
static bool AddUnknownReceiver(void* ua, uint32_t typecode, const unsigned char* data, size_t len)
{
libzcash::UnknownReceiver receiver(typecode, std::vector(data, data + len));
return reinterpret_cast<libzcash::UnifiedAddress*>(ua)->AddReceiver(receiver);

View File

@ -12,10 +12,10 @@ extern "C" {
typedef bool (*raw_to_receiver_t)(void* ua, const unsigned char* raw);
typedef bool (*unknown_receiver_t)(
void* ua,
uint8_t typecode,
uint32_t typecode,
const unsigned char* data,
size_t len);
typedef uint8_t (*get_typecode_t)(const void* ua, size_t index);
typedef uint32_t (*get_typecode_t)(const void* ua, size_t index);
typedef size_t (*get_receiver_len_t)(const void* ua, size_t index);
typedef void (*get_receiver_t)(const void* ua, size_t index, unsigned char* data, size_t length);

View File

@ -13,11 +13,11 @@ pub type AddReceiverCb =
unsafe extern "C" fn(ua: Option<UnifiedAddressObj>, raw: *const u8) -> bool;
pub type UnknownReceiverCb = unsafe extern "C" fn(
ua: Option<UnifiedAddressObj>,
typecode: u8,
typecode: u32,
data: *const u8,
len: usize,
) -> bool;
pub type GetTypecodeCb = unsafe extern "C" fn(ua: Option<UnifiedAddressObj>, index: usize) -> u8;
pub type GetTypecodeCb = unsafe extern "C" fn(ua: Option<UnifiedAddressObj>, index: usize) -> u32;
pub type GetReceiverLenCb =
unsafe extern "C" fn(ua: Option<UnifiedAddressObj>, index: usize) -> usize;
pub type GetReceiverDataCb =
@ -162,43 +162,52 @@ pub extern "C" fn zcash_address_serialize_unified(
None => return ptr::null_mut(),
};
let receivers: Vec<unified::Receiver> = (0..receivers_len)
.map(
|i| match unsafe { (typecode_cb.unwrap())(ua_obj, i) }.into() {
unified::Typecode::Orchard => {
// TODO: Replace with Orchard support.
let data_len = unsafe { (receiver_len_cb.unwrap())(ua_obj, i) };
let mut data = vec![0; data_len];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data_len) };
unified::Receiver::Unknown {
typecode: 0x03,
data,
let receivers: Vec<unified::Receiver> = match (0..receivers_len)
.map(|i| {
Ok(
match unsafe { (typecode_cb.unwrap())(ua_obj, i) }.try_into()? {
unified::Typecode::Orchard => {
// TODO: Replace with Orchard support.
let data_len = unsafe { (receiver_len_cb.unwrap())(ua_obj, i) };
let mut data = vec![0; data_len];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data_len) };
unified::Receiver::Unknown {
typecode: 0x03,
data,
}
}
}
unified::Typecode::Sapling => {
let mut data = [0; 43];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data.len()) };
unified::Receiver::Sapling(data)
}
unified::Typecode::P2sh => {
let mut data = [0; 20];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data.len()) };
unified::Receiver::P2sh(data)
}
unified::Typecode::P2pkh => {
let mut data = [0; 20];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data.len()) };
unified::Receiver::P2pkh(data)
}
unified::Typecode::Unknown(typecode) => {
let data_len = unsafe { (receiver_len_cb.unwrap())(ua_obj, i) };
let mut data = vec![0; data_len];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data_len) };
unified::Receiver::Unknown { typecode, data }
}
},
)
.collect();
unified::Typecode::Sapling => {
let mut data = [0; 43];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data.len()) };
unified::Receiver::Sapling(data)
}
unified::Typecode::P2sh => {
let mut data = [0; 20];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data.len()) };
unified::Receiver::P2sh(data)
}
unified::Typecode::P2pkh => {
let mut data = [0; 20];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data.len()) };
unified::Receiver::P2pkh(data)
}
unified::Typecode::Unknown(typecode) => {
let data_len = unsafe { (receiver_len_cb.unwrap())(ua_obj, i) };
let mut data = vec![0; data_len];
unsafe { (receiver_cb.unwrap())(ua_obj, i, data.as_mut_ptr(), data_len) };
unified::Receiver::Unknown { typecode, data }
}
},
)
})
.collect::<Result<_, unified::ParseError>>()
{
Ok(receivers) => receivers,
Err(e) => {
tracing::error!("{}", e);
return ptr::null_mut();
}
};
let ua: unified::Address = match receivers.try_into() {
Ok(ua) => ua,

View File

@ -5,7 +5,7 @@ use incrementalmerkletree::{
use std::mem::size_of_val;
use std::ptr;
use orchard::{bundle::Authorized, tree::MerkleCrhOrchardOutput};
use orchard::{bundle::Authorized, tree::MerkleHashOrchard};
use zcash_primitives::{
merkle_tree::incremental::{read_frontier_v1, read_tree, write_frontier_v1, write_tree},
@ -23,15 +23,15 @@ pub const MAX_CHECKPOINTS: usize = 100;
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_empty(
) -> *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
let empty_tree = bridgetree::Frontier::<MerkleCrhOrchardOutput, MERKLE_DEPTH>::empty();
) -> *mut bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH> {
let empty_tree = bridgetree::Frontier::<MerkleHashOrchard, MERKLE_DEPTH>::empty();
Box::into_raw(Box::new(empty_tree))
}
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_clone(
tree: *const bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
) -> *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
tree: *const bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH>,
) -> *mut bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH> {
unsafe { tree.as_ref() }
.map(|tree| Box::into_raw(Box::new(tree.clone())))
.unwrap_or(std::ptr::null_mut())
@ -39,7 +39,7 @@ pub extern "C" fn orchard_merkle_frontier_clone(
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_free(
tree: *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *mut bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH>,
) {
if !tree.is_null() {
drop(unsafe { Box::from_raw(tree) });
@ -50,7 +50,7 @@ pub extern "C" fn orchard_merkle_frontier_free(
pub extern "C" fn orchard_merkle_frontier_parse(
stream: Option<StreamObj>,
read_cb: Option<ReadCb>,
) -> *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
) -> *mut bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH> {
let reader = CppStreamReader::from_raw_parts(stream, read_cb.unwrap());
match read_frontier_v1(reader) {
@ -64,7 +64,7 @@ pub extern "C" fn orchard_merkle_frontier_parse(
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_serialize(
frontier: *const bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
frontier: *const bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH>,
stream: Option<StreamObj>,
write_cb: Option<WriteCb>,
) -> bool {
@ -86,7 +86,7 @@ pub extern "C" fn orchard_merkle_frontier_serialize(
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_append_bundle(
tree: *mut bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *mut bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH>,
bundle: *const orchard::Bundle<Authorized, Amount>,
) -> bool {
let tree = unsafe {
@ -95,7 +95,7 @@ pub extern "C" fn orchard_merkle_frontier_append_bundle(
};
if let Some(bundle) = unsafe { bundle.as_ref() } {
for action in bundle.actions().iter() {
if !tree.append(&MerkleCrhOrchardOutput::from_cmx(action.cmx())) {
if !tree.append(&MerkleHashOrchard::from_cmx(action.cmx())) {
error!("Orchard note commitment tree is full.");
return false;
}
@ -107,7 +107,7 @@ pub extern "C" fn orchard_merkle_frontier_append_bundle(
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_root(
tree: *const bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *const bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH>,
root_ret: *mut [u8; 32],
) {
let tree = unsafe {
@ -126,7 +126,7 @@ pub extern "C" fn orchard_merkle_frontier_root(
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_num_leaves(
tree: *const bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *const bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH>,
) -> usize {
let tree = unsafe {
tree.as_ref()
@ -138,7 +138,7 @@ pub extern "C" fn orchard_merkle_frontier_num_leaves(
#[no_mangle]
pub extern "C" fn orchard_merkle_frontier_dynamic_mem_usage(
tree: *const bridgetree::Frontier<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *const bridgetree::Frontier<MerkleHashOrchard, MERKLE_DEPTH>,
) -> usize {
let tree = unsafe {
tree.as_ref()
@ -155,15 +155,15 @@ pub extern "C" fn orchard_merkle_frontier_dynamic_mem_usage(
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_empty(
) -> *mut BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
let empty_tree = BridgeTree::<MerkleCrhOrchardOutput, MERKLE_DEPTH>::new(MAX_CHECKPOINTS);
) -> *mut BridgeTree<MerkleHashOrchard, MERKLE_DEPTH> {
let empty_tree = BridgeTree::<MerkleHashOrchard, MERKLE_DEPTH>::new(MAX_CHECKPOINTS);
Box::into_raw(Box::new(empty_tree))
}
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_clone(
tree: *const BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
) -> *mut BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
tree: *const BridgeTree<MerkleHashOrchard, MERKLE_DEPTH>,
) -> *mut BridgeTree<MerkleHashOrchard, MERKLE_DEPTH> {
unsafe { tree.as_ref() }
.map(|tree| Box::into_raw(Box::new(tree.clone())))
.unwrap_or(std::ptr::null_mut())
@ -171,7 +171,7 @@ pub extern "C" fn incremental_sinsemilla_tree_clone(
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_free(
tree: *mut BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *mut BridgeTree<MerkleHashOrchard, MERKLE_DEPTH>,
) {
if !tree.is_null() {
drop(unsafe { Box::from_raw(tree) });
@ -182,7 +182,7 @@ pub extern "C" fn incremental_sinsemilla_tree_free(
pub extern "C" fn incremental_sinsemilla_tree_parse(
stream: Option<StreamObj>,
read_cb: Option<ReadCb>,
) -> *mut BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH> {
) -> *mut BridgeTree<MerkleHashOrchard, MERKLE_DEPTH> {
let reader = CppStreamReader::from_raw_parts(stream, read_cb.unwrap());
match read_tree(reader) {
@ -196,7 +196,7 @@ pub extern "C" fn incremental_sinsemilla_tree_parse(
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_serialize(
tree: *const BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *const BridgeTree<MerkleHashOrchard, MERKLE_DEPTH>,
stream: Option<StreamObj>,
write_cb: Option<WriteCb>,
) -> bool {
@ -217,7 +217,7 @@ pub extern "C" fn incremental_sinsemilla_tree_serialize(
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_append_bundle(
tree: *mut BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *mut BridgeTree<MerkleHashOrchard, MERKLE_DEPTH>,
bundle: *const orchard::Bundle<Authorized, Amount>,
) -> bool {
let tree = unsafe {
@ -226,7 +226,7 @@ pub extern "C" fn incremental_sinsemilla_tree_append_bundle(
};
if let Some(bundle) = unsafe { bundle.as_ref() } {
for action in bundle.actions().iter() {
if !tree.append(&MerkleCrhOrchardOutput::from_cmx(action.cmx())) {
if !tree.append(&MerkleHashOrchard::from_cmx(action.cmx())) {
error!("Orchard note commitment tree is full.");
return false;
}
@ -238,7 +238,7 @@ pub extern "C" fn incremental_sinsemilla_tree_append_bundle(
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_checkpoint(
tree: *mut BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *mut BridgeTree<MerkleHashOrchard, MERKLE_DEPTH>,
) {
let tree = unsafe {
tree.as_mut()
@ -250,7 +250,7 @@ pub extern "C" fn incremental_sinsemilla_tree_checkpoint(
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_rewind(
tree: *mut BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *mut BridgeTree<MerkleHashOrchard, MERKLE_DEPTH>,
) -> bool {
let tree = unsafe {
tree.as_mut()
@ -262,7 +262,7 @@ pub extern "C" fn incremental_sinsemilla_tree_rewind(
#[no_mangle]
pub extern "C" fn incremental_sinsemilla_tree_root(
tree: *const BridgeTree<MerkleCrhOrchardOutput, MERKLE_DEPTH>,
tree: *const BridgeTree<MerkleHashOrchard, MERKLE_DEPTH>,
root_ret: *mut [u8; 32],
) {
let tree = unsafe {
@ -289,7 +289,7 @@ pub extern "C" fn incremental_sinsemilla_tree_empty_root(root_ret: *mut [u8; 32]
let altitude = Altitude::from(MERKLE_DEPTH);
let digest = MerkleCrhOrchardOutput::empty_root(altitude).to_bytes();
let digest = MerkleHashOrchard::empty_root(altitude).to_bytes();
*root_ret = digest;
}

View File

@ -1,15 +1,14 @@
[
["From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/unified_address.py"],
["p2pkh_bytes, p2sh_bytes, sapling_raw_addr, orchard_raw_addr, unified_addr"],
[null, "7a8f739a2d9e945b0ce152a8049e294c4d6e66b1", null, "dcb1d2a37762148db4cee3bbf19fb1ec05891894b13801c622ba6a90faf1119f8224ae3985c6abd3b7bbae", "75316532386638787a6e656d676574797872647a6b66676a756773667839646b713274686e657a65396c333474707674706d656a656774643567686b7768676a7268736466646e74336b34736632757939656138637461756d7a7075646c657a356667756c77716b70753566766a77796374747a79646c383664373434613430617175747a687a7674797a6e68"],
["b3534201cfb1cd8dbf69b8250c18ef41294ca979", null, "902b6565a1c44e7e7a080571af1dd774697cc126f1fc0435d3cdbf868783e9fb4620df4bf175cbf2c3e36f", "05f61273a7201295332fee4579474534809a0aeb817a2bc0594166ad7a462067712533b6eec0fa2d1be99f", "75313371733278796b66737464343332777076366368367336636b683473346833736372746435686b6179367277366a6e3667656e3734726d76636136357775736771653637716d6b6b667a79686c6b7767383071796a33726363616e68356667377a73393032793234676e3271796636706b636363686730356a7a70337972666e3470753861746538673771397239737465767832383434357235776e3378333570663771713332346e746878747a6377786576796661346c326d326d327873376564766570396674613476747776686b617878"],
[null, "e8c7203d996af7d477083756d59af80d06a745f4", null, "4ea7d6b3dfa338192af06cbbf47ad405715bc7832bedb1466217dc0d93314de9f3c25eec89f9a21bfe0e93", "75317270776b64357837746534657a636d6c716172676b66336372737066716b686d787766737170713032346a6173733267373465347233367a70353071737333766863743732736163687573306b37303578796768756c726a786364777764617130716a6e6e737366326676616b7a7a386634367077387263613933366665796566366d6c36657137776c6c"],
[null, null, "02f1536b622c01346742d8f90e9d4ff39137f1bebe6e23ad9971776b3372702494cc08951eef032b35350f", null, "7531396468786d38386776637739747774767a6b7537637a376a753372767075356a766832637138676d38716465766e6c34657365793833667a7239796d666133676a6d6d6b3472786a3279703838677478646b71676e6a366e6e717974667568303875796335667572"],
[null, "183e31d49f25c9a138f49b1a537edcf04be34a98", "3246b59a5b492dab1855cc176bddfa28418f11f97f7b361cc3e8834b2c30d2a1717df323ef98ea7de71d2e", "ab6d26252c521547049de208283d96278bb221a6874cb5a86af1d3f8b3db3fbee3dbefedcb2c71e3ca1ead", "75313563327972666a7774743636336e713068707173683678746a793238387a7476616375616c37336d666675723338336d7465706339687278743374703465613568373830706733686b35756a326775393770326c756d39716a6836327872613763336879366e6471327877686737657138713736766632386333326437766d6c337a323934767438656374636c773672307032336e64703578647a666578633971773065777572796e6a353235736b78376d306a756b636a7265616b6a3261703332376b6a7172767567656435667930737a79"],
[null, null, "970dc3450d34554141d356cb548056279c57708fa73bd16ffe9a2e24ea694898a7b8af1b0ff92585d02623", "0414bb62b86149ee731851f27d532ac0361169da46e6d53d19d3dfd07a5bae22969922d8d0af7dc1e13bae", "75317a6467397a376c7732713037357977396e306a376668387279756a73726a727237347a71783939337463736874666d6d3271786b74763372303438653774723471356a38736665703367396e76387770786639767472336a7a6e6d6d35367a3775706a6530356b7a766d75726d706371703034633033377a32646833356364383232357874336b34376e7a6668327974737630376d337438676433337035723276376b66656739343571376a63306768"],
[null, "098b79535e790fe53e29fef2b3766697ac32b4f4", "a8a8797c1ba69f78672affa65b943975026931ea628431f0991e744872ac9f36946f5dcd6851a0b5af29cf", "678ab0079bea28bf165c1ab976a2a58c18a7811ca2ad0ad649e876273d04325da6ca53cdb83c111e8e4394", "7531796a7733366d7a777a346a643879746e726436676b68376179676d656a3272746c716733766a397965656866646b3233356a657336727170666a6c777167333776346d653575676a6c7a72646e68676c383872726c6567383378386130716d77797a7936393872387675636e346877616772367163657a7373663663683074373466633068766e366d373737687037353761766632636b7a63333239357033323430716c7675707964656c37336c377163746e343063796b357536736573617772367a6d6b746c6a6678687163633765773468"],
[null, null, "3509c9e069e89fe501d97622c283ac98923da2d7e6eb346b4bafa67865e1e6dae7cf213b1ea3648dc09b48", null, "753171786b796d6b68647a6372727a6c79346672717563646b66736e6a377776776c716575306b3466337472706e657a3476777a75686b64616a6b356537363437346d6a34396b75653978396866776566386d34377363633861703933686e6773657567333864706371"],
[null, "30d069896cff30eb414f727b89e001afa2fb8dc3", "55bc46aea6f60c1d61915640029b2af6334d7d27e1c47a248ab47c9fbe5d2d7bb5818739f062e37136654c", null, "75316433726b71777a396b37346b7475766c746e32746d746a36676b6c6739336877733937797473337a75363038766b76673363327973686d6d3330713668386b6434727433733076703475616a776668396137356538613837306e39346c6b70657835617337716e77333436346e7261747563356e35793575766e7a7666326d3466656a687a6576686e306d"],
[null, null, "5c26a8117729334a957ca7941d47b2ce7040e844fa9882c25bfd2fcf51fa8ab21376f5300d0123f5703e9e", null, "75316166617430647574617379666b736161766d34726c336178716e75786c777437363573393476397a716a7430397a793633646c356d6d7970397835636b7672756c6d647134636b6a337272763766396c37756e78666c306438723635383234746773677276673071"]
[null, "7a8f739a2d9e945b0ce152a8049e294c4d6e66b1", null, "dcb1d2a37762148db4cee3bbf19fb1ec05891894b13801c622ba6a90faf1119f8224ae3985c6abd3b7bbae", "7531743779336e647634367476636465377834363835616a6d676b353970643039326c68733477616e776c646834666d3775636a723074343468667a356a6375667a75616b65667a7571767a376a30617974736e6677347065796478387538746a7371347738756b7336727973633635356d786b6a367778786870676b6e79733533657978706b383978797363"],
["b3534201cfb1cd8dbf69b8250c18ef41294ca979", null, "902b6565a1c44e7e7a080571af1dd774697cc126f1fc0435d3cdbf868783e9fb4620df4bf175cbf2c3e36f", "05f61273a7201295332fee4579474534809a0aeb817a2bc0594166ad7a462067712533b6eec0fa2d1be99f", "75316665686b656a646d3630613871353567736576716c78676632396a38676c377364393436756e6a73346e6c343473633434307274657435756771373264637839706a7468396c323372706a7566757a63776837357971657a753235617532383970717274616c713637776e343066787177306c6e377a78777a397973787575307a39337772676e6d6671376b33666e36747a63307637727a396733706a67777571746c6b7a786873783839617a39656868336c356a357175757572776e376e33746a786c616e3235726e7134676a7a61387436"],
[null, "e8c7203d996af7d477083756d59af80d06a745f4", null, "4ea7d6b3dfa338192af06cbbf47ad405715bc7832bedb1466217dc0d93314de9f3c25eec89f9a21bfe0e93", "7531646a686778773579747a7463356d75323272346d733567796d3864776867383432326667757879766c7465787638787572677338637230756b7264797337667668716d6d6173616667666530677435776e306d756a6e63333467746d637734397565646b68707a79787a34397a7678356339757130686a64356e37747267736e656a686a716d7376723663"],
[null, null, "02f1536b622c01346742d8f90e9d4ff39137f1bebe6e23ad9971776b3372702494cc08951eef032b35350f", null, "75313363366d36716e657a72337966753468757630356e687961356372786e35347861786a78376d6b6674393861796e7a336b68636e6176647961306c746a797565717a3577706d306d7a6a357a646c343464323076657a6768753272743861737635636c6133746463"],
[null, "183e31d49f25c9a138f49b1a537edcf04be34a98", "3246b59a5b492dab1855cc176bddfa28418f11f97f7b361cc3e8834b2c30d2a1717df323ef98ea7de71d2e", "ab6d26252c521547049de208283d96278bb221a6874cb5a86af1d3f8b3db3fbee3dbefedcb2c71e3ca1ead", "75313565326e323536746b636837396677797a766c66337378666c66727772666d3664336d6539306e763932666b6575776e653477737975657a656e71356a7368716e6730396e776c7930353735717370373668687878776b6a6373736b6365666c38356c307465793338773236746c6c6575787a66676d38703732727435373033637238787579307577376c7263746e6767396b377a75387a75667576397178633674796a7278337833676a76796b646d79616d34797633793471376a666c783070306d39347066737739687a6b376132387079"],
[null, null, "970dc3450d34554141d356cb548056279c57708fa73bd16ffe9a2e24ea694898a7b8af1b0ff92585d02623", "0414bb62b86149ee731851f27d532ac0361169da46e6d53d19d3dfd07a5bae22969922d8d0af7dc1e13bae", "75316b616c6b6d3276717267716d386c6c71657568353372777a6c657435676561346d6b647739376a3970613372636574767a76336c6b6b33653075333534337670746774326b3075616638383630386675337563656676776577797a3974717765616a3377756c6c30706437306d746e687977656b306c3576617a6361366577663472646d7778713866327334706d35687175366d6567397a6774677a76393872787a6832777835766576797330346573"],
[null, "098b79535e790fe53e29fef2b3766697ac32b4f4", "a8a8797c1ba69f78672affa65b943975026931ea628431f0991e744872ac9f36946f5dcd6851a0b5af29cf", "678ab0079bea28bf165c1ab976a2a58c18a7811ca2ad0ad649e876273d04325da6ca53cdb83c111e8e4394", "75316d30767a6e3738676830796d71356b717a346c7064343039357770756538686e687a7373357a34736c3338737a6e38767736683934787576636a763561686b6e706d6c72613637756563766e6b6d73397966717834733768736e737a7a6d63706776787232306c6834353970733375337766366d727a77653678396b646a3874703061366373656432656d7870367137716e7761746432786d3470736a683472346739706866663534747375786535373638746873787373617678726679747064706d37326b6a7372797061797a7767713978"],
[null, null, "3509c9e069e89fe501d97622c283ac98923da2d7e6eb346b4bafa67865e1e6dae7cf213b1ea3648dc09b48", null, "7531357676383834637a356436346e677232717634307835797171677a366a743368657a75396d6b7566323064756a61663871766b736c6e78793738663264707879323470767637797666637a6b6c307761653435613070683664377a37646574336a67347267677866"],
[null, "30d069896cff30eb414f727b89e001afa2fb8dc3", "55bc46aea6f60c1d61915640029b2af6334d7d27e1c47a248ab47c9fbe5d2d7bb5818739f062e37136654c", null, "753137766a736b6c7234756a6463386c307a686b646d6b71717778343833673861363432653937366c7466733073346a65643761673376336138726e677275366e653438687a7233336b6b7a70366d61677a336679656a777a6a6734336a6470657274667078656e326661747a356b3830636a6b6c6e39713772396d3033646e366736306332796c3336393474"],
[null, null, "5c26a8117729334a957ca7941d47b2ce7040e844fa9882c25bfd2fcf51fa8ab21376f5300d0123f5703e9e", null, "75313976636e33726564706170687834326d6e307379633236793877397766676c657a396175736b61787267686d78383064756e61333663616763337973376d6e336a373639766367387275336b646e61713470683436303438646873766c35646d6473677879653833"]
]

View File

@ -69,25 +69,25 @@ bool IsValidSpendingKey(const libzcash::SpendingKey& zkey) {
return !std::holds_alternative<libzcash::InvalidEncoding>(zkey);
}
uint8_t TypecodeForReceiver::operator()(
uint32_t TypecodeForReceiver::operator()(
const libzcash::SaplingPaymentAddress &zaddr) const
{
return ZCASH_UA_TYPECODE_SAPLING;
}
uint8_t TypecodeForReceiver::operator()(
uint32_t TypecodeForReceiver::operator()(
const libzcash::P2SHAddress &p2sh) const
{
return ZCASH_UA_TYPECODE_P2SH;
}
uint8_t TypecodeForReceiver::operator()(
uint32_t TypecodeForReceiver::operator()(
const libzcash::P2PKHAddress &p2sh) const
{
return ZCASH_UA_TYPECODE_P2PKH;
}
uint8_t TypecodeForReceiver::operator()(
uint32_t TypecodeForReceiver::operator()(
const libzcash::UnknownReceiver &unknown) const
{
return unknown.typecode;

View File

@ -32,10 +32,10 @@ public:
class UnknownReceiver {
public:
uint8_t typecode;
uint32_t typecode;
std::vector<uint8_t> data;
UnknownReceiver(uint8_t typecode, std::vector<uint8_t> data) :
UnknownReceiver(uint32_t typecode, std::vector<uint8_t> data) :
typecode(typecode), data(data) {}
friend inline bool operator==(const UnknownReceiver& a, const UnknownReceiver& b) {
@ -176,10 +176,10 @@ class TypecodeForReceiver {
public:
TypecodeForReceiver() {}
uint8_t operator()(const libzcash::SaplingPaymentAddress &zaddr) const;
uint8_t operator()(const libzcash::P2SHAddress &p2sh) const;
uint8_t operator()(const libzcash::P2PKHAddress &p2pkh) const;
uint8_t operator()(const libzcash::UnknownReceiver &p2pkh) const;
uint32_t operator()(const libzcash::SaplingPaymentAddress &zaddr) const;
uint32_t operator()(const libzcash::P2SHAddress &p2sh) const;
uint32_t operator()(const libzcash::P2PKHAddress &p2pkh) const;
uint32_t operator()(const libzcash::UnknownReceiver &p2pkh) const;
};
/**