Skip to content

Commit

Permalink
Update Conway Translation to set constitution and committee from Genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Sep 1, 2023
1 parent e9ab4a5 commit 6da0786
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Translation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand All @@ -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 =
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 6da0786

Please sign in to comment.