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

GSM: split OnlyBootstrap into PreSyncing and Syncing #975

Merged
merged 3 commits into from
Mar 25, 2024

Conversation

amesgen
Copy link
Member

@amesgen amesgen commented Feb 29, 2024

This PR splits the previous OnlyBootstrap state of the GSM into separate PreSyncing and Syncing states, making it ready to be used for Genesis, while allowing to still use the GSM in conjunction with bootstrap peers.

Compared to the Bootstrap Peers IER, there is one more state and two more transition rules, both based on the Honest Availability Assumption (HHA), which the Network layer will try to establish and inform us about, likely by ensuring a minimum amount of (big) ledger peers, see isHaaSatisfied in GsmView.

The new state transition diagram looks like this:

graph
    PreSyncing[PreSyncing]
    Syncing[Syncing]
    CaughtUp[CaughtUp]

    PreSyncing -- "Honest Availability Assumption\nis satisfied" --> Syncing
    Syncing -- "Honest Availability Assumption\nis no longer satisfied" --> PreSyncing
    Syncing -- "no peers claim to have\nsubsequent headers,\nand its selection is ≥\nthe best header" --> CaughtUp
    CaughtUp -- "vol tip became older than X" --> PreSyncing

    StartUp[[Node start-up]]
    StartUp -- "node was most recently in CaughtUp\nand vol tip is younger than X" --> CaughtUp
    StartUp -- "otherwise" --> PreSyncing
Loading

@amesgen amesgen added the Genesis PRs related to Genesis testing and implementation label Feb 29, 2024
@amesgen amesgen requested a review from nfrisby February 29, 2024 09:59
@amesgen amesgen force-pushed the amesgen/gsm-presyncing branch from 4e9512c to d0fc114 Compare February 29, 2024 10:40
@amesgen amesgen marked this pull request as ready for review March 1, 2024 10:52
@amesgen amesgen requested a review from a team as a code owner March 1, 2024 10:52
Copy link
Contributor

@nfrisby nfrisby left a comment

Choose a reason for hiding this comment

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

LGTM (Great!). A few minor requests.

@amesgen amesgen force-pushed the amesgen/gsm-presyncing branch from d0fc114 to f411dff Compare March 1, 2024 14:01
Niols added a commit that referenced this pull request Mar 13, 2024
GSM and LoP are delivered in two different PRs (#975 and #979
respectively), but we need both to plug them together correctly, hence
this merge. It should disappear once the PRs get merged and/or rebased
on top of one another.
@@ -78,11 +81,23 @@ data CandidateVersusSelection =
-- ^ Whether the candidate is better than the selection
deriving (Eq, Show)

data GsmState =
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth clarifying what GSM is in the comments?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment expanding the acronym (it is also in the module header, but that is a bit distanced)

-> QSM.Commands Command Response
-> QC.Property
prop_sequential1 j0 cmds = runSimQC $ do
prop_sequential1 ctx cmds = runSimQC $ do
let s0 = case j0 of
Copy link
Member

Choose a reason for hiding this comment

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

Maybe s0 and j0 could have more descriptive names.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed 👍 83cd2fe

amesgen added 3 commits March 25, 2024 11:38
We still use `LedgerStateJudgement` for initialization, with TooOld
corresponding to PreSyncing and YoungEnough corresponding to CaughtUp.
Compared to the previous static predicate, this has the following advantages:

 - Confirms necessity of `avoidTransientState` (or a similar mechanism) in the
   ModelPreSyncing logic

 - Makes necessity of using `isHaaSatisfied` check in `initModel` explicit.

 - The tests with less than 3 peers perform many more useful state transitions.
@amesgen amesgen force-pushed the amesgen/gsm-presyncing branch from f411dff to 83cd2fe Compare March 25, 2024 10:41
@amesgen amesgen enabled auto-merge March 25, 2024 10:42
@amesgen amesgen added this pull request to the merge queue Mar 25, 2024
Merged via the queue into main with commit 0650fe2 Mar 25, 2024
15 checks passed
@amesgen amesgen deleted the amesgen/gsm-presyncing branch March 25, 2024 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Genesis PRs related to Genesis testing and implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants