Skip to content

Commit

Permalink
Merge #1196
Browse files Browse the repository at this point in the history
1196: Cleanup Byron integration r=edsko a=edsko



Co-authored-by: Edsko de Vries <[email protected]>
  • Loading branch information
iohk-bors[bot] and edsko authored Nov 8, 2019
2 parents 8308b72 + b006751 commit ba34ca3
Show file tree
Hide file tree
Showing 34 changed files with 2,100 additions and 1,339 deletions.
7 changes: 7 additions & 0 deletions ouroboros-consensus/ouroboros-consensus.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@ library
Ouroboros.Consensus.Crypto.DSIGN.Cardano
Ouroboros.Consensus.Ledger.Abstract
Ouroboros.Consensus.Ledger.Byron
Ouroboros.Consensus.Ledger.Byron.Aux
Ouroboros.Consensus.Ledger.Byron.Block
Ouroboros.Consensus.Ledger.Byron.Config
Ouroboros.Consensus.Ledger.Byron.ContainsGenesis
Ouroboros.Consensus.Ledger.Byron.Conversions
Ouroboros.Consensus.Ledger.Byron.DelegationHistory
Ouroboros.Consensus.Ledger.Byron.Forge
Ouroboros.Consensus.Ledger.Byron.Ledger
Ouroboros.Consensus.Ledger.Byron.Mempool
Ouroboros.Consensus.Ledger.Byron.Orphans
Ouroboros.Consensus.Ledger.Byron.PBFT
Ouroboros.Consensus.Ledger.Extended
Ouroboros.Consensus.Ledger.Mock
Ouroboros.Consensus.Ledger.Mock.Address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Extended
import Ouroboros.Consensus.Protocol.Abstract
import Ouroboros.Consensus.Util
import Ouroboros.Consensus.Util.Condense
import Ouroboros.Consensus.Util.IOLike
import Ouroboros.Consensus.Util.MonadSTM.NormalForm (checkInvariant,
unsafeNoThunks)
Expand Down Expand Up @@ -665,8 +666,13 @@ chainSyncClient mkPipelineDecision0 getTipBlockNo tracer cfg btime
}
Left TooFarAhead -> retry
Right view -> case view `SB.at` hdrSlot of
Nothing -> error "anachronisticProtocolLedgerView invariant violated"
Just lv -> return lv
Nothing -> error $ mconcat [
"anachronisticProtocolLedgerView invariant violated: "
, condense hdrSlot
, " not within bounds "
, condense (SB.bounds view)
]
where
hdrSlot = case pointSlot hdrPoint of
Origin -> SlotNo 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableSuperClasses #-}
Expand All @@ -21,7 +22,7 @@ import Ouroboros.Network.Point (WithOrigin)

import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Protocol.Abstract
import Ouroboros.Consensus.Util.SlotBounded (SlotBounded)
import Ouroboros.Consensus.Util.SlotBounded (Bounds (..), SlotBounded)

{-------------------------------------------------------------------------------
Interaction with the ledger layer
Expand Down Expand Up @@ -127,7 +128,7 @@ class UpdateLedger blk => ProtocolLedgerView blk where
:: NodeConfig (BlockProtocol blk)
-> LedgerState blk
-> WithOrigin SlotNo -- ^ Slot for which you would like a ledger view
-> Either AnachronyFailure (SlotBounded (LedgerView (BlockProtocol blk)))
-> Either AnachronyFailure (SlotBounded IX (LedgerView (BlockProtocol blk)))

-- | See 'anachronisticProtocolLedgerView'.
data AnachronyFailure
Expand Down
Loading

0 comments on commit ba34ca3

Please sign in to comment.