Skip to content

Commit

Permalink
Merge pull request #5516 from input-output-hk/td/8.6
Browse files Browse the repository at this point in the history
Integrate latest ledger, consensus, api and cli for 8.6.0
  • Loading branch information
teodanciu authored Nov 1, 2023
2 parents 35b427b + 56db275 commit 735e6c9
Show file tree
Hide file tree
Showing 31 changed files with 240 additions and 105 deletions.
4 changes: 2 additions & 2 deletions bench/plutus-scripts-bench/plutus-scripts-bench.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: plutus-scripts-bench
version: 1.0.0.4
version: 1.0.0.5
synopsis: Plutus scripts used for benchmarking
description: Plutus scripts used for benchmarking.
category: Cardano,
Expand Down Expand Up @@ -72,7 +72,7 @@ library
-- IOG dependencies
--------------------------
build-depends:
, cardano-api ^>= 8.25
, cardano-api ^>= 8.29
, plutus-ledger-api >=1.0.0
, plutus-tx >=1.0.0
, plutus-tx-plugin >=1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,20 @@ metadataSize :: forall era . IsShelleyBasedEra era => AsType era -> Maybe TxMeta
metadataSize p m = dummyTxSize p m - dummyTxSize p Nothing

dummyTxSizeInEra :: forall era . IsShelleyBasedEra era => TxMetadataInEra era -> Int
dummyTxSizeInEra metadata = case createAndValidateTransactionBody dummyTx of
dummyTxSizeInEra metadata = case createAndValidateTransactionBody (cardanoEra @era) dummyTx of
Right b -> BS.length $ serialiseToCBOR b
Left err -> error $ "metaDataSize " ++ show err
where
dummyTx :: TxBodyContent BuildTx era
dummyTx = defaultTxBodyContent
dummyTx = defaultTxBodyContent (cardanoEra @era)
& setTxIns
[ ( TxIn "dbaff4e270cfb55612d9e2ac4658a27c79da4a5271c6f90853042d1403733810" (TxIx 0)
, BuildTxWith $ KeyWitness KeyWitnessForSpending
)
]
& setTxFee (mkTxFee 0)
& setTxValidityRange (TxValidityNoLowerBound, mkTxValidityUpperBound 0)
& setTxValidityLowerBound TxValidityNoLowerBound
& setTxValidityUpperBound (mkTxValidityUpperBound 0)
& setTxMetadata metadata

dummyTxSize :: forall era . IsShelleyBasedEra era => AsType era -> Maybe TxMetadata -> Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Cardano.Tracing.OrphanInstances.Shelley ()

import Ouroboros.Network.Protocol.TxSubmission2.Type (TokBlockingStyle (..))

import Cardano.Api
import Cardano.Api hiding (Active)
import Cardano.TxGenerator.Types (TPSRate, TxGenError)

import Cardano.Benchmarking.LogTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import Ouroboros.Network.Protocol.TxSubmission2.Client (ClientStIdle (
import Ouroboros.Network.Protocol.TxSubmission2.Type (BlockingReplyList (..),
TokBlockingStyle (..), TxSizeInBytes)

import Cardano.Api
import Cardano.Api hiding (Active)
import Cardano.Api.Shelley (fromShelleyTxId, toConsensusGenTx)

import Cardano.Logging
Expand Down
6 changes: 3 additions & 3 deletions bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ addFund era wallet txIn lovelace keyName = do
fundKey <- getEnvKeys keyName
let
mkOutValue :: forall era. IsShelleyBasedEra era => AsType era -> ActionM (InAnyCardanoEra TxOutValue)
mkOutValue _ = return $ InAnyCardanoEra (cardanoEra @era) (lovelaceToTxOutValue lovelace)
mkOutValue _ = return $ InAnyCardanoEra (cardanoEra @era) (lovelaceToTxOutValue (cardanoEra @era) lovelace)
outValue <- withEra era mkOutValue
addFundToWallet wallet txIn outValue fundKey

Expand Down Expand Up @@ -187,7 +187,7 @@ queryRemoteProtocolParameters = do
res <- liftIO $ queryNodeLocalState localNodeConnectInfo (Just $ chainTipToChainPoint chainTip) (QueryInEra eraInMode query)
case res of
Right (Right pp) -> do
let pp' = fromLedgerPParams shelleyEra pp
let pp' = fromLedgerPParams shelleyEra pp
pparamsFile = "protocol-parameters-queried.json"
liftIO $ BSL.writeFile pparamsFile $ prettyPrintOrdered pp'
traceDebug $ "queryRemoteProtocolParameters : query result saved in: " ++ pparamsFile
Expand Down Expand Up @@ -296,7 +296,7 @@ evalGenerator generator txParams@TxGenTxParams{txParamFee = fee} era = do
protocolParameters <- getProtocolParameters
case convertToLedgerProtocolParameters (shelleyBasedEra @era) protocolParameters of
Left err -> throwE (Env.TxGenError (ApiError err))
Right ledgerParameters ->
Right ledgerParameters ->
case generator of
SecureGenesis wallet genesisKeyName destKeyName -> do
genesis <- getEnvGenesis
Expand Down
12 changes: 7 additions & 5 deletions bench/tx-generator/src/Cardano/TxGenerator/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ genesisInitialFunds :: forall era. IsShelleyBasedEra era
-> ShelleyGenesis
-> [(AddressInEra era, Lovelace)]
genesisInitialFunds networkId g
= [ ( shelleyAddressInEra $ makeShelleyAddress networkId (fromShelleyPaymentCredential pcr) (fromShelleyStakeReference stref)
= [ ( shelleyAddressInEra (shelleyBasedEra @era) $
makeShelleyAddress networkId (fromShelleyPaymentCredential pcr) (fromShelleyStakeReference stref)
, fromShelleyLovelace coin
)
| (Addr _ pcr stref, coin) <- ListMap.toList $ sgInitialFunds g
Expand Down Expand Up @@ -122,14 +123,15 @@ mkGenesisTransaction :: forall era .
mkGenesisTransaction key ttl fee txins txouts
= bimap
ApiError
(`signShelleyTransaction` [WitnessGenesisUTxOKey key])
(createAndValidateTransactionBody txBodyContent)
(\b -> signShelleyTransaction (shelleyBasedEra @era) b [WitnessGenesisUTxOKey key])
(createAndValidateTransactionBody (cardanoEra @era) txBodyContent)
where
txBodyContent = defaultTxBodyContent
txBodyContent = defaultTxBodyContent (cardanoEra @era)
& setTxIns (zip txins $ repeat $ BuildTxWith $ KeyWitness KeyWitnessForSpending)
& setTxOuts txouts
& setTxFee (mkTxFee fee)
& setTxValidityRange (TxValidityNoLowerBound, mkTxValidityUpperBound ttl)
& setTxValidityLowerBound TxValidityNoLowerBound
& setTxValidityUpperBound (mkTxValidityUpperBound ttl)

castKey :: SigningKey PaymentKey -> SigningKey GenesisUTxOKey
castKey (PaymentSigningKey skey) = GenesisUTxOSigningKey skey
2 changes: 1 addition & 1 deletion bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ genesisValue :: TxOutValue BabbageEra

(genesisTxIn, genesisValue) =
( TxIn "900fc5da77a0747da53f7675cbb7d149d46779346dea2f879ab811ccc72a2162" (TxIx 0)
, lovelaceToTxOutValue $ Lovelace 90000000000000
, lovelaceToTxOutValue BabbageEra $ Lovelace 90000000000000
)

genesisFund :: Fund
Expand Down
13 changes: 8 additions & 5 deletions bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ preExecutePlutusV1 ::
preExecutePlutusV1 protocolVersion_ (PlutusScript _ (PlutusScriptSerialised script)) datum redeemer costModel
= fst $ runWriter $ runExceptT go -- for now, we discard warnings (:: PlutusCore.Evaluation.Machine.CostModelInterface.CostModelApplyWarn)
where
protocolVersion = uncurry PlutusV1.ProtocolVersion protocolVersion_
protocolVersion = PlutusV1.MajorProtocolVersion (fst protocolVersion_)
go
= do
evaluationContext <- firstExceptT PlutusError $
PlutusV1.mkEvaluationContext (flattenCostModel costModel)

deserialisedScript <- firstExceptT PlutusError $ PlutusV1.deserialiseScript protocolVersion script
exBudget <- firstExceptT PlutusError $
hoistEither $
snd $ PlutusV1.evaluateScriptCounting protocolVersion PlutusV1.Verbose evaluationContext script
snd $ PlutusV1.evaluateScriptCounting protocolVersion PlutusV1.Verbose evaluationContext deserialisedScript
[ toPlutusData datum
, toPlutusData (getScriptData redeemer)
, PlutusV1.toData dummyContext
Expand Down Expand Up @@ -146,18 +147,20 @@ preExecutePlutusV2 ::
-> ScriptRedeemer
-> CostModel
-> Either TxGenError ExecutionUnits
preExecutePlutusV2 protocolVersion_ (PlutusScript _ (PlutusScriptSerialised script)) datum redeemer costModel
preExecutePlutusV2 (major, _minor) (PlutusScript _ (PlutusScriptSerialised script)) datum redeemer costModel
= fst $ runWriter $ runExceptT go -- for now, we discard warnings (:: PlutusCore.Evaluation.Machine.CostModelInterface.CostModelApplyWarn)
where
protocolVersion = uncurry PlutusV2.ProtocolVersion protocolVersion_
protocolVersion = PlutusV2.MajorProtocolVersion major
go
= do
evaluationContext <- firstExceptT PlutusError $
PlutusV2.mkEvaluationContext (flattenCostModel costModel)

deserialisedScript <- firstExceptT PlutusError $ PlutusV2.deserialiseScript protocolVersion script

exBudget <- firstExceptT PlutusError $
hoistEither $
snd $ PlutusV2.evaluateScriptCounting protocolVersion PlutusV2.Verbose evaluationContext script
snd $ PlutusV2.evaluateScriptCounting protocolVersion PlutusV2.Verbose evaluationContext deserialisedScript
[ toPlutusData datum
, toPlutusData (getScriptData redeemer)
, PlutusV2.toData dummyContext
Expand Down
10 changes: 6 additions & 4 deletions bench/tx-generator/src/Cardano/TxGenerator/Tx.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.TxGenerator.Tx
(module Cardano.TxGenerator.Tx)
Expand Down Expand Up @@ -167,16 +168,17 @@ genTx :: forall era. ()
genTx _era ledgerParameters (collateral, collFunds) fee metadata inFunds outputs
= bimap
ApiError
(\b -> (signShelleyTransaction b $ map WitnessPaymentKey allKeys, getTxId b))
(createAndValidateTransactionBody txBodyContent)
(\b -> (signShelleyTransaction (shelleyBasedEra @era) b $ map WitnessPaymentKey allKeys, getTxId b))
(createAndValidateTransactionBody (cardanoEra @era) txBodyContent)
where
allKeys = mapMaybe getFundKey $ inFunds ++ collFunds
txBodyContent = defaultTxBodyContent
txBodyContent = defaultTxBodyContent (cardanoEra @era)
& setTxIns (map (\f -> (getFundTxIn f, BuildTxWith $ getFundWitness f)) inFunds)
& setTxInsCollateral collateral
& setTxOuts outputs
& setTxFee fee
& setTxValidityRange (TxValidityNoLowerBound, defaultTxValidityUpperBound)
& setTxValidityLowerBound TxValidityNoLowerBound
& setTxValidityUpperBound (defaultTxValidityUpperBound (cardanoEra @era))
& setTxMetadata metadata
& setTxProtocolParams (BuildTxWith (Just ledgerParameters))

Expand Down
9 changes: 5 additions & 4 deletions bench/tx-generator/src/Cardano/TxGenerator/UTxO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ mkUTxOVariant networkId key value
, mkNewFund value
)
where
mkTxOut v = TxOut (keyAddress @era networkId key) (lovelaceToTxOutValue v) TxOutDatumNone ReferenceScriptNone
mkTxOut v = TxOut (keyAddress @era networkId key) (lovelaceToTxOutValue (cardanoEra @era) v) TxOutDatumNone ReferenceScriptNone

mkNewFund :: Lovelace -> TxIx -> TxId -> Fund
mkNewFund val txIx txId = Fund $ InAnyCardanoEra (cardanoEra @era) $ FundInEra {
_fundTxIn = TxIn txId txIx
, _fundWitness = KeyWitness KeyWitnessForSpending
, _fundVal = lovelaceToTxOutValue val
, _fundVal = lovelaceToTxOutValue (cardanoEra @era ) val
, _fundSigningKey = Just key
}

Expand All @@ -61,6 +61,7 @@ mkUTxOScript networkId (script, txOutDatum) witness value
case scriptLanguageSupportedInEra (cardanoEra @era) lang of
Nothing -> error "mkUtxOScript: scriptLanguageSupportedInEra==Nothing"
Just{} -> makeShelleyAddressInEra
(shelleyBasedEra @era)
networkId
(PaymentCredentialByScript $ hashScript script')
NoStakeAddress
Expand All @@ -69,14 +70,14 @@ mkUTxOScript networkId (script, txOutDatum) witness value
Nothing -> error "mkUtxOScript: scriptDataSupportedInEra==Nothing"
Just tag -> TxOut
plutusScriptAddr
(lovelaceToTxOutValue v)
(lovelaceToTxOutValue (cardanoEra @era) v)
(TxOutDatumHash tag $ hashScriptDataBytes $ unsafeHashableScriptData txOutDatum)
ReferenceScriptNone

mkNewFund :: Lovelace -> TxIx -> TxId -> Fund
mkNewFund val txIx txId = Fund $ InAnyCardanoEra (cardanoEra @era) $ FundInEra {
_fundTxIn = TxIn txId txIx
, _fundWitness = witness
, _fundVal = lovelaceToTxOutValue val
, _fundVal = lovelaceToTxOutValue (cardanoEra @era) val
, _fundSigningKey = Nothing
}
5 changes: 3 additions & 2 deletions bench/tx-generator/src/Cardano/TxGenerator/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ liftAnyEra f x = case x of
keyAddress :: forall era. IsShelleyBasedEra era => NetworkId -> SigningKey PaymentKey -> AddressInEra era
keyAddress networkId k
= makeShelleyAddressInEra
(shelleyBasedEra @era)
networkId
(PaymentCredentialByKey $ verificationKeyHash $ getVerificationKey k)
NoStakeAddress
Expand Down Expand Up @@ -73,8 +74,8 @@ mkTxFee f = caseByronOrShelleyBasedEra
-- | `mkTxValidityUpperBound` rules out needing the
-- `TxValidityNoUpperBound` with the constraint of `IsShelleyBasedEra`.
mkTxValidityUpperBound :: forall era. IsShelleyBasedEra era => SlotNo -> TxValidityUpperBound era
mkTxValidityUpperBound =
TxValidityUpperBound (fromJust $ forEraMaybeEon (cardanoEra @era))
mkTxValidityUpperBound slotNo =
TxValidityUpperBound (fromJust $ forEraMaybeEon (cardanoEra @era)) (Just slotNo)

-- | `mkTxOutValueAdaOnly` reinterprets the `Either` returned by
-- `multiAssetSupportedInEra` with `TxOutValue` constructors.
Expand Down
6 changes: 3 additions & 3 deletions bench/tx-generator/tx-generator.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0

name: tx-generator
version: 2.8
version: 2.9
synopsis: A transaction workload generator for Cardano clusters
description: A transaction workload generator for Cardano clusters.
category: Cardano,
Expand Down Expand Up @@ -97,9 +97,9 @@ library
, attoparsec
, base16-bytestring
, bytestring
, cardano-api ^>= 8.25
, cardano-api ^>= 8.29
, cardano-binary
, cardano-cli ^>= 8.12
, cardano-cli ^>= 8.13
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-data
Expand Down
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2023-09-01T22:19:16Z
, cardano-haskell-packages 2023-10-05T21:00:00Z
, cardano-haskell-packages 2023-10-31T17:10:09Z

packages:
cardano-git-rev
Expand Down
6 changes: 3 additions & 3 deletions cardano-node-chairman/cardano-node-chairman.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0

name: cardano-node-chairman
version: 8.5.0
version: 8.6.0
synopsis: The cardano full node
description: The cardano full node.
category: Cardano,
Expand Down Expand Up @@ -44,7 +44,7 @@ executable cardano-node-chairman
build-depends: cardano-api
, cardano-crypto-class
, cardano-git-rev
, cardano-node ^>= 8.5
, cardano-node ^>= 8.6
, cardano-prelude
, containers
, contra-tracer
Expand Down Expand Up @@ -88,5 +88,5 @@ test-suite chairman-tests
ghc-options: -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T

build-tool-depends: cardano-node:cardano-node
, cardano-cli:cardano-cli ^>= 8.12
, cardano-cli:cardano-cli ^>= 8.13
, cardano-node-chairman:cardano-node-chairman
10 changes: 5 additions & 5 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0

name: cardano-node
version: 8.5.0
version: 8.6.0
synopsis: The cardano full node
description: The cardano full node.
category: Cardano,
Expand Down Expand Up @@ -137,7 +137,7 @@ library
, async
, base16-bytestring
, bytestring
, cardano-api ^>= 8.25
, cardano-api ^>= 8.29
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-git-rev
Expand Down Expand Up @@ -176,8 +176,8 @@ library
, network-mux >= 0.4
, nothunks
, optparse-applicative-fork >= 0.18.1
, ouroboros-consensus ^>= 0.12
, ouroboros-consensus-cardano ^>= 0.10
, ouroboros-consensus ^>= 0.13
, ouroboros-consensus-cardano ^>= 0.11
, ouroboros-consensus-diffusion ^>= 0.8
, ouroboros-consensus-protocol
, ouroboros-network-api
Expand All @@ -196,7 +196,7 @@ library
, strict-stm
, text >= 2.0
, time
, trace-dispatcher ^>= 2.3
, trace-dispatcher ^>= 2.4
, trace-forward ^>= 2.2
, trace-resources ^>= 0.2.0.2
, tracer-transformers
Expand Down
4 changes: 3 additions & 1 deletion cardano-node/src/Cardano/Node/TraceConstraints.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, HasTxId
import Ouroboros.Consensus.Node.NetworkProtocolVersion
(HasNetworkProtocolVersion (BlockNodeToClientVersion, BlockNodeToNodeVersion))
import Ouroboros.Consensus.Node.Run (RunNode, SerialiseNodeToNodeConstraints)
import Ouroboros.Consensus.Protocol.Abstract (ValidationErr)
import Ouroboros.Consensus.Protocol.Abstract (SelectView, ValidationErr)
import Ouroboros.Consensus.Shelley.Ledger.Mempool (GenTx, TxId)

import Ouroboros.Network.Block (Serialised)
Expand Down Expand Up @@ -53,6 +53,7 @@ type TraceConstraints blk =
, ToObject (LedgerError blk)
, ToObject (LedgerEvent blk)
, ToObject (OtherHeaderEnvelopeError blk)
, ToObject (SelectView (BlockProtocol blk))
, ToObject (ValidationErr (BlockProtocol blk))
, ToObject (CannotForge blk)
, ToObject (ForgeStateUpdateError blk)
Expand All @@ -67,6 +68,7 @@ type TraceConstraints blk =
, LogFormatting (LedgerUpdate blk)
, LogFormatting (LedgerWarning blk)
, LogFormatting (OtherHeaderEnvelopeError blk)
, LogFormatting (SelectView (BlockProtocol blk))
, LogFormatting (ValidationErr (BlockProtocol blk))
, LogFormatting (CannotForge blk)
, LogFormatting (ForgeStateUpdateError blk)
Expand Down
Loading

0 comments on commit 735e6c9

Please sign in to comment.