From 6da0786e6ce6913fc6a527b187f660c145e08b58 Mon Sep 17 00:00:00 2001 From: teodanciu Date: Tue, 29 Aug 2023 17:03:37 +0100 Subject: [PATCH] Update Conway Translation to set constitution and committee from Genesis --- .../src/Cardano/Ledger/Conway/Translation.hs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/eras/conway/impl/src/Cardano/Ledger/Conway/Translation.hs b/eras/conway/impl/src/Cardano/Ledger/Conway/Translation.hs index e3ab51acfac..27e5150a50c 100644 --- a/eras/conway/impl/src/Cardano/Ledger/Conway/Translation.hs +++ b/eras/conway/impl/src/Cardano/Ledger/Conway/Translation.hs @@ -28,7 +28,11 @@ import Cardano.Ledger.CertState (CommitteeState (..)) import Cardano.Ledger.Conway.Core hiding (Tx) import Cardano.Ledger.Conway.Era (ConwayEra) import Cardano.Ledger.Conway.Genesis (ConwayGenesis (..)) -import Cardano.Ledger.Conway.Governance () +import Cardano.Ledger.Conway.Governance ( + cgEnactStateL, + ensCommitteeL, + ensConstitutionL, + ) import Cardano.Ledger.Conway.Scripts () import Cardano.Ledger.Conway.Tx () import qualified Cardano.Ledger.Core as Core (Tx) @@ -45,6 +49,7 @@ import Cardano.Ledger.Shelley.API ( ) import qualified Cardano.Ledger.Shelley.API as API import Cardano.Ledger.Shelley.LedgerState (curPParamsEpochStateL, prevPParamsEpochStateL) +import Data.Default.Class (Default (def)) import qualified Data.Map.Strict as Map import Lens.Micro @@ -63,7 +68,7 @@ import Lens.Micro -- being total. Do not change it! -------------------------------------------------------------------------------- -type instance TranslationContext (ConwayEra c) = ConwayGenesis (ConwayEra c) +type instance TranslationContext (ConwayEra c) = ConwayGenesis c instance Crypto c => TranslateEra (ConwayEra c) NewEpochState where translateEra ctxt nes = @@ -154,10 +159,15 @@ translateGovState :: TranslationContext (ConwayEra c) -> GovState (BabbageEra c) -> GovState (ConwayEra c) -translateGovState ctxt sgov = +translateGovState ctxt@(ConwayGenesis _ constitution committee) sgov = emptyGovState & curPParamsGovStateL .~ translateEra' ctxt (sgov ^. curPParamsGovStateL) & prevPParamsGovStateL .~ translateEra' ctxt (sgov ^. prevPParamsGovStateL) + & cgEnactStateL + .~ ( def + & ensConstitutionL .~ constitution + & ensCommitteeL .~ SJust committee + ) instance Crypto c => TranslateEra (ConwayEra c) UTxOState where translateEra ctxt us =