Skip to content

Commit

Permalink
Call BHEAD from CHAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
mgudemann committed Jun 18, 2019
1 parent 0815014 commit 0815411
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions shelley/chain-and-ledger/executable-spec/delegation.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ library
STS.Overlay
STS.Pool
STS.PoolReap
STS.Prtcl
STS.Rupd
STS.Snap
STS.Updn
Expand Down
7 changes: 7 additions & 0 deletions shelley/chain-and-ledger/executable-spec/src/LedgerState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module LedgerState
, NewEpochState(..)
, NewEpochEnv(..)
, overlaySchedule
, getGKeys
) where

import Control.Monad (foldM)
Expand Down Expand Up @@ -317,6 +318,12 @@ data NewEpochState =
, nesOsched :: Map.Map Slot (Maybe VKeyGenesis)
} deriving (Show, Eq)

getGKeys :: NewEpochState -> Set VKeyGenesis
getGKeys nes = Map.keysSet dms
where NewEpochState _ _ _ _ es _ _ _ = nes
EpochState _ _ ls _ = es
LedgerState _ (DPState (DState _ _ _ _ (Dms dms)) _) _ _ _ _ = ls

data NewEpochEnv =
NewEpochEnv {
neeEta1 :: Seed
Expand Down
5 changes: 4 additions & 1 deletion shelley/chain-and-ledger/executable-spec/src/STS/Chain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ chainTransition :: TransitionRule CHAIN
chainTransition = do
TRC (sNow, (nes, etaV, etaC, h, sL), block@(Block bh _)) <- judgmentContext

let nes'@(NewEpochState _ eta0 _ bCur es _ pd osched) = nes -- TODO: converge BHEAD
let gkeys = getGKeys nes
nes' <- trans @BHEAD $ TRC((etaC, gkeys), nes, bh)

let NewEpochState _ eta0 _ bCur es _ pd osched = nes'
let EpochState _ _ ls pp = es
let LedgerState _ (DPState (DState _ _ _ _ dms) (PState _ _ _ cs)) _ _ _ _ = ls

Expand Down

0 comments on commit 0815411

Please sign in to comment.