-
Notifications
You must be signed in to change notification settings - Fork 214
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
Fix shrinker for ProtocolParameters
.
#3205
Fix shrinker for ProtocolParameters
.
#3205
Conversation
4d2f641
to
020ab5d
Compare
Currently, the shrinker always returns the empty list: ```hs > :set -XTypeApplications > import Cardano.Wallet.Primitive.Types (ProtocolParameters) > import Cardano.Wallet.DB.Arbitrary > import Test.QuickCheck > generate (arbitrary @ProtocolParameters) ProtocolParameters {decentralizationLevel = ...} > a = it > shrink a [] ``` By using `genericRoundRobinShrink`, we can get actual shrinking: ```hs > generate (arbitrary @ProtocolParameters) ProtocolParameters {decentralizationLevel = ...} > a = it > length $ shrink a 68 ```
b863a2f
to
172457a
Compare
Ah interesting, the default When an empty list is used applicatively like this, it acts as an annihilator:
Some elements of the We should probably audit our shrinkers for this. This is a case where Hedgehog provides much more sensible defaults, in that it provides default shrinkers that actually shrink. |
Yeah this applicative annihilation is a real gotcha! |
bors r+ |
3205: Fix shrinker for `ProtocolParameters`. r=jonathanknowles a=jonathanknowles Currently, the shrinker for `ProtocolParameters` always returns the empty list: ```hs > :set -XTypeApplications > import Cardano.Wallet.Primitive.Types (ProtocolParameters) > import Cardano.Wallet.DB.Arbitrary > import Test.QuickCheck > generate (arbitrary `@ProtocolParameters)` ProtocolParameters {decentralizationLevel = ...} > a = it > shrink a [] ``` By using `genericRoundRobinShrink` from `Test.QuickCheck.Extra`, we can get actual shrinking: ```hs > generate (arbitrary `@ProtocolParameters)` ProtocolParameters {decentralizationLevel = ...} > a = it > length $ shrink a 68 ``` Co-authored-by: Jonathan Knowles <[email protected]>
Build failed: Final output of log: Sign transaction
signTransaction adds reward account witness when necessary (AnyCardanoEra ByronEra)
+++ OK, passed 100 tests (100% feature not supported in ByronEra.).
signTransaction adds reward account witness when necessary (AnyCardanoEra ShelleyEra) (30749ms)
+++ OK, passed 100 tests.
signTransaction adds reward account witness when necessary (AnyCardanoEra AllegraEra) (31215ms)
+++ OK, passed 100 tests.
signTransaction adds reward account witness when necessary (AnyCardanoEra MaryEra) (30973ms)
+++ OK, passed 100 tests.
signTransaction adds reward account witness when necessary (AnyCardanoEra AlonzoEra) (30539ms)
+++ OK, passed 100 tests.
signTransaction adds extra key witness when necessary (AnyCardanoEra ByronEra) (1ms)
+++ OK, passed 100 tests (100% feature not supported in ByronEra.).
signTransaction adds extra key witness when necessary (AnyCardanoEra ShelleyEra)
+++ OK, passed 100 tests (100% feature not supported in ShelleyEra.).
signTransaction adds extra key witness when necessary (AnyCardanoEra AllegraEra)
+++ OK, passed 100 tests (100% feature not supported in AllegraEra.).
signTransaction adds extra key witness when necessary (AnyCardanoEra MaryEra)
+++ OK, passed 100 tests (100% feature not supported in MaryEra.).
signTransaction adds extra key witness when necessary (AnyCardanoEra AlonzoEra) (72958ms)
+++ OK, passed 100 tests.
signTransaction adds tx in witnesses when necessary (AnyCardanoEra ByronEra) (1ms)
+++ OK, passed 100 tests. Looks like another instance of: |
Going to merge manually, since:
|
…rotocol-parameters-shrinker
Currently, the shrinker for
ProtocolParameters
always returns the empty list:By using
genericRoundRobinShrink
fromTest.QuickCheck.Extra
, we can get actual shrinking: