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

wallet migration broken when accounts table includes a UFVK that lacks a Transparent key #1531

Closed
AArnott opened this issue Sep 7, 2024 · 4 comments

Comments

@AArnott
Copy link
Contributor

AArnott commented Sep 7, 2024

After upgrading eZcash to consume zcash_client_sqlite-0.11.1, I found that wallet migrations lead to an error, crashing the app.

This is blocking an eZcash release that adds support for TEX addresses

Specifically, when the accounts table includes an account defined by only a UFVK without a Transparent key, the ephemeral_addresses.rs migration fails:

let eivk = ufvk
.as_ref()
.and_then(|ufvk| ufvk.transparent())
.ok_or(SqliteClientError::UnknownZip32Derivation)?
.derive_ephemeral_ivk()?;

The ok_or function returns an error, that ultimately is rendered as this message:

internal error: entered unreachable code: we don't call methods that require operating on imported accounts

The callstack at this point is:

>	nerdbank_zcash_rust.dll!zcash_client_sqlite::wallet::transparent::ephemeral::get_ephemeral_ivk<zcash_protocol::consensus::Network>(rusqlite::Connection * conn, zcash_protocol::consensus::Network * params, zcash_client_sqlite::AccountId account_id) Line 133	Rust
 	nerdbank_zcash_rust.dll!zcash_client_sqlite::wallet::transparent::ephemeral::reserve_until<zcash_protocol::consensus::Network>(rusqlite::transaction::Transaction * conn, zcash_protocol::consensus::Network * params, zcash_client_sqlite::AccountId account_id, unsigned int next_to_reserve) Line 291	Rust
 	nerdbank_zcash_rust.dll!zcash_client_sqlite::wallet::transparent::ephemeral::init_account<zcash_protocol::consensus::Network>(rusqlite::transaction::Transaction * conn, zcash_protocol::consensus::Network * params, zcash_client_sqlite::AccountId account_id) Line 265	Rust
 	nerdbank_zcash_rust.dll!zcash_client_sqlite::wallet::init::migrations::ephemeral_addresses::impl$1::up<zcash_protocol::consensus::Network>(zcash_client_sqlite::wallet::init::migrations::ephemeral_addresses::Migration<zcash_protocol::consensus::Network> * self, rusqlite::transaction::Transaction * transaction) Line 71	Rust
 	nerdbank_zcash_rust.dll!schemer_rusqlite::impl$2::apply_migration<enum2$<zcash_client_sqlite::wallet::init::WalletMigrationError>>(schemer_rusqlite::RusqliteAdapter<enum2$<zcash_client_sqlite::wallet::init::WalletMigrationError>> * self, ref$<dyn$<schemer_rusqlite::RusqliteMigration<assoc$<Error,enum2$<zcash_client_sqlite::wallet::init::WalletMigrationError>>>>>) Line 164	Rust
 	nerdbank_zcash_rust.dll!schemer::Migrator<schemer_rusqlite::RusqliteAdapter<enum2$<zcash_client_sqlite::wallet::init::WalletMigrationError>>>::up<schemer_rusqlite::RusqliteAdapter<enum2$<zcash_client_sqlite::wallet::init::WalletMigrationError>>>(enum2$<core::option::Option<uuid::Uuid>> self) Line 305	Rust
 	nerdbank_zcash_rust.dll!zcash_client_sqlite::wallet::init::init_wallet_db_internal<zcash_protocol::consensus::Network>(zcash_client_sqlite::WalletDb<rusqlite::Connection,zcash_protocol::consensus::Network> * wdb, enum2$<core::option::Option<secrecy::Secret<alloc::vec::Vec<u8,alloc::alloc::Global>>>> seed, ref$<slice2$<uuid::Uuid>> verify_seed_relevance, bool) Line 327	Rust
 	nerdbank_zcash_rust.dll!zcash_client_sqlite::wallet::init::init_wallet_db<zcash_protocol::consensus::Network>(zcash_client_sqlite::WalletDb<rusqlite::Connection,zcash_protocol::consensus::Network> * wdb, enum2$<core::option::Option<secrecy::Secret<alloc::vec::Vec<u8,alloc::alloc::Global>>>> seed) Line 300	Rust
@nuttycom
Copy link
Contributor

nuttycom commented Sep 7, 2024

This is fixed by #1524

@AArnott
Copy link
Contributor Author

AArnott commented Sep 7, 2024

Are there any changes in this commit or any other changes since the last release that would make it inadvisable for me to merge your branch in directly rather than waiting for another official release?

@nuttycom
Copy link
Contributor

nuttycom commented Sep 7, 2024 via email

AArnott added a commit to nerdcash/librustzcash that referenced this issue Sep 7, 2024
AArnott added a commit to nerdcash/Nerdbank.Cryptocurrencies that referenced this issue Sep 7, 2024
@nuttycom
Copy link
Contributor

nuttycom commented Sep 8, 2024

#1524 is merged

@nuttycom nuttycom closed this as completed Sep 8, 2024
AArnott added a commit to nerdcash/Nerdbank.Cryptocurrencies that referenced this issue Oct 20, 2024
- Update .vsconfig from github fork
- Patch job for zcash/librustzcash#1531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants