Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
More fixes, still not compiling yet
  • Loading branch information
carbolymer committed Sep 24, 2025
commit 92081aa0b4442df8da2a22b4b58b4e05178e8dca
2 changes: 1 addition & 1 deletion cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ library
, generic-data
, hashable
, hostname
, io-classes >= 1.5
, io-classes:{io-classes,strict-stm,si-timers} >= 1.5
, iohk-monitoring ^>= 0.2
, microlens
, mmap
Expand Down
3 changes: 2 additions & 1 deletion cardano-node/src/Cardano/Node/Configuration/Logging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,15 @@ nodeBasicInfo nc (SomeConsensusProtocol whichP pForInfo) nodeStartTime' = do
in getGenesisValues "Shelley" cfgShelley
Api.CardanoBlockType ->
let CardanoLedgerConfig cfgByron cfgShelley cfgAllegra cfgMary cfgAlonzo
cfgBabbage cfgConway = Consensus.configLedger cfg
cfgBabbage cfgConway cfgDjikstra = Consensus.configLedger cfg
in getGenesisValuesByron cfg cfgByron
++ getGenesisValues "Shelley" cfgShelley
++ getGenesisValues "Allegra" cfgAllegra
++ getGenesisValues "Mary" cfgMary
++ getGenesisValues "Alonzo" cfgAlonzo
++ getGenesisValues "Babbage" cfgBabbage
++ getGenesisValues "Conway" cfgConway
++ getGenesisValues "Djikstra" cfgDjikstra
items = nub $
[ ("protocol", pack . show $ ncProtocol nc)
, ("version", pack . showVersion $ version)
Expand Down
1 change: 0 additions & 1 deletion cardano-node/src/Cardano/Node/Configuration/POM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ defaultPartialNodeConfiguration =
-- https://ouroboros-network.cardano.intersectmbo.org/ouroboros-network/cardano-diffusion/Cardano-Network-Diffusion-Configuration.html#v:defaultNumberOfBigLedgerPeers
, pncConsensusMode = Last (Just Ouroboros.defaultConsensusMode)
-- https://ouroboros-network.cardano.intersectmbo.org/ouroboros-network/Ouroboros-Network-Diffusion-Configuration.html#v:defaultConsensusMode
, pncEnableP2P = Last (Just EnabledP2PMode)
, pncPeerSharing = mempty
-- the default is defined in `makeNodeConfiguration`
, pncGenesisConfigFlags = Last (Just defaultGenesisConfigFlags)
Expand Down
66 changes: 37 additions & 29 deletions cardano-node/src/Cardano/Node/Queries.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ import qualified Cardano.Crypto.Hash as Crypto
import qualified Cardano.Crypto.Hashing as Byron.Crypto
import Cardano.Crypto.KES.Class (Period)
import Cardano.Ledger.BaseTypes (StrictMaybe (..), fromSMaybe)
import qualified Cardano.Ledger.Conway.State as Conway
import qualified Cardano.Ledger.Hashes as Ledger
import qualified Cardano.Ledger.Shelley.LedgerState as Shelley
import qualified Cardano.Ledger.State as Ledger
import qualified Cardano.Ledger.TxIn as Ledger
import qualified Cardano.Ledger.UMap as UM
import Cardano.Protocol.TPraos.OCert (KESPeriod (..))
Expand Down Expand Up @@ -241,7 +243,8 @@ instance LedgerQueries Byron.ByronBlock where
ledgerDRepCount _ = 0
ledgerDRepMapSize _ = 0

instance Shelley.EraCertState era => LedgerQueries (Shelley.ShelleyBlock protocol era) where
-- TODO should this be ConwayEraCertState constraint? Wouldn't this break queries for older eras?
instance Conway.ConwayEraCertState era => LedgerQueries (Shelley.ShelleyBlock protocol era) where
ledgerUtxoSize =
(\(Shelley.UTxO xs)-> Map.size xs)
. Shelley.utxosUtxo
Expand All @@ -252,24 +255,27 @@ instance Shelley.EraCertState era => LedgerQueries (Shelley.ShelleyBlock protoco
ledgerDelegMapSize =
UM.size
. UM.SPoolUView
. Shelley.dsUnified
. undefined -- TODO what should be here?
. (^. Conway.accountsMapL)
. Ledger.dsAccounts
. (^. Shelley.certDStateL)
. Shelley.lsCertState
. Shelley.esLState
. Shelley.nesEs
. Shelley.shelleyLedgerState
ledgerDRepCount =
Map.size
. Shelley.vsDReps
. (^. Shelley.certVStateL)
. Conway.vsDReps
. (^. Conway.certVStateL)
. Shelley.lsCertState
. Shelley.esLState
. Shelley.nesEs
. Shelley.shelleyLedgerState
ledgerDRepMapSize =
UM.size
. UM.DRepUView
. Shelley.dsUnified
. undefined -- TODO what should be here?
. Ledger.dsAccounts
. (^. Shelley.certDStateL)
. Shelley.lsCertState
. Shelley.esLState
Expand All @@ -283,38 +289,40 @@ instance (LedgerQueries x, NoHardForks x)
ledgerDRepCount = ledgerDRepCount . unFlip . project . Flip
ledgerDRepMapSize = ledgerDRepMapSize . unFlip . project . Flip

-- TODO those states make no sense, since required lenses got moved to Conway
-- TODO non-exhaustive pattern matches
instance LedgerQueries (Cardano.CardanoBlock c) where
ledgerUtxoSize = \case
Cardano.LedgerStateByron ledgerByron -> ledgerUtxoSize ledgerByron
Cardano.LedgerStateShelley ledgerShelley -> ledgerUtxoSize ledgerShelley
Cardano.LedgerStateAllegra ledgerAllegra -> ledgerUtxoSize ledgerAllegra
Cardano.LedgerStateMary ledgerMary -> ledgerUtxoSize ledgerMary
Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerUtxoSize ledgerAlonzo
Cardano.LedgerStateBabbage ledgerBabbage -> ledgerUtxoSize ledgerBabbage
-- Cardano.LedgerStateByron ledgerByron -> ledgerUtxoSize ledgerByron
-- Cardano.LedgerStateShelley ledgerShelley -> ledgerUtxoSize ledgerShelley
-- Cardano.LedgerStateAllegra ledgerAllegra -> ledgerUtxoSize ledgerAllegra
-- Cardano.LedgerStateMary ledgerMary -> ledgerUtxoSize ledgerMary
-- Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerUtxoSize ledgerAlonzo
-- Cardano.LedgerStateBabbage ledgerBabbage -> ledgerUtxoSize ledgerBabbage
Cardano.LedgerStateConway ledgerConway -> ledgerUtxoSize ledgerConway
ledgerDelegMapSize = \case
Cardano.LedgerStateByron ledgerByron -> ledgerDelegMapSize ledgerByron
Cardano.LedgerStateShelley ledgerShelley -> ledgerDelegMapSize ledgerShelley
Cardano.LedgerStateAllegra ledgerAllegra -> ledgerDelegMapSize ledgerAllegra
Cardano.LedgerStateMary ledgerMary -> ledgerDelegMapSize ledgerMary
Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerDelegMapSize ledgerAlonzo
Cardano.LedgerStateBabbage ledgerBabbage -> ledgerDelegMapSize ledgerBabbage
-- Cardano.LedgerStateByron ledgerByron -> ledgerDelegMapSize ledgerByron
-- Cardano.LedgerStateShelley ledgerShelley -> ledgerDelegMapSize ledgerShelley
-- Cardano.LedgerStateAllegra ledgerAllegra -> ledgerDelegMapSize ledgerAllegra
-- Cardano.LedgerStateMary ledgerMary -> ledgerDelegMapSize ledgerMary
-- Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerDelegMapSize ledgerAlonzo
-- Cardano.LedgerStateBabbage ledgerBabbage -> ledgerDelegMapSize ledgerBabbage
Cardano.LedgerStateConway ledgerConway -> ledgerDelegMapSize ledgerConway
ledgerDRepCount = \case
Cardano.LedgerStateByron ledgerByron -> ledgerDRepCount ledgerByron
Cardano.LedgerStateShelley ledgerShelley -> ledgerDRepCount ledgerShelley
Cardano.LedgerStateAllegra ledgerAllegra -> ledgerDRepCount ledgerAllegra
Cardano.LedgerStateMary ledgerMary -> ledgerDRepCount ledgerMary
Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerDRepCount ledgerAlonzo
Cardano.LedgerStateBabbage ledgerBabbage -> ledgerDRepCount ledgerBabbage
-- Cardano.LedgerStateByron ledgerByron -> ledgerDRepCount ledgerByron
-- Cardano.LedgerStateShelley ledgerShelley -> ledgerDRepCount ledgerShelley
-- Cardano.LedgerStateAllegra ledgerAllegra -> ledgerDRepCount ledgerAllegra
-- Cardano.LedgerStateMary ledgerMary -> ledgerDRepCount ledgerMary
-- Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerDRepCount ledgerAlonzo
-- Cardano.LedgerStateBabbage ledgerBabbage -> ledgerDRepCount ledgerBabbage
Cardano.LedgerStateConway ledgerConway -> ledgerDRepCount ledgerConway
ledgerDRepMapSize = \case
Cardano.LedgerStateByron ledgerByron -> ledgerDRepMapSize ledgerByron
Cardano.LedgerStateShelley ledgerShelley -> ledgerDRepMapSize ledgerShelley
Cardano.LedgerStateAllegra ledgerAllegra -> ledgerDRepMapSize ledgerAllegra
Cardano.LedgerStateMary ledgerMary -> ledgerDRepMapSize ledgerMary
Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerDRepMapSize ledgerAlonzo
Cardano.LedgerStateBabbage ledgerBabbage -> ledgerDRepMapSize ledgerBabbage
-- Cardano.LedgerStateByron ledgerByron -> ledgerDRepMapSize ledgerByron
-- Cardano.LedgerStateShelley ledgerShelley -> ledgerDRepMapSize ledgerShelley
-- Cardano.LedgerStateAllegra ledgerAllegra -> ledgerDRepMapSize ledgerAllegra
-- Cardano.LedgerStateMary ledgerMary -> ledgerDRepMapSize ledgerMary
-- Cardano.LedgerStateAlonzo ledgerAlonzo -> ledgerDRepMapSize ledgerAlonzo
-- Cardano.LedgerStateBabbage ledgerBabbage -> ledgerDRepMapSize ledgerBabbage
Cardano.LedgerStateConway ledgerConway -> ledgerDRepMapSize ledgerConway

--
Expand Down
9 changes: 0 additions & 9 deletions cardano-node/src/Cardano/Node/Tracing/Era/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..),
import Ouroboros.Consensus.Byron.Ledger.Inspect (ByronLedgerUpdate (..),
ProtocolUpdate (..), UpdateState (..))
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, txId)
import Ouroboros.Consensus.Protocol.PBFT (PBftSelectView (..))
import Ouroboros.Consensus.Util.Condense (condense)
import Ouroboros.Network.Block (blockHash, blockNo, blockSlot)

Expand Down Expand Up @@ -212,11 +211,3 @@ instance LogFormatting ByronOtherHeaderEnvelopeError where
[ "kind" .= String "UnexpectedEBBInSlot"
, "slot" .= slot
]

instance LogFormatting PBftSelectView where
forMachine _dtal (PBftSelectView blkNo isEBB) =
mconcat
[ "kind" .= String "PBftSelectView"
, "blockNo" .= blkNo
, "isEBB" .= fromIsEBB isEBB
]
24 changes: 2 additions & 22 deletions cardano-node/src/Cardano/Node/Tracing/Era/HardFork.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Ouroboros.Consensus.HardFork.Combinator
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras (EraMismatch (..),
OneEraCannotForge (..), OneEraEnvelopeErr (..), OneEraForgeStateInfo (..),
OneEraForgeStateUpdateError (..), OneEraLedgerError (..),
OneEraLedgerUpdate (..), OneEraLedgerWarning (..), OneEraSelectView (..),
OneEraLedgerUpdate (..), OneEraLedgerWarning (..),
OneEraValidationErr (..), mkEraMismatch)
import Ouroboros.Consensus.HardFork.Combinator.Condense ()
import Ouroboros.Consensus.HardFork.History
Expand All @@ -36,7 +36,7 @@ import Ouroboros.Consensus.HeaderValidation (OtherHeaderEnvelopeError)
import Ouroboros.Consensus.Ledger.Abstract (LedgerError)
import Ouroboros.Consensus.Ledger.Inspect (LedgerUpdate, LedgerWarning)
import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr)
import Ouroboros.Consensus.Protocol.Abstract (SelectView, ValidationErr)
import Ouroboros.Consensus.Protocol.Abstract (ValidationErr)
import Ouroboros.Consensus.TypeFamilyWrappers
import Ouroboros.Consensus.Util.Condense (Condense (..))

Expand Down Expand Up @@ -345,23 +345,3 @@ instance All (LogFormatting `Compose` WrapForgeStateUpdateError) xs => LogFormat
instance LogFormatting (ForgeStateUpdateError blk) => LogFormatting (WrapForgeStateUpdateError blk) where
forMachine dtal = forMachine dtal . unwrapForgeStateUpdateError

--
-- instances for HardForkSelectView
--

instance All (LogFormatting `Compose` WrapSelectView) xs => LogFormatting (HardForkSelectView xs) where
-- elide BlockNo as it is already contained in every per-era SelectView
-- TODO: use level DMinimal for a textual representation without the block number,
-- like this: `forMachine DMinimal . getHardForkSelectView`, and update the different SelectView instances
-- to not print the blockNr
forMachine dtal = forMachine dtal . dropBlockNo . getHardForkSelectView

instance All (LogFormatting `Compose` WrapSelectView) xs => LogFormatting (OneEraSelectView xs) where
forMachine dtal =
hcollapse
. hcmap (Proxy @(LogFormatting `Compose` WrapSelectView))
(K . forMachine dtal)
. getOneEraSelectView

instance LogFormatting (SelectView (BlockProtocol blk)) => LogFormatting (WrapSelectView blk) where
forMachine dtal = forMachine dtal . unwrapSelectView
38 changes: 7 additions & 31 deletions cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import qualified Cardano.Api as Api
import Cardano.Api.Ledger (fromVRFVerKeyHash)

import qualified Cardano.Crypto.Hash.Class as Crypto
import qualified Cardano.Crypto.VRF.Class as Crypto
import Cardano.Ledger.Allegra.Rules (AllegraUtxoPredFailure)
import qualified Cardano.Ledger.Allegra.Rules as Allegra
import qualified Cardano.Ledger.Allegra.Scripts as Allegra
Expand Down Expand Up @@ -59,7 +58,6 @@ import Cardano.Tracing.OrphanInstances.Shelley ()
import Ouroboros.Consensus.Ledger.SupportsMempool (txId)
import qualified Ouroboros.Consensus.Ledger.SupportsMempool as SupportsMempool
import qualified Ouroboros.Consensus.Protocol.Praos as Praos
import Ouroboros.Consensus.Protocol.Praos.Common (PraosChainSelectView (..))
import Ouroboros.Consensus.Protocol.TPraos (TPraosCannotForge (..))
import Ouroboros.Consensus.Shelley.Ledger hiding (TxId)
import qualified Ouroboros.Consensus.Shelley.Ledger as Consensus
Expand All @@ -70,12 +68,10 @@ import Ouroboros.Network.Block (SlotNo (..), blockHash, blockNo, block
import Ouroboros.Network.Point (WithOrigin, withOriginToMaybe)

import Data.Aeson (ToJSON (..), Value (..), (.=))
import qualified Data.ByteString.Base16 as B16
import qualified Data.List.NonEmpty as NonEmpty
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Text (Text)
import qualified Data.Text.Encoding as Text

{- HLINT ignore "Use :" -}

Expand Down Expand Up @@ -361,10 +357,6 @@ instance
, "fromTxBody" .= renderScriptIntegrityHash (strictMaybeToMaybe mismatchSupplied)
, "fromPParams" .= renderScriptIntegrityHash (strictMaybeToMaybe mismatchExpected)
]
forMachine _ (MissingRequiredSigners missingKeyWitnesses) =
mconcat [ "kind" .= String "MissingRequiredSigners"
, "witnesses" .= Set.toList missingKeyWitnesses
]
forMachine _ (UnspendableUTxONoDatumHash txins) =
mconcat [ "kind" .= String "MissingRequiredSigners"
, "txins" .= Set.toList txins
Expand Down Expand Up @@ -596,7 +588,7 @@ instance
]
forMachine _dtal (WithdrawalsNotInRewardsDELEGS incorrectWithdrawals) =
mconcat [ "kind" .= String "WithdrawalsNotInRewardsCERTS"
, "incorrectWithdrawals" .= incorrectWithdrawals
, "incorrectWithdrawals" .= unWithdrawals incorrectWithdrawals
]
forMachine dtal (DelplFailure f) = forMachine dtal f

Expand Down Expand Up @@ -740,9 +732,6 @@ instance
) => LogFormatting (ShelleyNewEpochPredFailure era) where
forMachine dtal (EpochFailure f) = forMachine dtal f
forMachine dtal (MirFailure f) = forMachine dtal f
forMachine _dtal (CorruptRewardUpdate update) =
mconcat [ "kind" .= String "CorruptRewardUpdate"
, "update" .= String (textShow update) ]


instance
Expand Down Expand Up @@ -1187,13 +1176,18 @@ instance
, "invalidAccounts" .= accounts
]

forMachine _ (Conway.UnelectedCommitteeVoters voters) =
mconcat [ "kind" .= String "UnelectedCommitteeVoters"
, "unelectedCommitteeVoters" .= voters
]

instance
( Consensus.ShelleyBasedEra era
, LogFormatting (PredicateFailure (Ledger.EraRule "CERT" era))
) => LogFormatting (Conway.ConwayCertsPredFailure era) where
forMachine _ (Conway.WithdrawalsNotInRewardsCERTS rs) =
mconcat [ "kind" .= String "WithdrawalsNotInRewardsCERTS"
, "rewardAccounts" .= rs
, "rewardAccounts" .= unWithdrawals rs
]
forMachine dtal (Conway.CertFailure certFailure) =
forMachine dtal certFailure
Expand Down Expand Up @@ -1292,24 +1286,6 @@ instance LogFormatting Praos.PraosEnvelopeError where
, "blockSize" .= blockSize
]

instance Ledger.Crypto c => LogFormatting (PraosChainSelectView c) where
forMachine _ PraosChainSelectView {
csvChainLength
, csvSlotNo
, csvIssuer
, csvIssueNo
, csvTieBreakVRF
} =
mconcat [ "kind" .= String "PraosChainSelectView"
, "chainLength" .= csvChainLength
, "slotNo" .= csvSlotNo
, "issuerHash" .= hashKey csvIssuer
, "issueNo" .= csvIssueNo
, "tieBreakVRF" .= renderVRF csvTieBreakVRF
]
where
renderVRF = Text.decodeUtf8 . B16.encode . Crypto.getOutputVRFBytes

instance
( ToJSON (Alonzo.CollectError ledgerera)
) => LogFormatting (Conway.ConwayUtxosPredFailure ledgerera) where
Expand Down
10 changes: 0 additions & 10 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ import Cardano.Tracing.OrphanInstances.Common
import Cardano.Tracing.OrphanInstances.Consensus ()
import Cardano.Tracing.Render (renderTxId)
import Ouroboros.Consensus.Block (Header)
import Ouroboros.Consensus.Block.EBB (fromIsEBB)
import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..), ByronNodeToClientVersion (..),
ByronNodeToNodeVersion (..), ByronOtherHeaderEnvelopeError (..), TxId (..),
byronHeaderRaw)
import Ouroboros.Consensus.Byron.Ledger.Inspect (ByronLedgerUpdate (..),
ProtocolUpdate (..), UpdateState (..))
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, txId)
import Ouroboros.Consensus.Protocol.PBFT (PBftSelectView (..))
import Ouroboros.Consensus.Util.Condense (condense)
import Ouroboros.Network.Block (blockHash, blockNo, blockSlot)

Expand Down Expand Up @@ -220,11 +218,3 @@ instance ToJSON ByronNodeToClientVersion where
instance ToJSON ByronNodeToNodeVersion where
toJSON ByronNodeToNodeVersion1 = String "ByronNodeToNodeVersion1"
toJSON ByronNodeToNodeVersion2 = String "ByronNodeToNodeVersion2"

instance ToObject PBftSelectView where
toObject _verb (PBftSelectView blkNo isEBB) =
mconcat
[ "kind" .= String "PBftSelectView"
, "blockNo" .= blkNo
, "isEBB" .= fromIsEBB isEBB
]
Loading