Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Byron integration #1196

Merged
merged 2 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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