Skip to content

Commit

Permalink
Write TxSubmission V2 simulation test
Browse files Browse the repository at this point in the history
This new test generates an `TxsubmissionV2State` and passes it to the
new tx submission protocol. It tests multiple pairs of client server,
where the server instances share state.

The test then checks for the same semantics/behavior as the old V1 but
now for all results from all pairs client/server.

- Adds debugTracer
- Fixes arbitrary instance of `ArbTxDecisionPolicy`
  • Loading branch information
bolt12 committed Aug 12, 2024
1 parent 224bd29 commit 91d334f
Show file tree
Hide file tree
Showing 2 changed files with 233 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ verboseTracer :: forall a m.
=> Tracer m a
verboseTracer = threadAndTimeTracer $ showTracing $ Tracer say

debugTracer :: forall a s. Show a => Tracer (IOSim s) a
debugTracer = threadAndTimeTracer $ showTracing $ Tracer (traceM . show)

threadAndTimeTracer :: forall a m.
( MonadAsync m
, MonadDelay m
Expand Down Expand Up @@ -1118,8 +1121,8 @@ instance Arbitrary ArbTxDecisionPolicy where
arbitrary =
ArbTxDecisionPolicy . fixupTxDecisionPolicy
<$> ( TxDecisionPolicy
<$> (getSmall <$> arbitrary)
<*> (getSmall <$> arbitrary)
<$> (getSmall . getPositive <$> arbitrary)
<*> (getSmall . getPositive <$> arbitrary)
<*> (SizeInBytes . getPositive <$> arbitrary)
<*> (SizeInBytes . getPositive <$> arbitrary)
<*> (getPositive <$> arbitrary))
Expand All @@ -1130,17 +1133,17 @@ instance Arbitrary ArbTxDecisionPolicy where
maxTxsSizeInflight,
txInflightMultiplicity }) =
[ ArbTxDecisionPolicy a { maxNumTxIdsToRequest = NumTxIdsToReq x }
| x <- shrink (getNumTxIdsToReq maxNumTxIdsToRequest)
| (Positive x) <- shrink (Positive (getNumTxIdsToReq maxNumTxIdsToRequest))
]
++
[ ArbTxDecisionPolicy . fixupTxDecisionPolicy
$ a { txsSizeInflightPerPeer = SizeInBytes s }
| s <- shrink (getSizeInBytes txsSizeInflightPerPeer)
| Positive s <- shrink (Positive (getSizeInBytes txsSizeInflightPerPeer))
]
++
[ ArbTxDecisionPolicy . fixupTxDecisionPolicy
$ a { maxTxsSizeInflight = SizeInBytes s }
| s <- shrink (getSizeInBytes maxTxsSizeInflight)
| Positive s <- shrink (Positive (getSizeInBytes maxTxsSizeInflight))
]
++
[ ArbTxDecisionPolicy . fixupTxDecisionPolicy
Expand Down
Loading

0 comments on commit 91d334f

Please sign in to comment.