@@ -74,6 +74,8 @@ import Ouroboros.Consensus.Byron.Ledger.Serialisation
74
74
import Ouroboros.Consensus.Config
75
75
import Ouroboros.Consensus.Forecast
76
76
import Ouroboros.Consensus.HardFork.Abstract
77
+ import Ouroboros.Consensus.HardFork.Combinator.Embed.Nary
78
+ (Untick (.. ))
77
79
import qualified Ouroboros.Consensus.HardFork.History as HardFork
78
80
import Ouroboros.Consensus.HeaderValidation
79
81
import Ouroboros.Consensus.Ledger.Abstract
@@ -83,6 +85,7 @@ import Ouroboros.Consensus.Ledger.Query
83
85
import Ouroboros.Consensus.Ledger.SupportsPeerSelection
84
86
import Ouroboros.Consensus.Ledger.SupportsProtocol
85
87
import Ouroboros.Consensus.Protocol.PBFT
88
+ import Ouroboros.Consensus.TypeFamilyWrappers
86
89
import Ouroboros.Consensus.Util (ShowProxy (.. ), (..:) )
87
90
88
91
{- ------------------------------------------------------------------------------
@@ -164,6 +167,7 @@ getByronTip state =
164
167
-- | The ticked Byron ledger state
165
168
data instance Ticked (LedgerState ByronBlock ) = TickedByronLedgerState {
166
169
tickedByronLedgerState :: ! CC. ChainValidationState
170
+ , untickedByronLedgerTipBlockNo :: ! (WithOrigin BlockNo )
167
171
, untickedByronLedgerTransition :: ! ByronTransition
168
172
}
169
173
deriving (Generic , NoThunks )
@@ -178,6 +182,8 @@ instance IsLedger (LedgerState ByronBlock) where
178
182
TickedByronLedgerState {
179
183
tickedByronLedgerState =
180
184
CC. applyChainTick cfg (toByronSlotNo slotNo) byronLedgerState
185
+ , untickedByronLedgerTipBlockNo =
186
+ byronLedgerTipBlockNo
181
187
, untickedByronLedgerTransition =
182
188
byronLedgerTransition
183
189
}
@@ -503,3 +509,27 @@ decodeByronResult :: BlockQuery ByronBlock result
503
509
-> forall s . Decoder s result
504
510
decodeByronResult query = case query of
505
511
GetUpdateInterfaceState -> fromByronCBOR
512
+
513
+ {- ------------------------------------------------------------------------------
514
+ Unticking
515
+ -------------------------------------------------------------------------------}
516
+
517
+ instance Untick (WrapChainDepState ByronBlock ) where
518
+ untick =
519
+ pure
520
+ . WrapChainDepState
521
+ . getTickedPBftState
522
+ . unwrapTickedChainDepState
523
+
524
+ instance Untick (LedgerState ByronBlock ) where
525
+ untick st = pure ByronLedgerState {
526
+ byronLedgerTipBlockNo = untickedByronLedgerTipBlockNo
527
+ , byronLedgerState = tickedByronLedgerState
528
+ , byronLedgerTransition = untickedByronLedgerTransition
529
+ }
530
+ where
531
+ TickedByronLedgerState {
532
+ tickedByronLedgerState
533
+ , untickedByronLedgerTipBlockNo
534
+ , untickedByronLedgerTransition
535
+ } = st
0 commit comments