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

fix wp error on failed sync #18883

Closed
wants to merge 1 commit into from
Closed

Conversation

almogdepaz
Copy link
Contributor

Purpose:

code clean up, don't attempt weight proof creation at the end of failed syncs

Current Behavior:

even if we throw during sync we will try and create a weight proof for the peak

New Behavior:

only create the weight proof if the sync ends successfully

Testing Notes:

@almogdepaz almogdepaz added full_node sync Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog labels Nov 18, 2024
@almogdepaz almogdepaz marked this pull request as ready for review November 18, 2024 17:02
@almogdepaz almogdepaz requested a review from a team as a code owner November 18, 2024 17:02
@@ -1686,10 +1690,6 @@ async def _finish_sync(self) -> None:
)
await self.peak_post_processing_2(peak_fb, None, state_change_summary, ppp_result)

if peak is not None and self.weight_proof_handler is not None:
await self.weight_proof_handler.get_proof_of_weight(peak.header_hash)
self._state_changed("block")
Copy link
Contributor

Choose a reason for hiding this comment

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

is it safe to remove this _state_changed() call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from what i can tell (and its not very easy because of how the state change code is written) this is for metrics that we are collecting

if change in {"block", "signage_point"}:

and actually i dont understand why we are collecting this, we have metrics collection for new_peak and a change in sync_mode and both happen when we finish sync

Copy link
Contributor

Choose a reason for hiding this comment

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

my understanding is that _state_changed is used to notify the GUI of things it need to refresh

peak = self.blockchain.get_peak()
assert peak is not None
if self.weight_proof_handler is not None:
await self.weight_proof_handler.get_proof_of_weight(peak.header_hash)
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks a bit odd to call a function called get_... and then throw away the return value. I imagine it, perhaps, updates some cache. I think it would mak sense to explain that in a comment (or whatever the reason is).
I also think it would be good to comment on why we need this call here, and not in _finish_sync(). To avoid someone moving it back in the future. Especially since we don't have a test that would fail if someone did.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i dont undestand the finish_sync() on failure at all actually i think we can do that better, anyway now that i have a better understanding of the DB corruption issue i dont think we need this change

@almogdepaz
Copy link
Contributor Author

closed since the underlining issue was due to a problem with the data in the db not us creating the WP on the current peak after a faild sync

@almogdepaz almogdepaz closed this Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog full_node sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants