Skip to content

Commit 0107b1e

Browse files
authored
Reintroduce encodedSizeExpr in Header instance (#1692)
# Description In my previous [PR](#1687) , I [removed](https://github.com/IntersectMBO/ouroboros-consensus/pull/1687/files#diff-cc67072c8a9a8cae57404fc5f4ff58c83ef8c6238043df252402a83218ff1219L246) the implementation of `encodedSizeExpr` from the `Header` instance. On @lehins advice, I'm reintroducing it - even though it's not clear if it's actually used - it's better to remove it systematically if it turns out that's the case, rather than change it accidentally.
2 parents 61dee38 + 5f2ed85 commit 0107b1e

File tree

1 file changed

+6
-1
lines changed
  • ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos

1 file changed

+6
-1
lines changed

ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Header.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import Cardano.Ledger.Binary
4242
, DecCBOR (decCBOR)
4343
, EncCBOR (..)
4444
, ToCBOR (..)
45+
, encodedSigKESSizeExpr
4546
, serialize'
4647
, unCBORGroup
4748
)
@@ -224,7 +225,11 @@ instance Crypto crypto => DecCBOR (HeaderRaw crypto) where
224225
instance Crypto crypto => DecCBOR (Annotator (HeaderRaw crypto)) where
225226
decCBOR = pure <$> decCBOR
226227

227-
instance Crypto c => EncCBOR (Header c)
228+
instance Crypto c => EncCBOR (Header c) where
229+
encodedSizeExpr size proxy =
230+
1
231+
+ encodedSizeExpr size (headerBody <$> proxy)
232+
+ encodedSigKESSizeExpr (KES.getSig . headerSig <$> proxy)
228233

229234
deriving via
230235
Mem (HeaderRaw crypto)

0 commit comments

Comments
 (0)