Skip to content

Commit

Permalink
Remove cruft
Browse files Browse the repository at this point in the history
Function 'pointToSlotHash' no longer needed.
  • Loading branch information
erikd committed Aug 10, 2020
1 parent 07c9336 commit 6e195ac
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
16 changes: 0 additions & 16 deletions cardano-db-sync/src/Cardano/DbSync/Era/Byron/Util.hs
Expand Up @@ -15,7 +15,6 @@ module Cardano.DbSync.Era.Byron.Util
, epochNumber
, genesisToHeaderHash
, mkSlotLeader
, pointToSlotHash
, renderAbstractHash
, slotLeaderHash
, slotNumber
Expand All @@ -42,8 +41,6 @@ import qualified Cardano.Chain.Slotting as ByronInsanity
import qualified Cardano.Chain.Update as Byron
import qualified Cardano.Chain.UTxO as Byron

import Cardano.Slotting.Slot (SlotNo (..))

import Crypto.Hash (Blake2b_256)

import qualified Data.ByteString.Base16 as Base16
Expand All @@ -54,11 +51,6 @@ import qualified Data.Text.Encoding as Text

import qualified Cardano.Db as DB

import Ouroboros.Consensus.Byron.Ledger (ByronBlock, ByronHash (..))
import Ouroboros.Network.Point (WithOrigin (..))
import qualified Ouroboros.Network.Point as Point
import Ouroboros.Network.Block (Point (..))


blockHash :: Byron.ABlock ByteString -> ByteString
blockHash = unHeaderHash . Byron.blockHashAnnotated
Expand Down Expand Up @@ -100,14 +92,6 @@ mkSlotLeader blk =
-- On Byrom poolHashId will always be Nothing.
in DB.SlotLeader slHash Nothing slName


-- | Convert from Ouroboros 'Point' to `Byron' types.
pointToSlotHash :: Point ByronBlock -> Maybe (SlotNo, Byron.HeaderHash)
pointToSlotHash (Point x) =
case x of
Origin -> Nothing
At blk -> Just (Point.blockPointSlot blk, unByronHash $ Point.blockPointHash blk)

renderAbstractHash :: Crypto.AbstractHash algo a -> Text
renderAbstractHash =
Text.decodeUtf8 . Base16.encode . Crypto.abstractHashToBytes
Expand Down
15 changes: 1 addition & 14 deletions cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Util.hs
Expand Up @@ -19,7 +19,6 @@ module Cardano.DbSync.Era.Shelley.Util
, maybePaymentCred
, mkSlotLeader
, nonceToBytes
, pointToSlotHash
, renderAddress
, renderHash
, slotLeaderHash
Expand Down Expand Up @@ -65,9 +64,7 @@ import qualified Data.Text.Encoding as Text

import qualified Ouroboros.Consensus.Shelley.Ledger.Block as Shelley
import Ouroboros.Consensus.Shelley.Protocol (TPraosStandardCrypto)
import Ouroboros.Network.Block (BlockNo (..), Point (..))
import Ouroboros.Network.Point (WithOrigin (..))
import qualified Ouroboros.Network.Point as Point
import Ouroboros.Network.Block (BlockNo (..))

import qualified Shelley.Spec.Ledger.Address as Shelley
import Shelley.Spec.Ledger.Coin (Coin (..))
Expand Down Expand Up @@ -114,9 +111,6 @@ blockTxs =
txList :: ShelleyTxSeq -> [ShelleyTx]
txList (Shelley.TxSeq txSeq) = toList txSeq

-- blockLeaderVrf :: Shelley.BHBody TPraosStandardCrypto -> ByteString
-- blockLeaderVrf = _ . Shelley.bheaderL

blockOpCert :: Shelley.BHBody TPraosStandardCrypto -> ByteString
blockOpCert = KES.rawSerialiseVerKeyKES . Shelley.ocertVkHot . Shelley.bheaderOCert

Expand Down Expand Up @@ -158,13 +152,6 @@ nonceToBytes nonce =
Shelley.Nonce hash -> Crypto.hashToBytes hash
Shelley.NeutralNonce -> BS.replicate 28 '\0'

-- | Convert from Ouroboros 'Point' to `Shelley' types.
pointToSlotHash :: Point (Shelley.ShelleyBlock TPraosStandardCrypto) -> Maybe (SlotNo, ShelleyHash)
pointToSlotHash (Point x) =
case x of
Origin -> Nothing
At blk -> Just (Point.blockPointSlot blk, Point.blockPointHash blk)

renderAddress :: Shelley.Addr TPraosStandardCrypto -> Text
renderAddress addr =
case addr of
Expand Down

0 comments on commit 6e195ac

Please sign in to comment.