Skip to content
Merged
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
1 change: 1 addition & 0 deletions eras/allegra/impl/cardano-ledger-allegra.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ library
Cardano.Ledger.Allegra.Rules.Ppup
Cardano.Ledger.Allegra.Rules.Utxo
Cardano.Ledger.Allegra.Rules.Utxow
Cardano.Ledger.Allegra.State.Account
Cardano.Ledger.Allegra.State.CertState
Cardano.Ledger.Allegra.State.Stake
Cardano.Ledger.Allegra.TxCert
Expand Down
1 change: 1 addition & 0 deletions eras/allegra/impl/src/Cardano/Ledger/Allegra/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Cardano.Ledger.Allegra.State (
module Cardano.Ledger.Shelley.State,
) where

import Cardano.Ledger.Allegra.State.Account ()
import Cardano.Ledger.Allegra.State.CertState ()
import Cardano.Ledger.Allegra.State.Stake ()
import Cardano.Ledger.Shelley.State
29 changes: 29 additions & 0 deletions eras/allegra/impl/src/Cardano/Ledger/Allegra/State/Account.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Allegra.State.Account () where

import Cardano.Ledger.Allegra.Era
import Cardano.Ledger.BaseTypes
import Cardano.Ledger.Shelley.State
import Lens.Micro

instance EraAccounts AllegraEra where
type AccountState AllegraEra = ShelleyAccountState AllegraEra
type Accounts AllegraEra = ShelleyAccounts AllegraEra

addAccountState = shelleyAddAccountState

accountsMapL = lens saStates $ \sas asMap -> sas {saStates = asMap}

balanceAccountStateL = lens sasBalance $ \sas b -> sas {sasBalance = b}

depositAccountStateL = lens sasDeposit $ \sas d -> sas {sasDeposit = d}

stakePoolDelegationAccountStateL =
lens (strictMaybeToMaybe . sasStakePoolDelegation) $ \sas d ->
sas {sasStakePoolDelegation = maybeToStrictMaybe d}

unregisterAccount = unregisterShelleyAccount

instance ShelleyEraAccounts AllegraEra
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
module Cardano.Ledger.Allegra.State.CertState () where

import Cardano.Ledger.Allegra.Era (AllegraEra)
import Cardano.Ledger.Allegra.State.Account ()
import Cardano.Ledger.Shelley.State

instance EraCertState AllegraEra where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Cardano.Ledger.Allegra.State.Stake () where

import Cardano.Ledger.Allegra.Core ()
import Cardano.Ledger.Allegra.Era (AllegraEra)
import Cardano.Ledger.Allegra.State.Account ()
import Cardano.Ledger.Shelley.State (
EraStake (..),
ShelleyInstantStake,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ instance EraTransition AllegraEra where

mkTransitionConfig NoGenesis = AllegraTransitionConfig

injectIntoTestState = registerInitialFundsThenStaking
injectIntoTestState = shelleyRegisterInitialFundsThenStaking

tcPreviousEraConfigL =
lens atcShelleyTransitionConfig (\atc pc -> atc {atcShelleyTransitionConfig = pc})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ instance TranslateEra AllegraEra UTxOState where
instance TranslateEra AllegraEra ShelleyInstantStake where
translateEra _ = pure . coerce

instance TranslateEra AllegraEra ShelleyAccounts where
translateEra _ = pure . coerce

instance TranslateEra AllegraEra DState where
translateEra _ DState {..} = pure DState {..}
translateEra ctx DState {dsAccounts = accountsShelley, ..} = do
dsAccounts <- translateEra ctx accountsShelley
pure DState {..}

instance TranslateEra AllegraEra CommitteeState where
translateEra _ CommitteeState {..} = pure CommitteeState {..}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ class
instance EraTest AllegraEra where
zeroCostModels = emptyCostModels

mkTestAccountState = mkShelleyTestAccountState

accountsFromAccountsMap = shelleyAccountsFromAccountsMap

accountsToUMap = shelleyAccountsToUMap

instance ShelleyEraTest AllegraEra

instance AllegraEraTest AllegraEra
1 change: 1 addition & 0 deletions eras/alonzo/impl/cardano-ledger-alonzo.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ library
Cardano.Ledger.Alonzo.Rules.Utxo
Cardano.Ledger.Alonzo.Rules.Utxos
Cardano.Ledger.Alonzo.Rules.Utxow
Cardano.Ledger.Alonzo.State.Account
Cardano.Ledger.Alonzo.State.CertState
Cardano.Ledger.Alonzo.State.Stake
Cardano.Ledger.Alonzo.TxCert
Expand Down
6 changes: 3 additions & 3 deletions eras/alonzo/impl/golden/pparams-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"maxCollateralInputs": 45,
"maxTxSize": 881284740,
"maxValueSize": 39,
"minPoolCost": 392044,
"minPoolCost": 855261,
"monetaryExpansion": 0.7810966919969065,
"poolPledgeInfluence": 8.319022570290014789e16,
"poolRetireMaxEpoch": 1843493333,
"stakePoolDeposit": 3827864344574364691,
"stakePoolDeposit": 275624,
"stakePoolTargetNum": 10900,
"treasuryCut": 0.234167131785253734
}
}
1 change: 1 addition & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Cardano.Ledger.Alonzo.State (
module Cardano.Ledger.Mary.State,
) where

import Cardano.Ledger.Alonzo.State.Account ()
import Cardano.Ledger.Alonzo.State.CertState ()
import Cardano.Ledger.Alonzo.State.Stake ()
import Cardano.Ledger.Mary.State
29 changes: 29 additions & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/State/Account.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Alonzo.State.Account () where

import Cardano.Ledger.Alonzo.Era
import Cardano.Ledger.BaseTypes
import Cardano.Ledger.Shelley.State
import Lens.Micro

instance EraAccounts AlonzoEra where
type AccountState AlonzoEra = ShelleyAccountState AlonzoEra
type Accounts AlonzoEra = ShelleyAccounts AlonzoEra

addAccountState = shelleyAddAccountState

accountsMapL = lens saStates $ \sas asMap -> sas {saStates = asMap}

balanceAccountStateL = lens sasBalance $ \sas b -> sas {sasBalance = b}

depositAccountStateL = lens sasDeposit $ \sas d -> sas {sasDeposit = d}

stakePoolDelegationAccountStateL =
lens (strictMaybeToMaybe . sasStakePoolDelegation) $ \sas d ->
sas {sasStakePoolDelegation = maybeToStrictMaybe d}

unregisterAccount = unregisterShelleyAccount

instance ShelleyEraAccounts AlonzoEra
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
module Cardano.Ledger.Alonzo.State.CertState () where

import Cardano.Ledger.Alonzo.Era (AlonzoEra)
import Cardano.Ledger.Alonzo.State.Account ()
import Cardano.Ledger.Shelley.State

instance EraCertState AlonzoEra where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Cardano.Ledger.Alonzo.State.Stake () where

import Cardano.Ledger.Alonzo.Core ()
import Cardano.Ledger.Alonzo.Era (AlonzoEra)
import Cardano.Ledger.Alonzo.State.Account ()
import Cardano.Ledger.Shelley.State (
EraStake (..),
ShelleyInstantStake,
Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Transition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ instance EraTransition AlonzoEra where

mkTransitionConfig = AlonzoTransitionConfig

injectIntoTestState = registerInitialFundsThenStaking
injectIntoTestState = shelleyRegisterInitialFundsThenStaking

tcPreviousEraConfigL =
lens atcMaryTransitionConfig (\atc pc -> atc {atcMaryTransitionConfig = pc})
Expand Down
7 changes: 6 additions & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Translation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ instance TranslateEra AlonzoEra EpochState where
, esNonMyopic = esNonMyopic es
}

instance TranslateEra AlonzoEra ShelleyAccounts where
translateEra _ = pure . coerce

instance TranslateEra AlonzoEra DState where
translateEra _ DState {..} = pure DState {..}
translateEra ctx DState {dsAccounts = accountsShelley, ..} = do
dsAccounts <- translateEra ctx accountsShelley
pure DState {..}

instance TranslateEra AlonzoEra CommitteeState where
translateEra _ CommitteeState {..} = pure CommitteeState {..}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ roundTripAlonzoCommonSpec ::
, Arbitrary (PParamsUpdate era)
, Arbitrary (CertState era)
, Arbitrary (InstantStake era)
, Arbitrary (Accounts era)
, DecCBOR (Script era)
, DecCBOR (TxAuxData era)
, DecCBOR (TxWits era)
Expand Down
6 changes: 6 additions & 0 deletions eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class
instance EraTest AlonzoEra where
zeroCostModels = zeroTestingCostModels [PlutusV1]

mkTestAccountState = mkShelleyTestAccountState

accountsFromAccountsMap = shelleyAccountsFromAccountsMap

accountsToUMap = shelleyAccountsToUMap

instance ShelleyEraTest AlonzoEra

instance AllegraEraTest AlonzoEra
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Cardano.Ledger.Shelley.Rules (
ShelleyDelplPredFailure,
UtxoEnv,
)
import Cardano.Ledger.State
import Cardano.Ledger.Shelley.State
import Cardano.Protocol.Crypto (Crypto)
import Cardano.Slotting.Slot (SlotNo (..))
import Control.Monad.Trans.Reader (runReaderT)
Expand All @@ -48,6 +48,7 @@ instance
, EraGov era
, EraUTxO era
, AlonzoEraTx era
, ShelleyEraAccounts era
, MinLEDGER_STS era
, Embed (EraRule "DELPL" era) (CERTS era)
, Environment (EraRule "DELPL" era) ~ DelplEnv era
Expand Down
1 change: 1 addition & 0 deletions eras/babbage/impl/cardano-ledger-babbage.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ library
Cardano.Ledger.Babbage.Rules.Utxo
Cardano.Ledger.Babbage.Rules.Utxos
Cardano.Ledger.Babbage.Rules.Utxow
Cardano.Ledger.Babbage.State.Account
Cardano.Ledger.Babbage.State.CertState
Cardano.Ledger.Babbage.State.Stake
Cardano.Ledger.Babbage.TxAuxData
Expand Down
10 changes: 5 additions & 5 deletions eras/babbage/impl/golden/pparams-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"maxBlockHeaderSize": 7370,
"maxCollateralInputs": 45,
"maxValueSize": 39,
"minPoolCost": 392044,
"minPoolCost": 855261,
"monetaryExpansion": 0.2,
"poolPledgeInfluence": 6.790200579626650307,
"poolRetireMaxEpoch": 1676560372,
"stakeAddressDeposit": 664860,
"stakePoolDeposit": 1.7453986152646146491e19,
"stakeAddressDeposit": 11,
"stakePoolDeposit": 395789,
"stakePoolTargetNum": 40749,
"treasuryCut": 0.34109,
"txFeeFixed": 321937
}
"txFeeFixed": 235256
}
1 change: 1 addition & 0 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module Cardano.Ledger.Babbage.State (
) where

import Cardano.Ledger.Alonzo.State
import Cardano.Ledger.Babbage.State.Account ()
import Cardano.Ledger.Babbage.State.CertState ()
import Cardano.Ledger.Babbage.State.Stake ()
29 changes: 29 additions & 0 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/State/Account.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Babbage.State.Account () where

import Cardano.Ledger.Babbage.Era
import Cardano.Ledger.BaseTypes
import Cardano.Ledger.Shelley.State
import Lens.Micro

instance EraAccounts BabbageEra where
type AccountState BabbageEra = ShelleyAccountState BabbageEra
type Accounts BabbageEra = ShelleyAccounts BabbageEra

addAccountState = shelleyAddAccountState

accountsMapL = lens saStates $ \sas asMap -> sas {saStates = asMap}

balanceAccountStateL = lens sasBalance $ \sas b -> sas {sasBalance = b}

depositAccountStateL = lens sasDeposit $ \sas d -> sas {sasDeposit = d}

stakePoolDelegationAccountStateL =
lens (strictMaybeToMaybe . sasStakePoolDelegation) $ \sas d ->
sas {sasStakePoolDelegation = maybeToStrictMaybe d}

unregisterAccount = unregisterShelleyAccount

instance ShelleyEraAccounts BabbageEra
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
module Cardano.Ledger.Babbage.State.CertState () where

import Cardano.Ledger.Babbage.Era (BabbageEra)
import Cardano.Ledger.Babbage.State.Account ()
import Cardano.Ledger.Shelley.State

instance EraCertState BabbageEra where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Cardano.Ledger.Babbage.State.Stake () where

import Cardano.Ledger.Babbage.Core ()
import Cardano.Ledger.Babbage.Era (BabbageEra)
import Cardano.Ledger.Babbage.State.Account ()
import Cardano.Ledger.Shelley.State (
EraStake (..),
ShelleyInstantStake,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ instance EraTransition BabbageEra where

mkTransitionConfig NoGenesis = BabbageTransitionConfig

injectIntoTestState = registerInitialFundsThenStaking
injectIntoTestState = shelleyRegisterInitialFundsThenStaking

tcPreviousEraConfigL =
lens btcAlonzoTransitionConfig (\btc pc -> btc {btcAlonzoTransitionConfig = pc})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ instance TranslateEra BabbageEra EpochState where
, esNonMyopic = esNonMyopic es
}

instance TranslateEra BabbageEra ShelleyAccounts where
translateEra _ = pure . coerce

instance TranslateEra BabbageEra DState where
translateEra _ DState {..} = pure DState {..}
translateEra ctx DState {dsAccounts = accountsShelley, ..} = do
dsAccounts <- translateEra ctx accountsShelley
pure DState {..}

instance TranslateEra BabbageEra CommitteeState where
translateEra _ CommitteeState {..} = pure CommitteeState {..}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class

instance EraTest BabbageEra where
zeroCostModels = zeroTestingCostModels [PlutusV1 .. PlutusV2]
mkTestAccountState = mkShelleyTestAccountState

accountsFromAccountsMap = shelleyAccountsFromAccountsMap

accountsToUMap = shelleyAccountsToUMap

instance ShelleyEraTest BabbageEra

Expand Down
9 changes: 8 additions & 1 deletion eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## 1.20.0.0

* Add `mkDelegatee` and `getDRepDelegatee`
* Depercated `getVoteDelegatee` in favor of `getDRepDelegatee`
* Add `conwayRegisterInitialFundsThenStaking`
* Add `ConwayEraAccounts`, `ConwayAccountState`, `ConwayAccounts`, `lookupDRepDelegation`,
`registerConwayAccount`, `unregisterConwayAccount` and `accountStateDelegatee`
* Change type in `WithdrawalsNotInRewardsCERTS` from `Map RewardAccount Coin` to `Withdrawals`
* Add `AlonzoEraTx` constraint to `STS` instance for `ConwayBBODY`
* Add `totalRefScriptSizeInBlock`
* Move some hard-fork triggers and export them from `Cardano.Ledger.Conway` module.
Expand Down Expand Up @@ -60,7 +66,8 @@

### `testlib`

- Rename `electCommittee` to `submitCommitteeElection` #5091
* Add `mkConwayTestAccountState` and `conwayAccountsToUMap`
* Rename `electCommittee` to `submitCommitteeElection` #5091
* Fixed `Arbitrary` instance for `ConwayGenesis`
* Added `Arbitrary` instance for `TransitionConfig ConwayEra`
* Added `ToExpr` instances for:
Expand Down
1 change: 1 addition & 0 deletions eras/conway/impl/cardano-ledger-conway.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ library
Cardano.Ledger.Conway.Rules.Utxo
Cardano.Ledger.Conway.Rules.Utxos
Cardano.Ledger.Conway.Rules.Utxow
Cardano.Ledger.Conway.State.Account
Cardano.Ledger.Conway.State.CertState
Cardano.Ledger.Conway.State.Stake
Cardano.Ledger.Conway.State.VState
Expand Down
Loading