-
Notifications
You must be signed in to change notification settings - Fork 23
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
consensus-testlib: add chain generators #240
Conversation
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,131 @@ | |||
{-# LANGUAGE DataKinds #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module is a utility, much more general than ChainGenerators
, but relied upon heavily by it.
@@ -0,0 +1,341 @@ | |||
{-# LANGUAGE ExistentialQuantification #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module is a utility, much more general than ChainGenerators
, but relied upon heavily by it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sharing some comments. I have plenty to read yet.
I started looking at the honest tests and dived into some of the data type definitions.
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Slot.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Slot.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Slot.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Slot.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Slot.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/BitVector.hs
Outdated
Show resolved
Hide resolved
----- | ||
|
||
data HonestRecipe = HonestRecipe !Kcp !Scg !Delta !Len | ||
deriving (Eq, Read, Show) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this really a recipe? I'm finding it rather difficult to interpret. Maybe it is better described as parameters for leader schedule generation (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be called something like HonestSchemaSpec
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used Recipe
as a synonym of Spec
. I don't have a strong preference, though "spec(ification)" does have connotations around actual documents/broader writing/terms in a modelling language/etc, as opposed to mere data like this.
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Slot.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/BitVector.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Counting.hs
Outdated
Show resolved
Hide resolved
18f0114
to
8a93635
Compare
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Counting.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
...oros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/RaceIterator.hs
Outdated
Show resolved
Hide resolved
-- TODO optimization: how to skip all the honest Race Windows that | ||
-- don't reach beyond the intersection? Perhaps skip to i - s + d? | ||
go iterH iterA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressing the TODO would require counting blocks backwards from the intersection. Is that ideal?
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
...oros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/RaceIterator.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
...oros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/RaceIterator.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
676b859
to
3970c3d
Compare
ouroboros-consensus/test/infra-test/Test/Ouroboros/Consensus/ChainGenerator/Tests/Honest.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
...boros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Honest.hs
Outdated
Show resolved
Hide resolved
4f39a10
to
7b04abd
Compare
...sensus/src/unstable-consensus-testlib/Test/Ouroboros/Consensus/ChainGenerator/Adversarial.hs
Outdated
Show resolved
Hide resolved
71274b0
to
701badb
Compare
I pushed up several commits. Most are small. Most of them are rewordings of comments. But there is at least one big comment rewrite, on |
701badb
to
7f8d9ce
Compare
...boros-consensus/test/infra-test/Test/Ouroboros/Consensus/ChainGenerator/Tests/Adversarial.hs
Show resolved
Hide resolved
df454b3
to
9f17e66
Compare
For those involved in this PR's development, this commit is a manual full "squash" of 8f3b50b. Co-authored-by: Facundo Domínguez <facundominguez@gmail.com> Co-authored-by: amesgen <amesgen@amesgen.de>
9f17e66
to
ecfbdd6
Compare
@dnadales @jasagredo @fraser-iohk Our Tweag team working on the Genesis Statement of Work is making two claims about this PR.
Please inspect this PR enough to feel comfortable with those claims and Approve it if so. In particular, if you doubt the worthwhileness but not the harmlessness, please consider Approving anyway, and we can discuss whether or not to back it out after the fact. Thank you! |
I can confirm:
|
This PR introduces an initial implementation of a Peer Simulator for Genesis tests. A simulated peer is told how to behave by a list of scheduled events that is generated for every test. In essence, it is an implementation of a ChainSync server and a BlockFetch server that behave as prescribed by the schedule. The rest of the PR provides support infrastructure in the form of: * a Praos client node that plays the role of subject under test, * an example test for long range attacks, and * minimal definitions to generate a schedule from the chain schemas introduced in #240. This is a squash of the many commits in the integration branch of #367.
These generators are the first step towards a new set of tests, that will target the upcoming Ouroboros Genesis implementation.
One of the earlier milestones, however, will be some tests that apply even before Ouroboros Genesis.
The tip of the iceberg is the
Test.Ouroboros.Consensus.ChainGenerator.Tests
module. You can chase dependencies from there.This PR was migrated from IntersectMBO/ouroboros-network#4438