Skip to content

Commit

Permalink
Merge pull request #687 from IntersectMBO/neilmayhew/release-srp
Browse files Browse the repository at this point in the history
Integrate in preparation for `cardano-node` release `10.2.0`
  • Loading branch information
carbolymer authored Jan 10, 2025
2 parents 6717893 + f93b1cf commit 9386533
Show file tree
Hide file tree
Showing 21 changed files with 119 additions and 99 deletions.
5 changes: 2 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repository cardano-haskell-packages
-- See CONTRIBUTING for information about these, including some Nix commands
-- you need to run if you change them
index-state:
, hackage.haskell.org 2024-10-10T08:11:33Z
, cardano-haskell-packages 2024-10-14T23:19:53Z
, hackage.haskell.org 2024-12-24T12:56:48Z
, cardano-haskell-packages 2025-01-08T16:35:32Z

packages:
cardano-api
Expand Down Expand Up @@ -54,4 +54,3 @@ semaphore: True

constraints:
Cabal < 3.14,
cardano-ledger-shelley ^>= 1.14.1
2 changes: 1 addition & 1 deletion cardano-api-gen/cardano-api-gen.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license-files:
NOTICE

build-type: Simple
extra-source-files:
extra-doc-files:
CHANGELOG.md
README.md

Expand Down
28 changes: 15 additions & 13 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ library internal
cardano-data >=1.0,
cardano-ledger-allegra >=1.6,
cardano-ledger-alonzo >=1.10.2,
cardano-ledger-api ^>=1.9.3,
cardano-ledger-api >=1.9.3,
cardano-ledger-babbage >=1.9,
cardano-ledger-binary >=1.3,
cardano-ledger-byron >=1.0.1,
Expand Down Expand Up @@ -202,16 +202,17 @@ library internal
microlens-aeson,
mtl,
network,
ouroboros-consensus ^>=0.21,
ouroboros-consensus-cardano ^>=0.20,
ouroboros-consensus-diffusion ^>=0.18,
ouroboros-consensus-protocol ^>=0.9.0.2,
network-mux,
ouroboros-consensus ^>=0.22,
ouroboros-consensus-cardano ^>=0.21,
ouroboros-consensus-diffusion ^>=0.19,
ouroboros-consensus-protocol ^>=0.10,
ouroboros-network,
ouroboros-network-api ^>=0.10,
ouroboros-network-api ^>=0.12,
ouroboros-network-framework,
ouroboros-network-protocols,
parsec,
plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>=1.36,
plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>=1.38,
prettyprinter,
prettyprinter-ansi-terminal,
prettyprinter-configurable ^>=1.36,
Expand All @@ -226,7 +227,7 @@ library internal
time,
transformers,
transformers-except ^>=0.1.3,
typed-protocols ^>=0.1.1,
typed-protocols ^>=0.3,
vector,
yaml,

Expand Down Expand Up @@ -261,8 +262,9 @@ library
deepseq,
memory,
nothunks,
ouroboros-network,
ouroboros-network-protocols,
typed-protocols ^>=0.1.1,
typed-protocols,

library gen
import: project-config
Expand Down Expand Up @@ -324,7 +326,7 @@ test-suite cardano-api-test
cardano-crypto-test ^>=1.5,
cardano-crypto-tests ^>=2.1,
cardano-ledger-alonzo,
cardano-ledger-api ^>=1.9,
cardano-ledger-api >=1.9,
cardano-ledger-binary,
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14,
cardano-ledger-mary,
Expand Down Expand Up @@ -395,7 +397,7 @@ test-suite cardano-api-golden
cardano-crypto-class ^>=2.1.2,
cardano-data >=1.0,
cardano-ledger-alonzo,
cardano-ledger-api ^>=1.9,
cardano-ledger-api >=1.9,
cardano-ledger-babbage >=1.9,
cardano-ledger-binary,
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14,
Expand All @@ -406,10 +408,10 @@ test-suite cardano-api-golden
errors,
filepath,
hedgehog >=1.1,
hedgehog-extras ^>=0.6.1.0,
hedgehog-extras ^>=0.7,
microlens,
parsec,
plutus-core ^>=1.36,
plutus-core ^>=1.38,
plutus-ledger-api,
tasty,
tasty-hedgehog,
Expand Down
4 changes: 2 additions & 2 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ genProtocolParameters era = do
protocolParamStakePoolDeposit <- genLovelace
protocolParamMinPoolCost <- genLovelace
protocolParamPoolRetireMaxEpoch <- genEpochInterval
protocolParamStakePoolTargetNum <- genNat
protocolParamStakePoolTargetNum <- genWord16
protocolParamPoolPledgeInfluence <- genRationalInt64
protocolParamMonetaryExpansion <- genRational
protocolParamTreasuryCut <- genRational
Expand Down Expand Up @@ -1042,7 +1042,7 @@ genProtocolParametersUpdate era = do
protocolUpdateStakePoolDeposit <- Gen.maybe genLovelace
protocolUpdateMinPoolCost <- Gen.maybe genLovelace
protocolUpdatePoolRetireMaxEpoch <- Gen.maybe genEpochInterval
protocolUpdateStakePoolTargetNum <- Gen.maybe genNat
protocolUpdateStakePoolTargetNum <- Gen.maybe genWord16
protocolUpdatePoolPledgeInfluence <- Gen.maybe genRationalInt64
protocolUpdateMonetaryExpansion <- Gen.maybe genRational
protocolUpdateTreasuryCut <- Gen.maybe genRational
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/internal/Cardano/Api/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import qualified Cardano.Crypto.Hash.Class as Crypto
import qualified Cardano.Crypto.Hashing
import qualified Cardano.Ledger.Api as L
import qualified Cardano.Ledger.Block as Ledger
import qualified Cardano.Ledger.Era as Ledger
import qualified Cardano.Ledger.Core as Ledger
import Cardano.Slotting.Block (BlockNo)
import Cardano.Slotting.Slot (EpochNo, SlotNo, WithOrigin (..))
import qualified Ouroboros.Consensus.Block as Consensus
Expand Down
8 changes: 4 additions & 4 deletions cardano-api/internal/Cardano/Api/Certificate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ makeStakePoolRetirementCertificate req =
ConwayCertificate atMostBab $
Ledger.mkRetirePoolTxCert (unStakePoolKeyHash poolId) retirementEpoch

data GenesisKeyDelegationRequirements ere where
data GenesisKeyDelegationRequirements era where
GenesisKeyDelegationRequirements
:: ShelleyToBabbageEra era
-> Hash GenesisKey
Expand All @@ -381,7 +381,7 @@ makeGenesisKeyDelegationCertificate
ShelleyRelatedCertificate atMostEra $
shelleyToBabbageEraConstraints atMostEra $
Ledger.ShelleyTxCertGenesisDeleg $
Ledger.GenesisDelegCert hGenKey hGenDelegKey hVrfKey
Ledger.GenesisDelegCert hGenKey hGenDelegKey (Ledger.toVRFVerKeyHash hVrfKey)

data MirCertificateRequirements era where
MirCertificateRequirements
Expand Down Expand Up @@ -613,7 +613,7 @@ toShelleyPoolParams
-- do simple client-side sanity checks, e.g. on the pool metadata url
Ledger.PoolParams
{ Ledger.ppId = poolkh
, Ledger.ppVrf = vrfkh
, Ledger.ppVrf = Ledger.toVRFVerKeyHash vrfkh
, Ledger.ppPledge = stakePoolPledge
, Ledger.ppCost = stakePoolCost
, Ledger.ppMargin =
Expand Down Expand Up @@ -685,7 +685,7 @@ fromShelleyPoolParams
} =
StakePoolParameters
{ stakePoolId = StakePoolKeyHash ppId
, stakePoolVRF = VrfKeyHash ppVrf
, stakePoolVRF = VrfKeyHash (Ledger.fromVRFVerKeyHash ppVrf)
, stakePoolCost = ppCost
, stakePoolMargin = Ledger.unboundRational ppMargin
, stakePoolRewardAccount = fromShelleyStakeAddr ppRewardAccount
Expand Down
27 changes: 17 additions & 10 deletions cardano-api/internal/Cardano/Api/IPC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx

import Control.Concurrent.STM (TMVar, atomically, newEmptyTMVarIO, putTMVar, takeTMVar,
tryPutTMVar)
import Control.Exception (throwIO)
import Control.Monad (void)
import Control.Monad.IO.Class
import Control.Tracer (nullTracer)
import Data.Aeson (ToJSON, object, toJSON, (.=))
import qualified Data.ByteString.Lazy as LBS
import Data.Void (Void)
import GHC.Exts (IsList (..))
import qualified Network.Mux as Net

-- ----------------------------------------------------------------------------
-- The types for the client side of the node-to-client IPC protocols
Expand Down Expand Up @@ -202,15 +204,19 @@ connectToLocalNodeWithVersion
, localConsensusModeParams
}
clients =
liftIO $ Net.withIOManager $ \iomgr ->
Net.connectTo
(Net.localSnocket iomgr)
Net.NetworkConnectTracers
{ Net.nctMuxTracer = nullTracer
, Net.nctHandshakeTracer = nullTracer
}
versionedProtocls
(unFile localNodeSocketPath)
liftIO $ Net.withIOManager $ \iomgr -> do
r <-
Net.connectTo
(Net.localSnocket iomgr)
Net.NetworkConnectTracers
{ Net.nctMuxTracer = nullTracer
, Net.nctHandshakeTracer = nullTracer
}
versionedProtocls
(unFile localNodeSocketPath)
case r of
Left e -> throwIO e
Right _ -> pure ()
where
versionedProtocls =
-- First convert from the mode-parametrised view of things to the
Expand Down Expand Up @@ -302,10 +308,11 @@ mkVersionedProtocols networkid ptcl unversionedClients =
)
, localStateQueryProtocol =
Net.InitiatorProtocolOnly $
Net.mkMiniProtocolCbFromPeer $
Net.mkMiniProtocolCbFromPeerSt $
const
( nullTracer
, cStateQueryCodec
, Net.Query.StateIdle
, maybe
Net.localStateQueryPeerNull
Net.Query.localStateQueryClientPeer
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/internal/Cardano/Api/Keys/Praos.hs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ instance Key VrfKey where

verificationKeyHash :: VerificationKey VrfKey -> Hash VrfKey
verificationKeyHash (VrfVerificationKey vkey) =
VrfKeyHash (Shelley.hashVerKeyVRF vkey)
VrfKeyHash (Crypto.hashVerKeyVRF vkey)

instance SerialiseAsRawBytes (VerificationKey VrfKey) where
serialiseToRawBytes (VrfVerificationKey vk) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ toLedgerEventConway evt =
case govEvent of
Conway.GovNewProposals txid props ->
Just $ NewGovernanceProposals txid (AnyProposals props)
Conway.GovRemovedVotes txid replacedVotes unregisteredDReps ->
Just $ RemovedGovernanceVotes txid replacedVotes unregisteredDReps

instance ConvertLedgerEvent (HardForkBlock (Consensus.CardanoEras StandardCrypto)) where
toLedgerEvent wrappedLedgerEvent =
Expand Down
7 changes: 7 additions & 0 deletions cardano-api/internal/Cardano/Api/LedgerEvents/LedgerEvent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ data LedgerEvent

-- | Newly submittted governance proposals in a single transaction.
NewGovernanceProposals (Ledger.TxId StandardCrypto) AnyProposals
| -- | Governance votes that were invalidated.
RemovedGovernanceVotes
(Ledger.TxId StandardCrypto)
(Set (Ledger.Voter StandardCrypto, Ledger.GovActionId StandardCrypto))
-- ^ Votes that were replaced in this tx.
(Set (Ledger.Credential 'Ledger.DRepRole StandardCrypto))
-- ^ Any votes from these DReps in this or in previous txs are removed
| -- | The current state of governance matters at the epoch boundary.
-- I.E the current constitution, committee, protocol parameters, etc.
EpochBoundaryRatificationState AnyRatificationState
Expand Down
44 changes: 22 additions & 22 deletions cardano-api/internal/Cardano/Api/LedgerState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ import Ouroboros.Consensus.Storage.Serialisation
import Ouroboros.Consensus.TypeFamilyWrappers (WrapLedgerEvent (WrapLedgerEvent))
import Ouroboros.Network.Block (blockNo)
import qualified Ouroboros.Network.Block
import Ouroboros.Network.Mux (MuxError)
import qualified Ouroboros.Network.Protocol.ChainSync.Client as CS
import qualified Ouroboros.Network.Protocol.ChainSync.ClientPipelined as CSP
import Ouroboros.Network.Protocol.ChainSync.PipelineDecision
Expand Down Expand Up @@ -220,7 +219,8 @@ import qualified Data.Yaml as Yaml
import Formatting.Buildable (build)
import GHC.Exts (IsList (..))
import Lens.Micro
import Network.TypedProtocol.Pipelined (Nat (..))
import qualified Network.Mux as Mux
import Network.TypedProtocol.Core (Nat (..))
import System.FilePath

data InitialLedgerStateError
Expand Down Expand Up @@ -374,7 +374,7 @@ data FoldBlocksError
= FoldBlocksInitialLedgerStateError !InitialLedgerStateError
| FoldBlocksApplyBlockError !LedgerStateError
| FoldBlocksIOException !IOException
| FoldBlocksMuxError !MuxError
| FoldBlocksMuxError !Mux.Error
deriving Show

instance Error FoldBlocksError where
Expand Down Expand Up @@ -1097,45 +1097,45 @@ instance FromJSON NodeConfig where
<*> parseBabbageHardForkEpoch o
<*> parseConwayHardForkEpoch o

parseShelleyHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork
parseShelleyHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk)
parseShelleyHardForkEpoch o =
asum
[ Consensus.TriggerHardForkAtEpoch <$> o .: "TestShelleyHardForkAtEpoch"
, pure $ Consensus.TriggerHardForkAtVersion 2 -- Mainnet default
[ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestShelleyHardForkAtEpoch"
, pure Consensus.CardanoTriggerHardForkAtDefaultVersion
]

parseAllegraHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork
parseAllegraHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk)
parseAllegraHardForkEpoch o =
asum
[ Consensus.TriggerHardForkAtEpoch <$> o .: "TestAllegraHardForkAtEpoch"
, pure $ Consensus.TriggerHardForkAtVersion 3 -- Mainnet default
[ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestAllegraHardForkAtEpoch"
, pure Consensus.CardanoTriggerHardForkAtDefaultVersion
]

parseMaryHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork
parseMaryHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk)
parseMaryHardForkEpoch o =
asum
[ Consensus.TriggerHardForkAtEpoch <$> o .: "TestMaryHardForkAtEpoch"
, pure $ Consensus.TriggerHardForkAtVersion 4 -- Mainnet default
[ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestMaryHardForkAtEpoch"
, pure Consensus.CardanoTriggerHardForkAtDefaultVersion
]

parseAlonzoHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork
parseAlonzoHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk)
parseAlonzoHardForkEpoch o =
asum
[ Consensus.TriggerHardForkAtEpoch <$> o .: "TestAlonzoHardForkAtEpoch"
, pure $ Consensus.TriggerHardForkAtVersion 5 -- Mainnet default
[ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestAlonzoHardForkAtEpoch"
, pure Consensus.CardanoTriggerHardForkAtDefaultVersion
]
parseBabbageHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork
parseBabbageHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk)
parseBabbageHardForkEpoch o =
asum
[ Consensus.TriggerHardForkAtEpoch <$> o .: "TestBabbageHardForkAtEpoch"
, pure $ Consensus.TriggerHardForkAtVersion 7 -- Mainnet default
[ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestBabbageHardForkAtEpoch"
, pure Consensus.CardanoTriggerHardForkAtDefaultVersion
]

parseConwayHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork
parseConwayHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk)
parseConwayHardForkEpoch o =
asum
[ Consensus.TriggerHardForkAtEpoch <$> o .: "TestConwayHardForkAtEpoch"
, pure $ Consensus.TriggerHardForkAtVersion 9 -- Mainnet default
[ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestConwayHardForkAtEpoch"
, pure Consensus.CardanoTriggerHardForkAtDefaultVersion
]

----------------------------------------------------------------------
Expand Down Expand Up @@ -2291,6 +2291,6 @@ toLedgerIndividualPoolStake :: Consensus.IndividualPoolStake c -> SL.IndividualP
toLedgerIndividualPoolStake ips =
SL.IndividualPoolStake
{ SL.individualPoolStake = Consensus.individualPoolStake ips
, SL.individualPoolStakeVrf = Consensus.individualPoolStakeVrf ips
, SL.individualPoolStakeVrf = SL.toVRFVerKeyHash $ Consensus.individualPoolStakeVrf ips
, SL.individualTotalPoolStake = SL.CompactCoin 0
}
4 changes: 2 additions & 2 deletions cardano-api/internal/Cardano/Api/Orphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ import qualified Ouroboros.Consensus.Shelley.Eras as Consensus
import Ouroboros.Consensus.Shelley.Ledger.Block (ShelleyHash (..))
import qualified Ouroboros.Consensus.Shelley.Ledger.Query as Consensus
import Ouroboros.Network.Block (HeaderHash, Tip (..))
import Ouroboros.Network.Mux (MuxError)
import qualified PlutusLedgerApi.Common as P
import qualified PlutusLedgerApi.V2 as V2

Expand All @@ -98,6 +97,7 @@ import GHC.Generics
import GHC.Stack (HasCallStack)
import GHC.TypeLits
import Lens.Micro
import qualified Network.Mux as Mux

deriving instance Generic (L.ApplyTxError era)

Expand Down Expand Up @@ -558,7 +558,7 @@ instance Semigroup (Ledger.ConwayPParams StrictMaybe era) where
lastMappendWithTHKD :: (a -> Ledger.THKD g StrictMaybe b) -> a -> a -> Ledger.THKD g StrictMaybe b
lastMappendWithTHKD f a b = Ledger.THKD $ lastMappendWith (Ledger.unTHKD . f) a b

instance Pretty MuxError where
instance Pretty Mux.Error where
pretty err = "Mux layer error:" <+> prettyException err

instance A.FromJSON V2.ParamName where
Expand Down
Loading

0 comments on commit 9386533

Please sign in to comment.