Skip to content

Commit

Permalink
Update GenDelegs in the DState
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Aug 8, 2022
1 parent 31803c8 commit 65cb4e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 9 additions & 5 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Translation.hs
Expand Up @@ -35,7 +35,7 @@ import Cardano.Ledger.Shelley.API
( EpochState (..),
NewEpochState (..),
ShelleyGenesis,
StrictMaybe (..),
StrictMaybe (..), DPState (..), DState (..)
)
import qualified Cardano.Ledger.Shelley.API as API
import Cardano.Ledger.Shelley.PParams (ShelleyPParamsHKD)
Expand Down Expand Up @@ -75,7 +75,7 @@ instance Crypto c => TranslateEra (ConwayEra c) NewEpochState where
}

instance Crypto c => TranslateEra (ConwayEra c) ShelleyGenesis where
translateEra ctxt@(ConwayGenesis (API.GenDelegs genDelegs)) genesis =
translateEra ctxt genesis =
pure
API.ShelleyGenesis
{ API.sgSystemStart = API.sgSystemStart genesis,
Expand All @@ -90,7 +90,7 @@ instance Crypto c => TranslateEra (ConwayEra c) ShelleyGenesis where
API.sgUpdateQuorum = API.sgUpdateQuorum genesis,
API.sgMaxLovelaceSupply = API.sgMaxLovelaceSupply genesis,
API.sgProtocolParams = translateEra' ctxt (API.sgProtocolParams genesis),
API.sgGenDelegs = genDelegs,
API.sgGenDelegs = API.sgGenDelegs genesis,
API.sgInitialFunds = API.sgInitialFunds genesis,
API.sgStaking = API.sgStaking genesis
}
Expand Down Expand Up @@ -135,12 +135,16 @@ instance Crypto c => TranslateEra (ConwayEra c) EpochState where
}

instance Crypto c => TranslateEra (ConwayEra c) API.LedgerState where
translateEra ctxt ls =
translateEra ctxt@(ConwayGenesis newGenDelegs) ls =
pure
API.LedgerState
{ API.lsUTxOState = translateEra' ctxt $ API.lsUTxOState ls,
API.lsDPState = API.lsDPState ls
API.lsDPState = updateGenesisKeys $ API.lsDPState ls
}
where
updateGenesisKeys (DPState dstate pstate) = DPState dstate' pstate
where
dstate' = dstate{_genDelegs = newGenDelegs}

instance Crypto c => TranslateEra (ConwayEra c) API.UTxOState where
translateEra ctxt us =
Expand Down
1 change: 0 additions & 1 deletion eras/shelley-ma/impl/cardano-ledger-shelley-ma.cabal
Expand Up @@ -64,7 +64,6 @@ library
cardano-slotting,
cborg,
containers,
data-default-class,
deepseq,
groups,
mtl,
Expand Down

0 comments on commit 65cb4e4

Please sign in to comment.