Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Knowles <mail@jonathanknowles.net>
  • Loading branch information
Anviking and jonathanknowles committed Sep 14, 2023
1 parent 5fa9085 commit 270b6ad
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,17 @@ instance Arbitrary PParamsInRecentEra where
-> Gen (PParams (ShelleyLedgerEra era))
genPParams era = withConstraints era $ do
ver <- arbitrary
maxSize <- genMaxSize
maxSize <- genMaxSizeBytes
return $ def
& ppProtocolVersionL .~ (ProtVer ver 0)
-- minor version doesn't matter
& ppMaxValSizeL .~ maxSize
where
genMaxSize :: Gen Natural
genMaxSize =
genMaxSizeBytes :: Gen Natural
genMaxSizeBytes =
oneof
-- Generate values close to the mainnet value of 4000 (and guard
-- against underflow)
-- Generate values close to the mainnet value of 4000 bytes
-- (and guard against underflow)
[ fromIntegral . max 0 . (4000 +) <$> arbitrary @Int

-- Generate more extreme values (both small and large)
Expand All @@ -288,9 +288,9 @@ babbageTokenBundleSizeAssessor :: TokenBundleSizeAssessor
babbageTokenBundleSizeAssessor = mkTokenBundleSizeAssessor RecentEraBabbage
$ def
& ppProtocolVersionL .~ (ProtVer (eraProtVerLow @StandardBabbage) 0)
& ppMaxValSizeL .~ maryTokenBundleMaxSize
& ppMaxValSizeL .~ maryTokenBundleMaxSizeBytes
where
maryTokenBundleMaxSize = 4000
maryTokenBundleMaxSizeBytes = 4000

mkAssessorFromPParamsInRecentEra
:: PParamsInRecentEra
Expand Down

0 comments on commit 270b6ad

Please sign in to comment.