Skip to content
Open
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
4 changes: 2 additions & 2 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Transition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ instance EraTransition AlonzoEra where

mkTransitionConfig = AlonzoTransitionConfig

injectIntoTestState cfg =
shelleyRegisterInitialFundsThenStaking cfg . alonzoInjectCostModels cfg
injectIntoTestState withFileHandle cfg newEpochState =
shelleyRegisterInitialFundsThenStaking withFileHandle cfg (alonzoInjectCostModels cfg newEpochState)

tcPreviousEraConfigL =
lens atcMaryTransitionConfig (\atc pc -> atc {atcMaryTransitionConfig = pc})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ instance EraTransition BabbageEra where

mkTransitionConfig NoGenesis = BabbageTransitionConfig

injectIntoTestState cfg = shelleyRegisterInitialFundsThenStaking cfg . alonzoInjectCostModels (cfg ^. tcPreviousEraConfigL)
injectIntoTestState withFileHandle cfg newEpochState =
shelleyRegisterInitialFundsThenStaking
withFileHandle
cfg
(alonzoInjectCostModels (cfg ^. tcPreviousEraConfigL) newEpochState)

tcPreviousEraConfigL =
lens btcAlonzoTransitionConfig (\btc pc -> btc {btcAlonzoTransitionConfig = pc})
Expand Down
1 change: 1 addition & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.21.0.0

* Change `conwayRegisterInitialFundsThenStaking` to require `MonadIO`, `MonadFail` and accept a `WithFileHandle` callback parameter
* Add `HeaderProtVerTooHigh` predicate failure.
* Change `STS` instance of `ConwayUTOXS`: use `PParams` as `Environment`
* Remove `TotalDeposits` and `TxUTxODiff` data constructors from `ConwayUtxosEvent`
Expand Down
34 changes: 20 additions & 14 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Transition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableSuperClasses #-}
Expand Down Expand Up @@ -33,7 +34,9 @@ import Cardano.Ledger.Conway.Translation ()
import Cardano.Ledger.Conway.TxCert (Delegatee (..))
import Cardano.Ledger.Core
import Cardano.Ledger.Credential (Credential (..))
import Cardano.Ledger.Shelley.Genesis (ShelleyGenesisStaking (..))
import Cardano.Ledger.Shelley.Genesis (
ShelleyGenesisStaking (..),
)
import Cardano.Ledger.Shelley.LedgerState (
NewEpochState,
curPParamsEpochStateL,
Expand All @@ -42,6 +45,7 @@ import Cardano.Ledger.Shelley.LedgerState (
nesEsL,
)
import Cardano.Ledger.Shelley.Transition
import Control.Monad.IO.Class (MonadIO)
import Data.ListMap (ListMap)
import qualified Data.ListMap as ListMap
import qualified Data.Map.Strict as Map
Expand Down Expand Up @@ -76,9 +80,9 @@ instance EraTransition ConwayEra where

mkTransitionConfig = ConwayTransitionConfig

injectIntoTestState cfg =
conwayRegisterInitialFundsThenStaking cfg
. alonzoInjectCostModels (cfg ^. tcPreviousEraConfigL . tcPreviousEraConfigL)
injectIntoTestState withFileHandle cfg newEpochState =
conwayRegisterInitialFundsThenStaking withFileHandle cfg $
alonzoInjectCostModels (cfg ^. tcPreviousEraConfigL . tcPreviousEraConfigL) newEpochState

tcPreviousEraConfigL =
lens ctcBabbageTransitionConfig (\ctc pc -> ctc {ctcBabbageTransitionConfig = pc})
Expand All @@ -104,20 +108,22 @@ tcInitialDRepsL =
instance NoThunks (TransitionConfig ConwayEra)

conwayRegisterInitialFundsThenStaking ::
ConwayEraTransition era =>
(ConwayEraTransition era, MonadIO m, MonadFail m) =>
WithFileHandle m ->
TransitionConfig era ->
NewEpochState era ->
NewEpochState era
conwayRegisterInitialFundsThenStaking cfg =
m (NewEpochState era)
conwayRegisterInitialFundsThenStaking withFileHandle cfg newEpochState = do
-- We must first register the initial funds, because the stake
-- information depends on it.
resetStakeDistribution
. registerDRepsThenDelegs cfg
. conwayRegisterInitialAccounts (cfg ^. tcInitialStakingL)
. registerInitialStakePools (cfg ^. tcInitialStakingL)
. registerInitialFunds cfg

-- | Register all staking credentials and apply delegations. Make sure StakePools that are bing
newEpochState' <- registerInitialFunds withFileHandle cfg newEpochState
pure $
resetStakeDistribution $
registerDRepsThenDelegs cfg $
conwayRegisterInitialAccounts (cfg ^. tcInitialStakingL) $
registerInitialStakePools (cfg ^. tcInitialStakingL) newEpochState'

-- | Register all staking credentials and apply delegations. Make sure StakePools that are being
-- delegated to are already registered, which can be done with `registerInitialStakePools`.
conwayRegisterInitialAccounts ::
forall era.
Expand Down
4 changes: 4 additions & 0 deletions eras/shelley/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 1.18.0.0

* Add `InjectionSource`, `WithFileHandle`, `foldInjectionSource`, `InjectionError`, `renderInjectionError` to `Cardano.Ledger.Shelley.Genesis`
* Add `ShelleyExtraConfig` type to `Cardano.Ledger.Shelley.Genesis`
* Add `sgExtraConfig` field to `ShelleyGenesis`
* Change `registerInitialFunds` and `injectIntoTestState` to require `MonadIO`, `MonadFail` and accept a `WithFileHandle` callback parameter for streaming initial funds from external files
* Add `Generic` instance for `ApplyTxError`
* Change `updateNonMyopic`, `likelihoodsNM`, `rewLikelihoods` and `fvPoolRewardInfo` to use `VMap`
* Add `calcNonMyopicMemberReward` and deprecate `nonMyopicMemberRew` in its favor.
Expand Down
3 changes: 3 additions & 0 deletions eras/shelley/impl/cardano-ledger-shelley.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,16 @@ library
data-default,
deepseq,
groups,
json-stream >=0.4,
mempack,
microlens,
mtl,
nothunks,
primitive,
quiet,
small-steps >=1.1.1,
streaming >=0.2,
streaming-bytestring >=0.3,
text,
time,
transformers,
Expand Down
Loading
Loading