Skip to content

Commit 2c70d04

Browse files
authored
Merge pull request #4912 from IntersectMBO/bolt12/fix-generator
Improved memory foot print of tests on ghc 9.8
2 parents 839546e + 6a4b923 commit 2c70d04

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
# to discover space leaks Once #4698 and #4699 are done we can
150150
# further constrain the heap size.
151151
preCheck = lib.mkForce ''
152-
export GHCRTS=-M400M
152+
export GHCRTS=-M200M
153153
'';
154154

155155
# pkgs are instantiated for the host platform

ouroboros-network-framework/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
### Non-breaking changes
1010

1111
- Fix `InboundGovernorCounters`
12-
1312
* Make it build with ghc-9.10
13+
* Improve memory footprint of tests by using strict version of STM
1414

1515
## 0.13.2.0 -- 2024-06-07
1616

ouroboros-network-framework/src/Ouroboros/Network/Channel.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Numeric.Natural
3131

3232
import System.IO qualified as IO (Handle, hFlush, hIsEOF)
3333

34-
import Control.Concurrent.Class.MonadSTM
34+
import Control.Concurrent.Class.MonadSTM.Strict
3535

3636
import Network.Mux.Channel qualified as Mx
3737

@@ -137,8 +137,8 @@ fixedInputChannel xs0 = do
137137
-- writing.
138138
--
139139
mvarsAsChannel :: MonadSTM m
140-
=> TMVar m a
141-
-> TMVar m a
140+
=> StrictTMVar m a
141+
-> StrictTMVar m a
142142
-> Channel m a
143143
mvarsAsChannel bufferRead bufferWrite =
144144
Channel{send, recv}

ouroboros-network-protocols/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Bump io-sim and io-classes
1616
* Added a test for `AnchoredFragment.splitAtSlot`.
1717
* Make it build with ghc-9.10
18+
* Improved memory foot print of tests
1819

1920
## 0.8.1.0 -- 2024-03-14
2021

ouroboros-network-protocols/testlib/Test/ChainGenerators.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import Ouroboros.Network.Point (WithOrigin (..), block, blockPointHash,
5050
blockPointSlot, fromWithOrigin, origin)
5151
import Ouroboros.Network.Protocol.BlockFetch.Type (ChainRange (..))
5252

53+
import Data.List (scanl')
5354
import Test.Cardano.Slotting.Arbitrary ()
5455
import Test.QuickCheck
5556
import Test.QuickCheck.Instances.ByteString ()
@@ -204,8 +205,7 @@ instance CoArbitrary ConcreteHeaderHash
204205
-- https://github.com/nick8325/quickcheck/issues/229
205206
--
206207
genNonNegative :: Gen Int
207-
genNonNegative = (abs <$> arbitrary) `suchThat` (>= 0)
208-
208+
genNonNegative = (abs . getSmall <$> arbitrary) `suchThat` (>= 0)
209209

210210
--
211211
-- Generators for chains
@@ -230,7 +230,7 @@ instance Arbitrary TestBlockChain where
230230
return (TestBlockChain chain)
231231
where
232232
mkSlots :: [Int] -> [SlotNo]
233-
mkSlots = map toEnum . tail . scanl (+) 0
233+
mkSlots = map toEnum . tail . scanl' (+) 0
234234

235235
shrink (TestBlockChain c) =
236236
[ TestBlockChain (fixupChain fixupBlock c')

0 commit comments

Comments
 (0)