Skip to content

Commit a8805c4

Browse files
Soupstrawlehins
authored andcommitted
Change PerasCert to contain ByteArray
1 parent 74228a6 commit a8805c4

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

eras/dijkstra/impl/src/Cardano/Ledger/Dijkstra/BlockBody/Internal.hs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ import Cardano.Ledger.MemoBytes (
6767
mkMemoized,
6868
mkMemoizedEra,
6969
)
70+
import Cardano.Ledger.Orphans ()
7071
import Control.DeepSeq (NFData)
7172
import Control.Monad (forM_, unless)
73+
import Data.Array.Byte (ByteArray)
7274
import qualified Data.ByteString as BS
7375
import Data.Coerce (Coercible, coerce)
7476
import Data.Foldable (Foldable (..))
@@ -237,18 +239,13 @@ alignedValidFlags n invalidSet =
237239
-- | Placeholder for Peras certificates
238240
--
239241
-- NOTE: The real type will be brought from 'cardano-base' once it's ready.
240-
data PerasCert = PerasCert
241-
deriving (Eq, Show, Generic, NoThunks)
242-
243-
instance NFData PerasCert
242+
newtype PerasCert = PerasCert ByteArray
243+
deriving (Eq, Show, Generic)
244+
deriving newtype (EncCBOR, DecCBOR)
244245

245-
instance EncCBOR PerasCert where
246-
encCBOR PerasCert = encCBOR BS.empty
246+
instance NoThunks PerasCert
247247

248-
instance DecCBOR PerasCert where
249-
decCBOR = do
250-
(_ :: BS.ByteString) <- decCBOR
251-
pure PerasCert
248+
instance NFData PerasCert
252249

253250
-- | Placeholder for Peras public keys
254251
--

eras/dijkstra/impl/testlib/Test/Cardano/Ledger/Dijkstra/Arbitrary.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ instance
291291
arbitrary = genericArbitraryU
292292

293293
instance Arbitrary PerasCert where
294-
arbitrary = pure PerasCert
294+
arbitrary = PerasCert <$> arbitrary
295295

296296
instance
297297
( EraBlockBody era

0 commit comments

Comments
 (0)