Skip to content

Commit bb9183f

Browse files
committed
Fix snapshots
This still suffers from IntersectMBO/ouroboros-consensus#1577 so Byron snapshots don't deserialise, until we update CHaP further
1 parent 8b47beb commit bb9183f

File tree

1 file changed

+6
-4
lines changed
  • cardano-db-sync/src/Cardano/DbSync/Ledger

1 file changed

+6
-4
lines changed

cardano-db-sync/src/Cardano/DbSync/Ledger/Types.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ import Ouroboros.Consensus.Cardano.Block hiding (CardanoBlock, CardanoLedgerStat
5050
import Ouroboros.Consensus.HardFork.Combinator.Basics (LedgerState (..))
5151
import Ouroboros.Consensus.Ledger.Abstract (getTipSlot)
5252
import Ouroboros.Consensus.Ledger.Basics (EmptyMK, LedgerTables, ValuesMK)
53-
import qualified Ouroboros.Consensus.Ledger.Basics as Consensus
5453
import Ouroboros.Consensus.Ledger.Extended (ExtLedgerState (..))
54+
import Ouroboros.Consensus.Ledger.Tables (valuesMKDecoder, valuesMKEncoder)
5555
import qualified Ouroboros.Consensus.Node.ProtocolInfo as Consensus
5656
import Ouroboros.Consensus.Shelley.Ledger (LedgerState (..), ShelleyBlock)
5757
import Ouroboros.Network.AnchoredSeq (Anchorable (..), AnchoredSeq (..))
@@ -113,15 +113,17 @@ encodeCardanoLedgerState encodeExt cls =
113113
mconcat
114114
[ encodeExt (clsState cls)
115115
, toCBOR (clsEpochBlockNo cls)
116+
, valuesMKEncoder (clsState cls) (clsTables cls)
116117
]
117118

118119
decodeCardanoLedgerState ::
119120
(forall s. Decoder s (ExtLedgerState CardanoBlock EmptyMK)) ->
120121
(forall s. Decoder s CardanoLedgerState)
121122
decodeCardanoLedgerState decodeExt = do
122-
ldgrState <- decodeExt
123-
let ldgrTables = Consensus.projectLedgerTables (Consensus.unstowLedgerTables ldgrState)
124-
CardanoLedgerState ldgrState ldgrTables <$> fromCBOR
123+
lState <- decodeExt
124+
eBlockNo <- fromCBOR
125+
lTables <- valuesMKDecoder lState
126+
pure $ CardanoLedgerState lState lTables eBlockNo
125127

126128
data LedgerStateFile = LedgerStateFile
127129
{ lsfSlotNo :: !SlotNo

0 commit comments

Comments
 (0)