-
Notifications
You must be signed in to change notification settings - Fork 26
consensus-testlib: add Test.CsjModel #1466
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
base: main
Are you sure you want to change the base?
Conversation
import qualified Data.Sequence as Seq | ||
|
||
-- | A non-empty 'Seq' | ||
newtype NonEmptySeq a = UnsafeNonEmptySeq (Seq a) |
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 type doesn't use AnchoredFragment
for two reasons.
-
As a model, I'm trying to keep it as simple as possible: so far, I don't need headers at all. And I can't put points in an
AnchoredFragment
because of theHasHeader
constraint. -
So far, the model deals with chains that reach all the way back to
Origin
, not fragments. As long as that's true, it seems misleading to useAnchoredFragment
.
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.
The code no longer reaches all the way back to Genesis. It still doesn't involve headers explicitly, but perhaps AnchoredSeq
could still be reused?
d0c427c
to
d408094
Compare
e1444da
to
ebd743b
Compare
edc4bc0
to
27c8abe
Compare
This commit adds the CSJ model but does not yet use it to test the implementation.
This small alteration accomodate the fact that the ChainSync client cannot necessarily a MsgFindIntersect _immediately_ when the CSJ governor emits it.
Payloads and connecting peers forced me ot figure out how to not always persist chains all the way back to Origin. Which forced me to realize and handle some weird corner cases. I'm optimistic, but I do expect friction once this is finally connected to the actual tests.
A single commit, and essentially a single file.
While this is being reviewed, I'll see if it's easy to integrate into the existing tests.
This PR model is the result of troubleshooting some test failures. I found a minor non-optimality in CSJ (recall that CSJ is fundamentally an optimization), and with the non-centralized definition of the existing CSJ implementation it was challenging for me to establish confidence that there weren't similar issues. I developed this centralized model for more legibility/clarity, and I intend for it to be used at least to test the non-centralized CSJ implementation.