Disable total currency in frontier visualization #18197
Open
+19
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explain your changes:
The total_currency computation that is run in display_attached_mask here will foldi over a mask to compute the total balance of the default token. This causes every account in the ledger represented by that mask to be read; since most of those will be in the ledger database on disk, this is essentially equivalent to a full database read. This full read can take a few seconds to complete (for current devnet and depending on hardware).
This problem is compounded by the fact that display_attached_mask will be run for every mask in the frontier when computing its visualization. For a daemon synced to a network, that's at least 290 iterations of this function, and likely more. This endeds up causing the daemon to "hang" during shutdown if stopped with ctrl-c on the command line; what it's really doing is slowly going through the ledger over and over again to compute this total currency value in order to save the transition frontier visualization to disk.
The change here eliminates this particular shutdown bug by temporarily disabling this part of the visualization. If we really need this debug info then we might consider addressing #18196, or being a bit more clever about how we compute this
total_currencyvalue.Explain how you tested your changes:
I synced a daemon to devnet with this change, and then stopped it with
^C. Instead of freezing after the message "Successfully wrote the visualization..." as in #17501, it instead shut down promptly and saved the registered masks to.mina-config/registered_masks.dotas expected. Granted, that's with all thetotal_currencyvalues being zero in the visualization, but I think that's better than not finishing the visualization at all.Closes: #17501