Skip to content

Conversation

@aszepieniec
Copy link
Contributor

There might be something useful in these changes. Credit to AllFather team.

Copy link
Member

@Sword-Smith Sword-Smith left a comment

Choose a reason for hiding this comment

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

The changes to wallet_state.rs module are obviated by #805. But the changes to global state (neptune-core/src/state/mod.rs) look like a very fine idea to me. Do you want to resubmit PR with only the changes to neptune-core/src/state/mod.rs?

@aszepieniec aszepieniec force-pushed the sync-performance-fixes branch 2 times, most recently from f82252c to 025b8e6 Compare December 11, 2025 08:59
@aszepieniec
Copy link
Contributor Author

I had some doubts at first but after splitting the changes into incremental commits I convinced myself that it's all good. I just force-pushed essentially the same changes, spread out over more commits, and without the changes to wallet_state.rs. I'm happy with the state of this PR now and ready to merge when you are.

@aszepieniec
Copy link
Contributor Author

It looks like the early returns also live in wallet_state.rs. Would you like me to remove those as well? (I read your request as pertaining to the parallelization of index derivation specifically.)

@aszepieniec
Copy link
Contributor Author

Ball is in your park @Sword-Smith.

The question is about the early returns in wallet_state.rs. Keep or drop?

@aszepieniec aszepieniec force-pushed the sync-performance-fixes branch from 3816950 to 222957e Compare December 23, 2025 06:00
Caches grow quite large during restoration of 1000s of UTXOs, leading to
out-of-memory errors.

Credit to AllFather team.
…ived

In other words, do not call the restoration method whenever the vector of
UTXOs received in this block is empty.

Credit to AllFather team.
Credit to AllFather team.
Iterate only over new UTXOs, not all UTXOs, in the course of MUTXO MSMP
restoration. Makes syncing faster. But do this only when a flag is set,
so that we can set it while syncing (and default to the full range in all
other cases).

Credit to AllFather team. Docstring modified by Alan.
Modify the optimization of function
`restore_monitored_utxos_from_archival_mutator_set` whereby only the trailing
end of the list of monitored UTXOs is processed if `process_all` is false and
if `new_utxos` contains some non-empty vector.

As a result of @Sword-Smith's new database schema, all necessary data for
fetching a mutator set membership proof for a given UTXO lives on the
`MonitoredUtxo` struct. Consequently, the corresponding data for monitored UTXOs
that do not have a membership proof yet is already available -- and there is no
need to pass this data as an argument. Indeed, the PR that applied that database
schema change already dropped the argument `new_utxos`.

Meanwhile, PR `sync-performance-fixes` used argument `new_utxos` for an
optimization, namely to skip the updates of all monitored UTXOs that already
have some MSMP, even if it is outdated. The relevant information contained by
the argument `new_utxos` is its length (if `Some`), because based on the length
of the tail we know where to set the starting index for the loop.

This PR merges arguments `process_all` and `new_utxos` into one argument,
`ignore_all_but_trailing` of type `Option<usize>`. Set it to `None` for the
default behavior, in which case none of the monitored UTXOs will be ignored.
During syncing, or other cases where we don't care about outdated membership
proofs and only care about populating the `k` trailing new monitored UTXOs with
some membership proofs, set it to `Some(k)`.
@aszepieniec aszepieniec force-pushed the sync-performance-fixes branch from 222957e to 0f19b4d Compare December 23, 2025 07:14
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

Successfully merging this pull request may close these issues.

3 participants