Zcash: More verbose logging for wallet state

Created on 28 Dec 2019  路  3Comments  路  Source: zcash/zcash

From https://github.com/zcash/zcash/issues/4138

zcashd ought to be more verbose in its debug logging of wallet state updates (txos/notes added, spent, expired, etc). There are many reported bugs about wallet state and they're difficult to analyze because the debug log says so little about this.

Also related: https://github.com/zcash/zcash/issues/3114

Please add your comments. Will be good to discuss what format and content this new entries will have in the log.

Most helpful comment

I suggest the following requirement:

With the requisite debugging flags enabled, it should be possible, just by scanning the debug log, to accurate track (or retroactively reproduce) the wallet state and its changes over time, in terms of:

  1. Any transactions/utxos/notes sent from or received to addresses managed by this wallet

    • when/if those transaction/notes/utxos are locally generated

    • when/if those transaction/notes/utxos enter the mempool

    • when/if those transaction/notes/utxos are mined (i.e., appear in what the wallet considers the current chain)

    • when/if those transactions are lost to a rollback/reorg

    • when/if those notes/utxos are spent/nullified

    • when/if those notes/utxos are revert to unspent/not-nullified due to a rollback/reorg

  2. Balances, both unconfirmed and 1-confirmed

    • when/if they change

Note that 2 can be deduced from 1, but reporting 2 explicitly would help debug the zcashd code that computes 2.

Working on this may open opportunities for new tests. Let's identify those, because we _know_ the current code is broken on some ill-understood corner cases! Ditto, refactoring opportunities.

Also, the wallet SDK and Zecwallet face some similar tasks, so perhaps there's overlap/inspiration there, or perhaps opportunities for code reuse or at least format-compatible logging? (ping: @str4d, @adityapk00)

All 3 comments

I suggest the following requirement:

With the requisite debugging flags enabled, it should be possible, just by scanning the debug log, to accurate track (or retroactively reproduce) the wallet state and its changes over time, in terms of:

  1. Any transactions/utxos/notes sent from or received to addresses managed by this wallet

    • when/if those transaction/notes/utxos are locally generated

    • when/if those transaction/notes/utxos enter the mempool

    • when/if those transaction/notes/utxos are mined (i.e., appear in what the wallet considers the current chain)

    • when/if those transactions are lost to a rollback/reorg

    • when/if those notes/utxos are spent/nullified

    • when/if those notes/utxos are revert to unspent/not-nullified due to a rollback/reorg

  2. Balances, both unconfirmed and 1-confirmed

    • when/if they change

Note that 2 can be deduced from 1, but reporting 2 explicitly would help debug the zcashd code that computes 2.

Working on this may open opportunities for new tests. Let's identify those, because we _know_ the current code is broken on some ill-understood corner cases! Ditto, refactoring opportunities.

Also, the wallet SDK and Zecwallet face some similar tasks, so perhaps there's overlap/inspiration there, or perhaps opportunities for code reuse or at least format-compatible logging? (ping: @str4d, @adityapk00)

@LarryRuane has submitted a few PRs that might aid much of what is discussed above.

@mdr0id / @LarryRuane can you post the links of submitted PRs? Looking to group together all related to "add more logs". Thanks.

Was this page helpful?
0 / 5 - 0 ratings