Skip to content

Commit

Permalink
Merge #4332 #4350
Browse files Browse the repository at this point in the history
4332: Reorganize mempool modules r=Jasagredo a=Jasagredo

# Description

Things have grown organically in the Mempool modules. This puts some order. Downstream clients should use `Ouroboros.Consensus.Mempool`.

There are deprecation warnings in place for downstream consumers.

The new structure of modules is the following (leaving aside the deprecated modules):
![image](https://user-images.githubusercontent.com/9791461/216326829-920f001d-b156-42df-b420-b95c209a865d.png)



4350: Add CI check for consistency on the Consensus changelog management r=Jasagredo a=Jasagredo

# Description

This CI check ensures that the management of the consensus versions and changelogs is consistent with the [release process](./ouroboros-consensus/docs/RealeaseProcess.md).



Co-authored-by: Javier Sagredo <javier.sagredo@iohk.io>
  • Loading branch information
iohk-bors[bot] and jasagredo committed Feb 8, 2023
3 parents 3588800 + 4d61388 + 143b551 commit 5b1a4a4
Show file tree
Hide file tree
Showing 53 changed files with 1,686 additions and 1,347 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/consensus-changelog-consistency.yml
@@ -0,0 +1,19 @@
name: Consensus changelog sanity check

on:
push:

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
shell: bash

steps:

- uses: actions/checkout@v3

- name: "Check changelog consistency"
run: ./scripts/ci/check-consensus-release.sh
Expand Up @@ -46,7 +46,7 @@ import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Config
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Dual
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Protocol.PBFT

import Ouroboros.Consensus.Byron.Crypto.DSIGN
Expand Down Expand Up @@ -230,7 +230,7 @@ forgeDualByronBlock cfg curBlockNo curSlotNo tickedLedger vtxs isLeader =
main :: ByronBlock
main = forgeByronBlock
(dualTopLevelConfigMain cfg)
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)
(Mempool.mkOverrides Mempool.noOverridesMeasure)
curBlockNo
curSlotNo
(tickedDualLedgerStateMain tickedLedger)
Expand Down
Expand Up @@ -38,7 +38,8 @@ import Ouroboros.Consensus.Config
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Dual
import Ouroboros.Consensus.Ledger.Extended
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool

import Ouroboros.Consensus.Node.InitStorage
import Ouroboros.Consensus.Node.ProtocolInfo
import Ouroboros.Consensus.Node.Run
Expand Down Expand Up @@ -77,7 +78,7 @@ dualByronBlockForging creds = BlockForging {
where
BlockForging {..} =
byronBlockForging
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)
(Mempool.mkOverrides Mempool.noOverridesMeasure)
creds

{-------------------------------------------------------------------------------
Expand Down
Expand Up @@ -37,7 +37,7 @@ import Ouroboros.Consensus.Config
import Ouroboros.Consensus.HeaderValidation
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Extended
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.NodeId
import Ouroboros.Consensus.Protocol.Abstract
import Ouroboros.Consensus.Protocol.PBFT
Expand Down Expand Up @@ -125,7 +125,7 @@ exampleBlock :: ByronBlock
exampleBlock =
forgeRegularBlock
cfg
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)
(Mempool.mkOverrides Mempool.noOverridesMeasure)
(BlockNo 1)
(SlotNo 1)
(applyChainTick ledgerConfig (SlotNo 1) ledgerStateAfterEBB)
Expand Down
Expand Up @@ -21,7 +21,7 @@ import qualified Cardano.Chain.Genesis as Genesis
import qualified Cardano.Chain.Update as Update
import qualified Cardano.Crypto as Crypto

import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Node.ProtocolInfo (ProtocolInfo (..))
import Ouroboros.Consensus.NodeId (CoreNodeId (..))
import Ouroboros.Consensus.Protocol.PBFT
Expand Down Expand Up @@ -63,7 +63,7 @@ mkProtocolByron params coreNodeId genesisConfig genesisSecrets =
, byronProtocolVersion = theProposedProtocolVersion
, byronSoftwareVersion = theProposedSoftwareVersion
, byronLeaderCredentials = Just leaderCredentials
, byronMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, byronMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}

mkLeaderCredentials
Expand Down
Expand Up @@ -22,7 +22,7 @@ import qualified Cardano.Chain.Block as CC.Block
import qualified Cardano.Chain.Update as CC.Update

import Ouroboros.Consensus.Config
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Node.ProtocolInfo
import Ouroboros.Consensus.Node.Serialisation ()
import Ouroboros.Consensus.Util (Dict (..))
Expand Down Expand Up @@ -109,7 +109,7 @@ testCfg = pInfoConfig protocolInfo
, byronProtocolVersion = CC.Update.ProtocolVersion 1 0 0
, byronSoftwareVersion = CC.Update.SoftwareVersion (CC.Update.ApplicationName "Cardano Test") 2
, byronLeaderCredentials = Nothing
, byronMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, byronMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}

-- | Matches the values used for the generators.
Expand Down
4 changes: 2 additions & 2 deletions ouroboros-consensus-byron-test/test/Test/ThreadNet/Byron.hs
Expand Up @@ -39,7 +39,7 @@ import qualified Ouroboros.Network.Mock.Chain as Chain
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.BlockchainTime
import Ouroboros.Consensus.Config
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Node.NetworkProtocolVersion
import Ouroboros.Consensus.Node.ProtocolInfo
import Ouroboros.Consensus.NodeId
Expand Down Expand Up @@ -1303,7 +1303,7 @@ mkRekeyUpd genesisConfig genesisSecrets cid pInfo eno newSK =
creds' = updSignKey genSK bcfg cid (coerce eno) newSK
blockForging' =
byronBlockForging
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)
(Mempool.mkOverrides Mempool.noOverridesMeasure)
creds'
pInfo' = pInfo { pInfoBlockForging = return [blockForging'] }

Expand Down
Expand Up @@ -38,7 +38,7 @@ import Ouroboros.Consensus.Config
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.SupportsMempool
(LedgerSupportsMempool (..), txForgetValidated)
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Protocol.PBFT

import Ouroboros.Consensus.Byron.Crypto.DSIGN
Expand All @@ -51,7 +51,7 @@ import Ouroboros.Consensus.Byron.Protocol
forgeByronBlock
:: HasCallStack
=> TopLevelConfig ByronBlock
-> TxLimits.Overrides ByronBlock -- ^ How to override max tx capacity
-> Mempool.TxOverrides ByronBlock -- ^ How to override max tx capacity
-- defined by ledger
-> BlockNo -- ^ Current block number
-> SlotNo -- ^ Current slot number
Expand Down Expand Up @@ -128,7 +128,7 @@ initBlockPayloads = BlockPayloads
forgeRegularBlock
:: HasCallStack
=> BlockConfig ByronBlock
-> TxLimits.Overrides ByronBlock -- ^ How to override max tx capacity
-> Mempool.TxOverrides ByronBlock -- ^ How to override max tx capacity
-- defined by ledger
-> BlockNo -- ^ Current block number
-> SlotNo -- ^ Current slot number
Expand Down
Expand Up @@ -78,7 +78,8 @@ import Ouroboros.Consensus.Byron.Ledger.Ledger
import Ouroboros.Consensus.Byron.Ledger.Orphans ()
import Ouroboros.Consensus.Byron.Ledger.Serialisation
(byronBlockEncodingOverhead)
import Ouroboros.Consensus.Mempool.TxLimits

import Ouroboros.Consensus.Mempool

{-------------------------------------------------------------------------------
TxLimits
Expand Down
Expand Up @@ -43,7 +43,7 @@ import Ouroboros.Consensus.Config.SupportsNode
import Ouroboros.Consensus.HeaderValidation
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.Extended
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Node.InitStorage
import Ouroboros.Consensus.Node.ProtocolInfo
import Ouroboros.Consensus.Node.Run
Expand Down Expand Up @@ -128,7 +128,7 @@ type instance ForgeStateUpdateError ByronBlock = Void

byronBlockForging
:: Monad m
=> TxLimits.Overrides ByronBlock
=> Mempool.TxOverrides ByronBlock
-> ByronLeaderCredentials
-> BlockForging m ByronBlock
byronBlockForging maxTxCapacityOverrides creds = BlockForging {
Expand Down Expand Up @@ -169,7 +169,7 @@ data ProtocolParamsByron = ProtocolParamsByron {
, byronProtocolVersion :: Update.ProtocolVersion
, byronSoftwareVersion :: Update.SoftwareVersion
, byronLeaderCredentials :: Maybe ByronLeaderCredentials
, byronMaxTxCapacityOverrides :: TxLimits.Overrides ByronBlock
, byronMaxTxCapacityOverrides :: Mempool.TxOverrides ByronBlock
}

protocolInfoByron ::
Expand Down
Expand Up @@ -49,8 +49,8 @@ import Ouroboros.Consensus.Ledger.SupportsProtocol
import qualified Cardano.Ledger.Era as SL
import qualified Cardano.Ledger.Shelley.API as SL

import Ouroboros.Consensus.Mempool.TxLimits (TxLimits)
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import Ouroboros.Consensus.Mempool (TxLimits)
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Protocol.TPraos
import Ouroboros.Consensus.Shelley.Eras
import Ouroboros.Consensus.Shelley.Ledger
Expand Down Expand Up @@ -269,7 +269,7 @@ protocolInfoShelleyBasedHardFork protocolParamsShelleyBased
protocolParamsShelleyBased
((), ()) -- trivial additional Genesis config and translation context
protVer1
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)
(Mempool.mkOverrides Mempool.noOverridesMeasure)

eraParams1 :: History.EraParams
eraParams1 = shelleyEraParams genesis1
Expand Down Expand Up @@ -302,7 +302,7 @@ protocolInfoShelleyBasedHardFork protocolParamsShelleyBased
}
(transCtxt2, transCtxt2)
protVer2
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)
(Mempool.mkOverrides Mempool.noOverridesMeasure)

eraParams2 :: History.EraParams
eraParams2 = shelleyEraParams genesis2
Expand Down
18 changes: 9 additions & 9 deletions ouroboros-consensus-cardano-test/test/Test/ThreadNet/Cardano.hs
Expand Up @@ -25,7 +25,7 @@ import Cardano.Slotting.Slot (EpochSize (..), SlotNo (..))
import Ouroboros.Consensus.BlockchainTime
import Ouroboros.Consensus.Config.SecurityParam
import Ouroboros.Consensus.Ledger.SupportsMempool (extractTxs)
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Node.NetworkProtocolVersion
import Ouroboros.Consensus.Node.ProtocolInfo
import Ouroboros.Consensus.NodeId
Expand Down Expand Up @@ -502,7 +502,7 @@ mkProtocolCardanoAndHardForkTxs
, byronProtocolVersion = propPV
, byronSoftwareVersion = softVerByron
, byronLeaderCredentials = Just leaderCredentialsByron
, byronMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, byronMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}
ProtocolParamsShelleyBased {
shelleyBasedGenesis = genesisShelley
Expand All @@ -511,27 +511,27 @@ mkProtocolCardanoAndHardForkTxs
}
ProtocolParamsShelley {
shelleyProtVer = SL.ProtVer shelleyMajorVersion 0
, shelleyMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, shelleyMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}
ProtocolParamsAllegra {
allegraProtVer = SL.ProtVer allegraMajorVersion 0
, allegraMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, allegraMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}
ProtocolParamsMary {
maryProtVer = SL.ProtVer maryMajorVersion 0
, maryMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, maryMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}
ProtocolParamsAlonzo {
alonzoProtVer = SL.ProtVer alonzoMajorVersion 0
, alonzoMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, alonzoMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}
ProtocolParamsBabbage {
babbageProtVer = SL.ProtVer babbageMajorVersion 0
, babbageMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
babbageProtVer = SL.ProtVer babbageMajorVersion 0
, babbageMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}
ProtocolParamsConway {
conwayProtVer = SL.ProtVer conwayMajorVersion 0
, conwayMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
, conwayMaxTxCapacityOverrides = Mempool.mkOverrides Mempool.noOverridesMeasure
}
protocolParamsByronShelley
ProtocolTransitionParamsShelleyBased {
Expand Down
Expand Up @@ -33,7 +33,7 @@ import Cardano.Crypto.ProtocolMagic (RequiresNetworkMagic)

import Ouroboros.Consensus.Cardano
import qualified Ouroboros.Consensus.Cardano as Consensus
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool

import Cardano.Api.Any
import Cardano.Api.KeysByron
Expand Down Expand Up @@ -92,7 +92,7 @@ mkSomeConsensusProtocolByron NodeByronProtocolConfiguration {
byronLeaderCredentials =
optionalLeaderCredentials,
byronMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}

readGenesis :: GenesisFile
Expand Down
Expand Up @@ -24,7 +24,7 @@ import qualified Ouroboros.Consensus.Cardano as Consensus
import qualified Ouroboros.Consensus.Cardano.CanHardFork as Consensus
import Ouroboros.Consensus.Cardano.Condense ()
import Ouroboros.Consensus.HardFork.Combinator.Condense ()
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import qualified Ouroboros.Consensus.Shelley.Node.Praos as Praos

import Cardano.Api.Any
Expand Down Expand Up @@ -164,7 +164,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
byronLeaderCredentials =
byronLeaderCredentials,
byronMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}
Consensus.ProtocolParamsShelleyBased {
shelleyBasedGenesis = shelleyGenesis,
Expand All @@ -180,7 +180,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
shelleyProtVer =
ProtVer 3 0,
shelleyMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}
Consensus.ProtocolParamsAllegra {
-- This is /not/ the Allegra protocol version. It is the protocol
Expand All @@ -190,7 +190,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
allegraProtVer =
ProtVer 4 0,
allegraMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}
Consensus.ProtocolParamsMary {
-- This is /not/ the Mary protocol version. It is the protocol
Expand All @@ -199,7 +199,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
-- /after/ Mary, i.e. Alonzo.
maryProtVer = ProtVer 5 0,
maryMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}
Consensus.ProtocolParamsAlonzo {
-- This is /not/ the Alonzo protocol version. It is the protocol
Expand All @@ -208,15 +208,15 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
-- /after/ Alonzo, i.e. Babbage.
alonzoProtVer = ProtVer 6 0,
alonzoMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}
Praos.ProtocolParamsBabbage {
-- This is /not/ the Babbage protocol version. It is the protocol
-- version that this node will declare that it understands, when it
-- is in the Babbage era.
Praos.babbageProtVer = ProtVer 7 0,
Praos.babbageMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}
Praos.ProtocolParamsConway {
-- This is /not/ the Conway protocol version. It is the protocol
Expand All @@ -227,7 +227,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
then ProtVer 9 0 -- Advertise we can support Conway
else ProtVer 8 0, -- Otherwise we only advertise we know about Babbage
Praos.conwayMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}
-- 'ProtocolTransitionParamsShelleyBased' specifies the parameters
-- needed to transition between two eras. The comments below also apply
Expand Down
Expand Up @@ -38,7 +38,7 @@ import Cardano.Ledger.Keys (coerceKeyRole)
import qualified Cardano.Ledger.Shelley.Genesis as Shelley

import qualified Ouroboros.Consensus.Cardano as Consensus
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Protocol.Praos.Common
(PraosCanBeLeader (..))
import Ouroboros.Consensus.Shelley.Eras (StandardShelley)
Expand Down Expand Up @@ -97,7 +97,7 @@ mkSomeConsensusProtocolShelley NodeShelleyProtocolConfiguration {
shelleyProtVer =
ProtVer 2 0,
shelleyMaxTxCapacityOverrides =
TxLimits.mkOverrides TxLimits.noOverridesMeasure
Mempool.mkOverrides Mempool.noOverridesMeasure
}

genesisHashToPraosNonce :: GenesisHash -> Nonce
Expand Down

0 comments on commit 5b1a4a4

Please sign in to comment.