Skip to content

Commit 340f938

Browse files
committed
Peras: minor tweaks
1 parent 1ca076a commit 340f938

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/SupportsPeras.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ import NoThunks.Class
2323
import Ouroboros.Consensus.Block.Abstract
2424

2525
newtype PerasRoundNo = PerasRoundNo {unPerasRoundNo :: Word64}
26-
deriving stock Show
27-
deriving Generic
26+
deriving stock (Show, Generic)
2827
deriving newtype (Eq, Ord, NoThunks)
2928

3029
newtype PerasWeight = PerasWeight {unPerasWeight :: Word64}
31-
deriving stock Show
30+
deriving stock (Show, Generic)
3231
deriving newtype (Eq, Ord, NoThunks)
3332
deriving (Semigroup, Monoid) via Sum Word64
3433

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Peras/Weight.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{-# LANGUAGE DerivingVia #-}
44
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
55
{-# LANGUAGE ScopedTypeVariables #-}
6+
{-# LANGUAGE TypeOperators #-}
67

78
module Ouroboros.Consensus.Peras.Weight
89
( PerasWeightSnapshot (..)
@@ -33,13 +34,13 @@ boostedWeightForPoint (PerasWeightSnapshot weightByPoint) pt =
3334
Map.findWithDefault mempty pt weightByPoint
3435

3536
boostedWeightForFragment ::
36-
forall blk.
37-
HasHeader blk =>
37+
forall blk h.
38+
(HasHeader blk, HasHeader h, HeaderHash blk ~ HeaderHash h) =>
3839
PerasWeightSnapshot blk ->
39-
AnchoredFragment blk ->
40+
AnchoredFragment h ->
4041
PerasWeight
4142
boostedWeightForFragment weightSnap frag =
4243
-- TODO think about whether this could be done in sublinear complexity
4344
foldMap
4445
(boostedWeightForPoint weightSnap)
45-
(blockPoint <$> AF.toOldestFirst frag)
46+
(castPoint . blockPoint <$> AF.toOldestFirst frag)

0 commit comments

Comments
 (0)