Skip to content

Conversation

@furszy
Copy link

@furszy furszy commented Dec 17, 2021

Work decoupled from #2647 which has grew a lot lately. So it can get reviewed and merged in parallel of #2607.

Essentially have encapsulated the tier two synchronization status in a separate object which is only in charge of storing and retrieving the sync status members values in a synchronic manner.

Under this new architecture, every manager/object that needs access to it can add a small dependency to the new g_tiertwo_sync_state object only (which has no other dependencies), without depending on the whole masternodesSync object (which is a bad name for the tier two sync manager, but.. renaming will come in another PR), which depends on every other tier two manager and lot other files.
Plus, to not generate confusions, the g_tiertwo_sync_state members update are only, and exclusively, done by the tier two sync manager.

Fixing in this way, at least (because there are surely more), the following problems:

  1. Circular dependencies:

    • "activemasternode -> masternode-sync -> activemasternode".
    • "budget/budgetmanager -> masternode-sync -> budget/budgetmanager"
    • "masternode -> masternode-sync -> masternode"
    • "masternode-payments -> masternode-sync -> masternode-payments"
    • "masternode-sync -> validation -> masternode-sync"
    • "evo/deterministicmns -> masternode -> masternode-sync -> evo/deterministicmns"
  2. Allow and guard concurrent access. (Prior to this work, the word "concurrency" was inexistent for this code).

@furszy furszy self-assigned this Dec 17, 2021
@furszy furszy changed the title [Refactoring] Decouple and encapsulate tier two synchronization state [WIP][Refactoring] Decouple and encapsulate tier two synchronization state Dec 17, 2021
@furszy furszy changed the title [WIP][Refactoring] Decouple and encapsulate tier two synchronization state [Refactoring] Decouple and encapsulate tier two synchronization state Dec 19, 2021
@furszy furszy added this to the 6.0.0 milestone Dec 19, 2021
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Very nice refactoring. Code ACK with some notes.

@furszy furszy force-pushed the 2021_tiertwo_decouple_sync_state branch 2 times, most recently from 3c69135 to a4526d1 Compare December 20, 2021 19:39
@furszy
Copy link
Author

furszy commented Dec 20, 2021

Updated per feedback 👍 .

@furszy furszy force-pushed the 2021_tiertwo_decouple_sync_state branch 2 times, most recently from a9a18ac to 762fbd7 Compare December 21, 2021 01:18
@furszy furszy force-pushed the 2021_tiertwo_decouple_sync_state branch from 8d75f27 to 4b3bcfb Compare December 22, 2021 15:44
@furszy
Copy link
Author

furszy commented Dec 22, 2021

Updated per feedback, squashed it in your 4b3bcfb zebra.

@furszy furszy requested a review from random-zebra December 26, 2021 21:45
random-zebra
random-zebra previously approved these changes Dec 27, 2021
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 4b3bcfb95145eb4ee7905899daafa62cb253c7b7

@furszy
Copy link
Author

furszy commented Dec 27, 2021

Just noticed that need to rebase this one once more, the new test dkg_pose introduced in #2607 is setting the tier two sync asset manually.
So.. if we merge it as is, the final branch will not compile.

@furszy
Copy link
Author

furszy commented Dec 27, 2021

rebased, ready to go once more.

@furszy furszy requested a review from random-zebra December 27, 2021 18:59
random-zebra
random-zebra previously approved these changes Dec 28, 2021
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 24d9fa5a554068a6261328b1b5e60562e9a2fa41

@furszy
Copy link
Author

furszy commented Dec 29, 2021

due conflicts with recently merged PRs, rebased on master once more.

@furszy furszy force-pushed the 2021_tiertwo_decouple_sync_state branch from 7ac83b7 to 75bc24f Compare December 30, 2021 15:23
random-zebra
random-zebra previously approved these changes Jan 3, 2022
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 75bc24f708b2f6c4d8de1ca53a462ca882b15df1

furszy and others added 10 commits January 4, 2022 09:03
…:Process function.

So the reset call only happens in the mnsync thread and not on every thread/object that calls to a getter function..
…_sync_state class which only stores the final value.

And rename it to UpdateBlockchainSync.
And remove extra call to SetBlockchainSync(false) from CMasternodeSync after calling CMasternodeSync::Reset()
@furszy furszy force-pushed the 2021_tiertwo_decouple_sync_state branch from 75bc24f to 3e05c82 Compare January 4, 2022 12:06
@furszy
Copy link
Author

furszy commented Jan 4, 2022

rebased for merge conflicts with 2697, had to dismiss the approval again.

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 3e05c82 again. Let's get this merged.

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 3e05c82

@furszy furszy merged commit 017953e into PIVX-Project:master Jan 5, 2022
@Fuzzbawls Fuzzbawls modified the milestones: 6.0.0, 5.5.0 Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants