zingolib icon indicating copy to clipboard operation
zingolib copied to clipboard

Ctrl-C exit from zingo-cli causes unrecoverable wallet to be written

Open zancas opened this issue 2 years ago • 5 comments

**Batch** Current:  127 Total: 18014
   Blocks Loaded:  100 TrialDecrypted:    0, Witnesses Updated:    0, Total:  100,
**Batch** Current:  133 Total: 18014
   Blocks Loaded:   24 TrialDecrypted:    0, Witnesses Updated:    0, Total:  100,
**Batch** Current:  139 Total: 18014
   Blocks Loaded:    0 TrialDecrypted:    0, Witnesses Updated:    0, Total:  100,
**Batch** Current:  144 Total: 18014
   Blocks Loaded:  100 TrialDecrypted:    0, Witnesses Updated:    0, Total:  100,
**Batch** Current:  150 Total: 18014
   Blocks Loaded:  100 TrialDecrypted:    0, Witnesses Updated:    0, Total:  100,
^C
RC: 130 $ cargo run -- data-dir ../../wallets/test1/
   Compiling zingolib v0.2.0 (/home/nattyb/src/zingolabs/zingolibs/dev/zingolib)
   Compiling zingo-testutils v0.1.0 (/home/nattyb/src/zingolabs/zingolibs/dev/zingo-testutils)
   Compiling zingo-cli v0.2.0 (/home/nattyb/src/zingolabs/zingolibs/dev/zingocli)
    Finished dev [unoptimized + debuginfo] target(s) in 8.58s
     Running `target/debug/zingo-cli data-dir ../../wallets/treasury/`
2023-09-29T03:19:02.486101Z  INFO zingo_cli: data_dir: wallets
2023-09-29T03:19:02.488975Z  INFO zingolib::wallet: LightWallet serialized_version read from external: 28
2023-09-29T03:19:02.489006Z  INFO zingolib::wallet: Reading wallet version 28
2023-09-29T03:19:02.489014Z  INFO zingolib::wallet::traits: wallet_capability external_version: 2
2023-09-29T03:19:02.489021Z  INFO zingolib::wallet::traits: Self::VERSION: 2
2023-09-29T03:19:02.489025Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:02.489030Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:02.496271Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:02.496278Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:02.496302Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:02.496305Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:02.496309Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:02.496316Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:02.496365Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:02.496369Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:02.504971Z  INFO zingolib::wallet: Keys in this wallet:
2023-09-29T03:19:02.504983Z  INFO zingolib::wallet:   - Orchard Spending Key
2023-09-29T03:19:02.504987Z  INFO zingolib::wallet:   - Sapling Extended Spending Key
2023-09-29T03:19:02.504991Z  INFO zingolib::wallet:   - transparent extended private key
thread 'main' panicked at 'to insert non-empty sapling frontier: Insert(Conflict(Address { level: Level(13), index: 0 }))', zingolib/src/wallet/data.rs:184:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
RC: 101 $ cargo run -- data-dir ../../wallets/test1/
   Compiling zingolib v0.2.0 (/home/nattyb/src/zingolabs/zingolibs/dev/zingolib)
   Compiling zingo-testutils v0.1.0 (/home/nattyb/src/zingolabs/zingolibs/dev/zingo-testutils)
   Compiling zingo-cli v0.2.0 (/home/nattyb/src/zingolabs/zingolibs/dev/zingocli)
    Finished dev [unoptimized + debuginfo] target(s) in 8.37s
     Running `target/debug/zingo-cli data-dir ../../wallets/treasury/`
2023-09-29T03:19:34.325621Z  INFO zingo_cli: data_dir: wallets
2023-09-29T03:19:34.372501Z  INFO zingolib::wallet: LightWallet serialized_version read from external: 28
2023-09-29T03:19:34.372560Z  INFO zingolib::wallet: Reading wallet version 28
2023-09-29T03:19:34.372578Z  INFO zingolib::wallet::traits: wallet_capability external_version: 2
2023-09-29T03:19:34.372594Z  INFO zingolib::wallet::traits: Self::VERSION: 2
2023-09-29T03:19:34.372604Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:34.372622Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:34.386770Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:34.386777Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:34.386806Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:34.386810Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:34.386814Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:34.386822Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:34.386872Z  INFO zingolib::wallet::traits: wallet_capability external_version: 1
2023-09-29T03:19:34.386876Z  INFO zingolib::wallet::traits: Self::VERSION: 1
2023-09-29T03:19:34.395292Z  INFO zingolib::wallet: Keys in this wallet:
2023-09-29T03:19:34.395303Z  INFO zingolib::wallet:   - Orchard Spending Key
2023-09-29T03:19:34.395306Z  INFO zingolib::wallet:   - Sapling Extended Spending Key
2023-09-29T03:19:34.395309Z  INFO zingolib::wallet:   - transparent extended private key
thread 'main' panicked at 'to insert non-empty sapling frontier: Insert(Conflict(Address { level: Level(13), index: 0 }))', zingolib/src/wallet/data.rs:184:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

zancas avatar Sep 29 '23 03:09 zancas

Note, this was a view only wallet.

zancas avatar Sep 29 '23 19:09 zancas

Note, this was a view only wallet.

Wow. This panic is happening inside a call that's behind a check for spend-capability, it shouldn't be possible to hit this code in view-only mode!

AloeareV avatar Sep 29 '23 19:09 AloeareV

"Total: 18014" unless you were syncing from the start of the sapling epoch, this is wrong. This isn't to do with the Ctrl+C, this was wrong before you did that. I think we're reading an old wallet file and creating witness trees, when we shouldn't be doing that in viewkey mode...and I don't know why this would cause sync to start from the very beginning. I will do some manual tests, and write some tests.

AloeareV avatar Oct 02 '23 21:10 AloeareV

I think we're reading an old wallet file and creating witness trees, when we shouldn't be doing that in viewkey mode.

We're not doing this. I've been unable to replicate the 18000+ batches behavior. If this ever happens again and we get more information, I will come back to this...but right now there's only a single instance of this that we've seen, and there isn't enough information for me to learn much from it.

AloeareV avatar Oct 03 '23 18:10 AloeareV

I have not been able to reproduce this error on a wallet with just over 8000 blocks to sync, when I press CTRL + C there is no error and I can resume the wallet.

Edicksonjga avatar Oct 06 '23 01:10 Edicksonjga