@@ -33,12 +33,13 @@ import qualified Cardano.Chain.Genesis as CC.Genesis
33
33
import qualified Cardano.Chain.Update as CC.Update
34
34
import Cardano.Crypto.DSIGN (Ed25519DSIGN )
35
35
import Cardano.Crypto.Hash.Blake2b (Blake2b_224 , Blake2b_256 )
36
+ import qualified Cardano.Ledger.Babbage.Core as SL
36
37
import Cardano.Ledger.Crypto (ADDRHASH , Crypto , DSIGN , HASH )
37
- import qualified Cardano.Ledger.Era as SL
38
38
import qualified Cardano.Ledger.Genesis as SL
39
39
import Cardano.Ledger.Hashes (EraIndependentTxBody )
40
40
import Cardano.Ledger.Keys (DSignable , Hash )
41
41
import qualified Cardano.Ledger.Shelley.API as SL
42
+ import qualified Cardano.Ledger.Shelley.LedgerState as SL
42
43
import Cardano.Ledger.Shelley.Translation
43
44
(toFromByronTranslationContext )
44
45
import qualified Cardano.Protocol.TPraos.API as SL
@@ -47,6 +48,7 @@ import qualified Cardano.Protocol.TPraos.Rules.Tickn as SL
47
48
import Control.Monad
48
49
import Control.Monad.Except (runExcept , throwError )
49
50
import Data.Coerce (coerce )
51
+ import Data.Function ((&) )
50
52
import qualified Data.Map.Strict as Map
51
53
import Data.Maybe (listToMaybe , mapMaybe )
52
54
import Data.Proxy
@@ -57,6 +59,7 @@ import Data.SOP.Tails (Tails (..))
57
59
import qualified Data.SOP.Tails as Tails
58
60
import Data.Word
59
61
import GHC.Generics (Generic )
62
+ import Lens.Micro ((%~) )
60
63
import NoThunks.Class (NoThunks )
61
64
import Ouroboros.Consensus.Block
62
65
import Ouroboros.Consensus.Byron.Ledger
@@ -709,7 +712,7 @@ translateValidatedTxAlonzoToBabbageWrapper ctxt = InjectValidatedTx $
709
712
-------------------------------------------------------------------------------}
710
713
711
714
translateLedgerStateBabbageToConwayWrapper ::
712
- (Praos. PraosCrypto c )
715
+ forall c . (Praos. PraosCrypto c )
713
716
=> RequiringBoth
714
717
WrapLedgerConfig
715
718
(Translate LedgerState )
@@ -718,7 +721,34 @@ translateLedgerStateBabbageToConwayWrapper ::
718
721
translateLedgerStateBabbageToConwayWrapper =
719
722
RequireBoth $ \ _cfgBabbage cfgConway ->
720
723
Translate $ \ _epochNo ->
721
- unComp . SL. translateEra' (getConwayTranslationContext cfgConway) . Comp
724
+ unComp
725
+ . SL. translateEra' (getConwayTranslationContext cfgConway)
726
+ . Comp
727
+ . patchGovState
728
+ where
729
+ patchGovState ::
730
+ LedgerState (ShelleyBlock proto (BabbageEra c ))
731
+ -> LedgerState (ShelleyBlock proto (BabbageEra c ))
732
+ patchGovState st =
733
+ st { shelleyLedgerState = shelleyLedgerState st
734
+ & SL. newEpochStateGovStateL %~ rotateGovState
735
+ }
736
+ where
737
+ -- This is only needed to keep backwards-compatibility with a past hack.
738
+ -- Concretely, this means that the tick across the epoch/era boundary
739
+ -- (using Conway logic) will consider the protocol parameters of the
740
+ -- first Conway epoch (instead of the last Babbage epoch) to be the
741
+ -- /current/ protocol parameters. The only effect is that delegations
742
+ -- from pointer addresses are ignored one already at this epoch
743
+ -- boundary.
744
+ rotateGovState ::
745
+ SL. ShelleyGovState (BabbageEra c )
746
+ -> SL. ShelleyGovState (BabbageEra c )
747
+ rotateGovState gs = gs {
748
+ SL. sgsPrevPParams = SL. sgsCurPParams gs
749
+ , SL. sgsCurPParams = SL. nextEpochPParams gs
750
+ , SL. sgsFuturePParams = SL. PotentialPParamsUpdate Nothing
751
+ }
722
752
723
753
getConwayTranslationContext ::
724
754
WrapLedgerConfig (ShelleyBlock (Praos c ) (ConwayEra c ))
0 commit comments