Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release zcash_client_sqlite version 0.11.1 #28

Open
wants to merge 1 commit into
base: ecc_main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ members = [

[workspace.package]
edition = "2021"
rust-version = "1.77"
rust-version = "1.77.0"
repository = "https://github.com/zcash/librustzcash"
license = "MIT OR Apache-2.0"
categories = ["cryptography::cryptocurrencies"]
Expand Down
2 changes: 1 addition & 1 deletion components/zcash_address/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::kind::unified::Encoding;
use crate::{kind::*, AddressKind, ZcashAddress};

/// An error while attempting to parse a string as a Zcash address.
#[derive(Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ParseError {
/// The string is an invalid encoding.
InvalidEncoding,
Expand Down
2 changes: 1 addition & 1 deletion components/zcash_address/src/kind/unified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl Typecode {
}

/// An error while attempting to parse a string as a Zcash address.
#[derive(Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ParseError {
/// The unified container contains both P2PKH and P2SH items.
BothP2phkAndP2sh,
Expand Down
16 changes: 15 additions & 1 deletion components/zcash_address/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub struct ZcashAddress {

/// Known kinds of Zcash addresses.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
enum AddressKind {
pub enum AddressKind {
Sprout([u8; 64]),
Sapling([u8; 43]),
Unified(unified::Address),
Expand All @@ -163,7 +163,21 @@ enum AddressKind {
Tex([u8; 20]),
}

impl AddressKind {
pub fn get_unified_address(&self) -> Option<unified::Address> {
if let AddressKind::Unified(ua) = self {
Some(ua.clone())
} else {
None
}
}
}

impl ZcashAddress {
pub fn kind(&self) -> &AddressKind {
&self.kind
}

/// Encodes this Zcash address in its canonical string representation.
///
/// This provides the encoded string representation of the address as defined by the
Expand Down
7 changes: 7 additions & 0 deletions supply-chain/imports.lock
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ user-id = 6289
user-login = "str4d"
user-name = "Jack Grigg"

[[publisher.zcash_client_sqlite]]
version = "0.11.1"
when = "2024-08-21"
user-id = 169181
user-login = "nuttycom"
user-name = "Kris Nuttycombe"

[[publisher.zcash_encoding]]
version = "0.2.0"
when = "2022-10-19"
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_backend/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn build() -> io::Result<()> {

// Build the gRPC types and client.
tonic_build::configure()
.build_server(false)
.build_server(true)
.client_mod_attribute(
"cash.z.wallet.sdk.rpc",
r#"#[cfg(feature = "lightwalletd-tonic")]"#,
Expand Down
73 changes: 47 additions & 26 deletions zcash_client_backend/src/data_api/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,19 @@ pub type ProposeShieldingErrT<DbT, CommitmentTreeErrT, InputsT, ChangeT> = Error
Infallible,
>;

/// Errors that may be generated in combined creation and execution of transaction proposals.
pub type CreateErrT<DbT, InputsErrT, FeeRuleT, ChangeErrT, N> = Error<
create_proposed_transactions(
wallet_db,
params,
spend_prover,
output_prover,
usk,
ovk_policy,
&proposal,
None,
)
}

type ErrorT<DbT, InputsErrT, FeeRuleT> = Error<
<DbT as WalletRead>::Error,
<DbT as WalletCommitmentTrees>::Error,
InputsErrT,
Expand All @@ -160,16 +171,26 @@ pub type TransferErrT<DbT, InputsT, ChangeT> = Error<
<<InputsT as InputSelector>::InputSource as InputSource>::NoteRef,
>;

/// Errors that may be generated in the execution of shielding proposals.
#[cfg(feature = "transparent-inputs")]
pub type ShieldErrT<DbT, InputsT, ChangeT> = Error<
<DbT as WalletRead>::Error,
<DbT as WalletCommitmentTrees>::Error,
<InputsT as ShieldingSelector>::Error,
<<ChangeT as ChangeStrategy>::FeeRule as FeeRule>::Error,
<ChangeT as ChangeStrategy>::Error,
Infallible,
>;
let proposal = propose_transfer(
wallet_db,
params,
account.id(),
input_selector,
request,
min_confirmations,
)?;

create_proposed_transactions(
wallet_db,
params,
spend_prover,
output_prover,
usk,
ovk_policy,
&proposal,
None,
)
}

/// Select transaction inputs, compute fees, and construct a proposal for a transaction or series
/// of transactions that can then be authorized and made ready for submission to the network with
Expand Down Expand Up @@ -373,7 +394,8 @@ pub fn create_proposed_transactions<DbT, ParamsT, InputsErrT, FeeRuleT, ChangeEr
usk: &UnifiedSpendingKey,
ovk_policy: OvkPolicy,
proposal: &Proposal<FeeRuleT, N>,
) -> Result<NonEmpty<TxId>, CreateErrT<DbT, InputsErrT, FeeRuleT, ChangeErrT, N>>
override_sapling_change_address: Option<sapling::PaymentAddress>,
) -> Result<NonEmpty<TxId>, ErrorT<DbT, InputsErrT, FeeRuleT>>
where
DbT: WalletWrite + WalletCommitmentTrees,
ParamsT: consensus::Parameters + Clone,
Expand Down Expand Up @@ -407,6 +429,7 @@ where
step,
#[cfg(feature = "transparent-inputs")]
&mut unused_transparent_outputs,
override_sapling_change_address,
)?;
step_results.push((step, step_result));
}
Expand Down Expand Up @@ -473,10 +496,8 @@ fn create_proposed_transaction<DbT, ParamsT, InputsErrT, FeeRuleT, ChangeErrT, N
StepOutput,
(TransparentAddress, OutPoint),
>,
) -> Result<
StepResult<<DbT as WalletRead>::AccountId>,
CreateErrT<DbT, InputsErrT, FeeRuleT, ChangeErrT, N>,
>
override_sapling_change_address: Option<sapling::PaymentAddress>,
) -> Result<StepResult<<DbT as WalletRead>::AccountId>, ErrorT<DbT, InputsErrT, FeeRuleT>>
where
DbT: WalletWrite + WalletCommitmentTrees,
ParamsT: consensus::Parameters + Clone,
Expand Down Expand Up @@ -683,9 +704,8 @@ where
utxos_spent.push(outpoint.clone());
builder.add_transparent_input(secret_key, outpoint, txout)?;

Ok(())
};

Ok(())
};
for utxo in proposal_step.transparent_inputs() {
add_transparent_input(
&mut builder,
Expand Down Expand Up @@ -917,7 +937,7 @@ where
PoolType::Shielded(ShieldedProtocol::Sapling) => {
builder.add_sapling_output(
sapling_internal_ovk(),
sapling_dfvk.change_address().1,
override_sapling_change_address.unwrap_or(sapling_dfvk.change_address().1),
change_value.value(),
memo.clone(),
)?;
Expand All @@ -939,7 +959,7 @@ where
{
builder.add_orchard_output(
orchard_internal_ovk(),
orchard_fvk.address_at(0u32, orchard::keys::Scope::Internal),
orchard_fvk.address_at(0u32, orchard::keys::Scope::External),
change_value.value().into(),
memo.clone(),
)?;
Expand Down Expand Up @@ -1005,7 +1025,7 @@ where
let build_result = builder.build(OsRng, spend_prover, output_prover, fee_rule)?;

#[cfg(feature = "orchard")]
let orchard_internal_ivk = orchard_fvk.to_ivk(orchard::keys::Scope::Internal);
let orchard_internal_ivk = orchard_fvk.to_ivk(orchard::keys::Scope::External);
#[cfg(feature = "orchard")]
let orchard_outputs =
orchard_output_meta
Expand All @@ -1030,13 +1050,13 @@ where
})
})
.internal_account_note_transpose_option()
.expect("Wallet-internal outputs must be decryptable with the wallet's IVK");
.expect("Wallet-external outputs must be decryptable with the wallet's IVK");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes!


SentTransactionOutput::from_parts(output_index, recipient, value, memo)
});

let sapling_internal_ivk =
PreparedIncomingViewingKey::new(&sapling_dfvk.to_ivk(Scope::Internal));
PreparedIncomingViewingKey::new(&sapling_dfvk.to_ivk(Scope::External));
let sapling_outputs =
sapling_output_meta
.into_iter()
Expand All @@ -1063,7 +1083,7 @@ where
})
})
.internal_account_note_transpose_option()
.expect("Wallet-internal outputs must be decryptable with the wallet's IVK");
.expect("Wallet-external outputs must be decryptable with the wallet's IVK");

SentTransactionOutput::from_parts(output_index, recipient, value, memo)
});
Expand Down Expand Up @@ -1185,5 +1205,6 @@ where
usk,
OvkPolicy::Sender,
&proposal,
None,
)
}
Loading
Loading