diff --git a/zcash_client_sqlite/CHANGELOG.md b/zcash_client_sqlite/CHANGELOG.md new file mode 100644 index 000000000..63f911ae4 --- /dev/null +++ b/zcash_client_sqlite/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to Rust's notion of +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.2.1] - 2020-10-24 +### Fixed +- `transact::create_to_address` now correctly reconstructs notes from the data + DB after Canopy activation (zcash/librustzcash#311). This is critcal to correct + operation of spends after Canopy. diff --git a/zcash_client_sqlite/Cargo.toml b/zcash_client_sqlite/Cargo.toml index 83206969f..e01eb8f8b 100644 --- a/zcash_client_sqlite/Cargo.toml +++ b/zcash_client_sqlite/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zcash_client_sqlite" description = "An SQLite-based Zcash light client" -version = "0.2.0" +version = "0.2.1" authors = [ "Jack Grigg ", ] diff --git a/zcash_client_sqlite/src/transact.rs b/zcash_client_sqlite/src/transact.rs index 6eeb87610..1c8a524e3 100644 --- a/zcash_client_sqlite/src/transact.rs +++ b/zcash_client_sqlite/src/transact.rs @@ -6,7 +6,7 @@ use std::convert::TryInto; use std::path::Path; use zcash_client_backend::{address::RecipientAddress, encoding::encode_extended_full_viewing_key}; use zcash_primitives::{ - consensus::{self, NetworkUpgrade}, + consensus, keys::OutgoingViewingKey, merkle_tree::{IncrementalWitness, MerklePath}, note_encryption::Memo, @@ -228,21 +228,18 @@ pub fn create_to_address, P: consensus::Parameters>( let note_value: i64 = row.get(1)?; let rseed = { - let d: Vec<_> = row.get(2)?; + let rcm_bytes: Vec<_> = row.get(2)?; - if params.is_nu_active(NetworkUpgrade::Canopy, height) { - let mut r = [0u8; 32]; - r.copy_from_slice(&d[..]); - Rseed::AfterZip212(r) - } else { - let r = jubjub::Fr::from_repr( - d[..] - .try_into() - .map_err(|_| Error(ErrorKind::InvalidNote))?, - ) - .ok_or(Error(ErrorKind::InvalidNote))?; - Rseed::BeforeZip212(r) - } + // We store rcm directly in the data DB, regardless of whether the note + // used a v1 or v2 note plaintext, so for the purposes of spending let's + // pretend this is a pre-ZIP 212 note. + let rcm = jubjub::Fr::from_repr( + rcm_bytes[..] + .try_into() + .map_err(|_| Error(ErrorKind::InvalidNote))?, + ) + .ok_or(Error(ErrorKind::InvalidNote))?; + Rseed::BeforeZip212(rcm) }; let from = extfvk.fvk.vk.to_payment_address(diversifier).unwrap();