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

Cleanup various things #411

Merged
merged 7 commits into from
Oct 11, 2023
Merged

Cleanup various things #411

merged 7 commits into from
Oct 11, 2023

Conversation

Niols
Copy link
Contributor

@Niols Niols commented Oct 10, 2023

This PR only makes sense for the Genesis project.

This PR includes various cleanup operations. The commits are somewhat independent and they should speak for themselves. This PR should probably be rebased.

- New module `Test.Ouroboros.Consensus.Genesis.Setup`
- Move `genChains` from its own module to `Genesis.Setup`
- Move `TestSetup`-related code from `LongRangeAttack` to `Genesis.Setup`
Two bits of it still mattered:

- `defaultCfg` moves to its own file `PeerSimulator.Config`
- `ConnectionThread` moves to `PeerSimulator.Run`
- `PointSchedule` now contains a `NonEmpty Tick` which guarantees at
  least one tick and therefore access to the list of peers.

- Get rid of fragments in both `AdvertisedPoints` and `PointSchedule`.

- Cleanup imports of the `PointSchedule` module
@Niols Niols added the Genesis PRs related to Genesis testing and implementation label Oct 10, 2023
@@ -33,6 +44,7 @@ import Test.Util.TestBlock (TestBlock, TestBlockWith (tbSlot),
-- good: O─────1──2──3──4─────5──6──7
-- bad: ╰─────3──4─────5
--
-- REVIEW: Generate more alternative chains?
Copy link
Contributor

Choose a reason for hiding this comment

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

We already implemented this in another changeset, to be reviewed in a call tomorrow

data PointSchedule =
PointSchedule { ticks :: [Tick], frags :: Peers TestFrag }
newtype PointSchedule =
PointSchedule {ticks :: NonEmpty Tick}
Copy link
Contributor

Choose a reason for hiding this comment

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

Initially, we also required each individual peer to have nonempty schedules, but we weren't sure that it was required (also it was painful to work with).
Is there a reason we should choose either of those? An empty fork doesn't make any sense, but the chain generator probably prevents that anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we should choose either of those?

I don't understand the question yet. What would be the options under consideration? And what would be your preference?

Copy link
Contributor

Choose a reason for hiding this comment

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

The change would be to disallow peer fragments that only consist of the genesis point. Right now that's accepted. The benefit might be that the point schedule generator would get nonempty chains as input, which could make some of the types easier, but maybe some of them more convoluted. I'm unsure what would be better.

@tek tek requested a review from amesgen October 10, 2023 13:16
Copy link
Contributor

@facundominguez facundominguez left a comment

Choose a reason for hiding this comment

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

Thanks @Niols. The small decoupled commits made this PR rather easy to review.

tests = testGroup "Genesis tests"
[ testProperty "blargh" prop_syncGenesis
]
tests = testProperty "long range attack" prop_syncGenesis
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

@tek tek marked this pull request as ready for review October 11, 2023 11:46
@tek tek requested a review from a team as a code owner October 11, 2023 11:46
@tek tek merged commit 73c6fa3 into fd/genesis-tests Oct 11, 2023
10 checks passed
@tek tek deleted the niols/cleanup branch October 11, 2023 11:47
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