Skip to content

Commit

Permalink
Merge #2966
Browse files Browse the repository at this point in the history
2966: Update deps 2021-07-26 r=Jimbo4350 a=Jimbo4350



Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
Co-authored-by: Duncan Coutts <duncan@well-typed.com>
  • Loading branch information
3 people committed Jul 27, 2021
2 parents cffa06c + 8c9f40c commit f60f233
Show file tree
Hide file tree
Showing 20 changed files with 103 additions and 72 deletions.
26 changes: 14 additions & 12 deletions cabal.project
Expand Up @@ -116,28 +116,30 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: b6a215c42a28dc8b71b42946fe30256a333d34af
--sha256: 1l9nqsg6kfkfadlbvyl4afdf8v408zf0fn6dkihqf56g2mnk4i04
tag: c028519d1180e42d6ab3ddf97d6fa57395966c2e
--sha256: 11n2731y1z3ggp2lvphsbrxcppk29knknynza4259694ws533kqz
subdir:
base-deriving-via
binary
binary/test
cardano-crypto-class
cardano-crypto-praos
cardano-crypto-tests
measures
slotting
strict-containers

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-crypto
tag: ce8f1934e4b6252084710975bd9bbc0a4648ece4
--sha256: 1v2laq04piyj511b2m77hxjh9l1yd6k9kc7g6bjala4w3zdwa4ni
tag: 07397f0e50da97eaa0575d93bee7ac4b2b2576ec
--sha256: 06sdx5ndn2g722jhpicmg96vsrys89fl81k8290b3lr6b1b0w4m3

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: ec9c77edbf5700a4b2ece8f97a1e313df06abc97
--sha256: 1ia8x9dnw36y0xazg7xg263ax9mamw9w4sg460cmibj3wv49im4w
tag: bc5e54f0611a416db1e906d3783e4b973429f5eb
--sha256: 1j7b6aglr1j51qmfn4nx7mamv81qyl8411fwsx6bw2cpghvizpmg
subdir:
alonzo/impl
byron/chain/executable-spec
Expand Down Expand Up @@ -190,14 +192,14 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/Win32-network
tag: 5b3d08c454f425da5cf045fe7865950d7c806691
--sha256: 0npyihbaqlih9abdbaj451lm1h0kl5braczy8vn41s3ivbbnvpcw
tag: 3825d3abf75f83f406c1f7161883c438dac7277d
--sha256: 19wahfv726fa3mqajpqdqhnl9ica3xmf68i254q45iyjcpj1psqx

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: e338f2cf8e1078fbda9555dd2b169c6737ef6774
--sha256: 12x81hpjyw2cpkazfalz6bw2wgr6ax7bnmlxl2rlfakkvsjfgaqd
tag: f026e71e8925dc2cb1a55a9a77b54bbeb1273ef0
--sha256: 0wmlrkdi7q868872p4ah35z51511yqkr8pj90fwadlr6ipkbpkl9
subdir:
io-sim
io-classes
Expand All @@ -216,8 +218,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/plutus
tag: 523f349f3d68db07c98150734793ed7003d1f562
--sha256: 0vp6wiv1fz5bzvw90pdwv96nck78m5s91xiwjhkksq06l1yqr3ps
tag: 826c2514a40e962c2e4d56ce912803a434cc28fe
--sha256: 04jryrgi2wggkf4a994smbcp8j39clshbzfnvfvvk7lq0sm8kssz
subdir:
plutus-core
plutus-ledger-api
Expand Down
15 changes: 11 additions & 4 deletions cardano-api/src/Cardano/Api.hs
Expand Up @@ -329,7 +329,7 @@ module Cardano.Api (
toScriptInEra,
eraOfScriptInEra,

-- * Use of a script in an era as a witness
-- ** Use of a script in an era as a witness
WitCtxTxIn, WitCtxMint, WitCtxStake,
WitCtx(..),
ScriptWitness(..),
Expand All @@ -340,7 +340,14 @@ module Cardano.Api (
ScriptRedeemer,
scriptWitnessScript,

-- *** Languages supported in each era
-- ** Inspecting 'ScriptWitness'es
AnyScriptWitness(..),
ScriptWitnessIndex(..),
renderScriptWitnessIndex,
collectTxBodyScriptWitnesses,
mapTxScriptWitnesses,

-- ** Languages supported in each era
ScriptLanguageInEra(..),
scriptLanguageSupportedInEra,
languageOfScriptLanguageInEra,
Expand All @@ -358,7 +365,7 @@ module Cardano.Api (
examplePlutusScriptAlwaysSucceeds,
examplePlutusScriptAlwaysFails,

-- * Script data
-- ** Script data
ScriptData(..),
hashScriptData,

Expand All @@ -373,7 +380,7 @@ module Cardano.Api (
ScriptDataJsonError (..),
ScriptDataJsonSchemaError (..),

-- * Script execution units
-- ** Script execution units
ExecutionUnits(..),
ExecutionUnitPrices(..),
CostModel(..),
Expand Down
6 changes: 2 additions & 4 deletions cardano-api/src/Cardano/Api/Block.hs
Expand Up @@ -6,7 +6,6 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}

Expand Down Expand Up @@ -68,7 +67,6 @@ import qualified Cardano.Chain.Block as Byron
import qualified Cardano.Chain.UTxO as Byron
import qualified Cardano.Ledger.Era as Ledger
import qualified Shelley.Spec.Ledger.BlockChain as Ledger
import qualified Shelley.Spec.Ledger.API.Mempool as Ledger

import Cardano.Api.Eras
import Cardano.Api.HasTypeProxy
Expand Down Expand Up @@ -158,8 +156,8 @@ getShelleyBlockTxs :: forall era ledgerera.
-> Ledger.Block ledgerera
-> [Tx era]
getShelleyBlockTxs era (Ledger.Block _header txs) =
[ ShelleyTx era (Ledger.extractTx txinblock)
| txinblock <- toList (Ledger.fromTxSeq @ledgerera txs) ]
[ ShelleyTx era txinblock
| txinblock <- toList (Ledger.fromTxSeq txs) ]

obtainConsensusShelleyBasedEra
:: forall era ledgerera a.
Expand Down
18 changes: 17 additions & 1 deletion cardano-api/src/Cardano/Api/Fees.hs
Expand Up @@ -116,11 +116,24 @@ transactionFee txFeeFixed txFeePerByte tx =
let a = toInteger txFeePerByte
b = toInteger txFeeFixed
in case tx of
ShelleyTx _ tx' -> let x = getField @"txsize" tx'
ShelleyTx _ tx' -> let x = obtainHasField shelleyBasedEra $ getField @"txsize" tx'
in Lovelace (a * x + b)
--TODO: This can be made to work for Byron txs too. Do that: fill in this case
-- and remove the IsShelleyBasedEra constraint.
ByronTx _ -> case shelleyBasedEra :: ShelleyBasedEra ByronEra of {}
where
obtainHasField
:: ShelleyLedgerEra era ~ ledgerera
=> ShelleyBasedEra era
-> ( HasField "txsize" (Ledger.Tx (ShelleyLedgerEra era)) Integer
=> a)
-> a
obtainHasField ShelleyBasedEraShelley f = f
obtainHasField ShelleyBasedEraAllegra f = f
obtainHasField ShelleyBasedEraMary f = f
obtainHasField ShelleyBasedEraAlonzo f = f

{-# DEPRECATED transactionFee "Use 'evaluateTransactionFee' instead" #-}


--TODO: in the Byron case the per-byte is non-integral, would need different
Expand Down Expand Up @@ -195,6 +208,9 @@ estimateTransactionFee nw txFeeFixed txFeePerByte (ShelleyTx era tx) =
estimateTransactionFee _ _ _ (ByronTx _) =
case shelleyBasedEra :: ShelleyBasedEra era of {}

--TODO: also deprecate estimateTransactionFee:
--{-# DEPRECATED estimateTransactionFee "Use 'evaluateTransactionFee' instead" #-}


-- | Compute the transaction fee for a proposed transaction, with the
-- assumption that there will be the given number of key witnesses (i.e.
Expand Down
2 changes: 2 additions & 0 deletions cardano-api/src/Cardano/Api/Shelley.hs
Expand Up @@ -109,6 +109,8 @@ module Cardano.Api.Shelley
fromAlonzoPrices,
toAlonzoExUnits,
fromAlonzoExUnits,
toAlonzoRdmrPtr,
fromAlonzoRdmrPtr,

-- * Certificates
Certificate (..),
Expand Down
31 changes: 15 additions & 16 deletions cardano-api/src/Cardano/Api/Tx.hs
Expand Up @@ -95,6 +95,7 @@ import qualified Cardano.Ledger.Keys as Shelley
import qualified Shelley.Spec.Ledger.Tx as Shelley

import qualified Cardano.Ledger.Alonzo as Alonzo
import qualified Cardano.Ledger.Alonzo.Tx as Alonzo
import qualified Cardano.Ledger.Alonzo.TxWitness as Alonzo

import Cardano.Api.Address
Expand Down Expand Up @@ -418,7 +419,7 @@ getTxBody (ShelleyTx era tx) =
ShelleyLedgerEra era ~ ledgerera
=> Ledger.Witnesses ledgerera ~ Shelley.WitnessSetHKD Identity ledgerera
=> Shelley.ShelleyBased ledgerera
=> Ledger.Tx ledgerera
=> Shelley.Tx ledgerera
-> TxBody era
getShelleyTxBody Shelley.Tx {
Shelley.body = txbody,
Expand All @@ -435,21 +436,19 @@ getTxBody (ShelleyTx era tx) =

getAlonzoTxBody :: forall ledgerera.
ShelleyLedgerEra era ~ ledgerera
=> Ledger.Witnesses ledgerera ~ Alonzo.TxWitness ledgerera
=> Shelley.ShelleyBased ledgerera
=> ScriptDataSupportedInEra era
-> Ledger.Tx ledgerera
-> Alonzo.ValidatedTx ledgerera
-> TxBody era
getAlonzoTxBody scriptDataInEra
Shelley.Tx {
Shelley.body = txbody,
Shelley.wits = Alonzo.TxWitness'
Alonzo.ValidatedTx {
Alonzo.body = txbody,
Alonzo.wits = Alonzo.TxWitness'
_addrWits
_bootWits
txscripts
txdats
redeemers,
Shelley.auxiliaryData = auxiliaryData
Alonzo.auxiliaryData = auxiliaryData
} =
ShelleyTxBody era txbody
(Map.elems txscripts)
Expand All @@ -476,7 +475,7 @@ getTxWitnesses (ShelleyTx era tx) =
=> Ledger.Witnesses ledgerera ~ Shelley.WitnessSetHKD Identity ledgerera
=> ToCBOR (Ledger.Witnesses ledgerera)
=> Shelley.ShelleyBased ledgerera
=> Ledger.Tx ledgerera
=> Shelley.Tx ledgerera
-> [KeyWitness era]
getShelleyTxWitnesses Shelley.Tx {
Shelley.wits =
Expand All @@ -490,12 +489,10 @@ getTxWitnesses (ShelleyTx era tx) =

getAlonzoTxWitnesses :: forall ledgerera.
Ledger.Crypto ledgerera ~ StandardCrypto
=> Ledger.Witnesses ledgerera ~ Alonzo.TxWitness ledgerera
=> Shelley.ShelleyBased ledgerera
=> Ledger.Tx ledgerera
=> Alonzo.ValidatedTx ledgerera
-> [KeyWitness era]
getAlonzoTxWitnesses Shelley.Tx {
Shelley.wits =
getAlonzoTxWitnesses Alonzo.ValidatedTx {
Alonzo.wits =
Alonzo.TxWitness'
addrWits
bootWits
Expand Down Expand Up @@ -533,6 +530,7 @@ makeSignedTransaction witnesses (ShelleyTxBody era txbody
ShelleyLedgerEra era ~ ledgerera
=> Ledger.Crypto ledgerera ~ StandardCrypto
=> Ledger.Witnesses ledgerera ~ Shelley.WitnessSetHKD Identity ledgerera
=> Ledger.Tx ledgerera ~ Shelley.Tx ledgerera
=> ToCBOR (Ledger.Witnesses ledgerera)
=> Shelley.ShelleyBased ledgerera
=> Shelley.ValidateScript ledgerera
Expand All @@ -553,15 +551,15 @@ makeSignedTransaction witnesses (ShelleyTxBody era txbody
:: forall ledgerera.
ShelleyLedgerEra era ~ ledgerera
=> Ledger.Crypto ledgerera ~ StandardCrypto
=> Ledger.Witnesses ledgerera ~ Alonzo.TxWitness ledgerera
=> Ledger.Tx ledgerera ~ Alonzo.ValidatedTx ledgerera
=> Ledger.Script ledgerera ~ Alonzo.Script ledgerera
=> Shelley.ShelleyBased ledgerera
=> Shelley.ValidateScript ledgerera
=> Ledger.TxBody ledgerera
-> Tx era
makeAlonzoSignedTransaction txbody' =
ShelleyTx era $
Shelley.Tx
Alonzo.ValidatedTx
txbody'
(Alonzo.TxWitness
(Set.fromList [ w | ShelleyKeyWitness _ w <- witnesses ])
Expand All @@ -570,6 +568,7 @@ makeSignedTransaction witnesses (ShelleyTxBody era txbody
| sw <- txscripts ])
datums
redeemers)
(Alonzo.IsValidating True) --TODO: expose this in the API
(maybeToStrictMaybe txmetadata)
where
(datums, redeemers) =
Expand Down
15 changes: 7 additions & 8 deletions cardano-api/src/Cardano/Api/TxBody.hs
Expand Up @@ -12,7 +12,6 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}

Expand Down Expand Up @@ -97,9 +96,10 @@ module Cardano.Api.TxBody (
certificatesSupportedInEra,
updateProposalSupportedInEra,

-- * Inspecting 'ScriptWitnesses'
-- * Inspecting 'ScriptWitness'es
AnyScriptWitness(..),
ScriptWitnessIndex(..),
renderScriptWitnessIndex,
collectTxBodyScriptWitnesses,
mapTxScriptWitnesses,

Expand All @@ -114,7 +114,6 @@ module Cardano.Api.TxBody (
fromAlonzoRdmrPtr,
fromByronTxIn,
renderTxIn,
renderScriptWitnessIndex,

-- * Data family instances
AsType(AsTxId, AsTxBody, AsByronTxBody, AsShelleyTxBody, AsMaryTxBody),
Expand Down Expand Up @@ -274,7 +273,7 @@ getTxId (ShelleyTxBody era tx _ _ _) =
TxId
. Crypto.castHash
. (\(Shelley.TxId txhash) -> SafeHash.extractHash txhash)
. (Shelley.txid @(ShelleyLedgerEra era))
. Shelley.txid


-- ----------------------------------------------------------------------------
Expand Down Expand Up @@ -1896,7 +1895,7 @@ makeShelleyTransactionBody era@ShelleyBasedEraShelley
TxUpdateProposalNone -> SNothing
TxUpdateProposal _ p -> SJust (toLedgerUpdate era p))
(maybeToStrictMaybe
(Ledger.hashAuxiliaryData @StandardShelley <$> txAuxData)))
(Ledger.hashAuxiliaryData <$> txAuxData)))
scripts
TxBodyNoScriptData
txAuxData
Expand Down Expand Up @@ -1969,7 +1968,7 @@ makeShelleyTransactionBody era@ShelleyBasedEraAllegra
TxUpdateProposalNone -> SNothing
TxUpdateProposal _ p -> SJust (toLedgerUpdate era p))
(maybeToStrictMaybe
(Ledger.hashAuxiliaryData @StandardAllegra <$> txAuxData))
(Ledger.hashAuxiliaryData <$> txAuxData))
mempty) -- No minting in Allegra, only Mary
scripts
TxBodyNoScriptData
Expand Down Expand Up @@ -2057,7 +2056,7 @@ makeShelleyTransactionBody era@ShelleyBasedEraMary
TxUpdateProposalNone -> SNothing
TxUpdateProposal _ p -> SJust (toLedgerUpdate era p))
(maybeToStrictMaybe
(Ledger.hashAuxiliaryData @StandardMary <$> txAuxData))
(Ledger.hashAuxiliaryData <$> txAuxData))
(case txMintValue of
TxMintNone -> mempty
TxMintValue _ v _ -> toMaryValue v))
Expand Down Expand Up @@ -2179,7 +2178,7 @@ makeShelleyTransactionBody era@ShelleyBasedEraAlonzo
redeemers
datums)
(maybeToStrictMaybe
(Ledger.hashAuxiliaryData @StandardAlonzo <$> txAuxData))
(Ledger.hashAuxiliaryData <$> txAuxData))
SNothing) -- TODO alonzo: support optional network id in TxBodyContent
scripts
(TxBodyScriptData ScriptDataInAlonzoEra datums redeemers)
Expand Down
3 changes: 3 additions & 0 deletions cardano-node/src/Cardano/Node/Run.hs
Expand Up @@ -56,6 +56,7 @@ import Cardano.Tracing.Config (TraceOptions (..), TraceSelection (..))
import Cardano.Tracing.Constraints (TraceConstraints)
import Cardano.Tracing.Metrics (HasKESInfo (..), HasKESMetricsData (..))

import Ouroboros.Consensus.Block.Forging (MaxTxCapacityOverride (NoMaxTxCapacityOverride))
import qualified Ouroboros.Consensus.Config as Consensus
import Ouroboros.Consensus.Config.SupportsNode (getNetworkMagic)
import Ouroboros.Consensus.Node (DiffusionArguments (..), DiffusionTracers (..),
Expand Down Expand Up @@ -292,6 +293,8 @@ handleSimpleNode scp runP trace nodeTracers nc onKernel = do
, srnDiffusionTracers = diffusionTracers
, srnEnableInDevelopmentVersions = ncTestEnableDevelopmentNetworkProtocols nc
, srnTraceChainDB = chainDBTracer nodeTracers
-- TODO: Add CLI flag that defaults to NoMaxTxCapacityOverride
, srnMaxTxCapacityOverride = NoMaxTxCapacityOverride
}
where
createDiffusionTracers :: Tracers RemoteConnectionId LocalConnectionId blk
Expand Down
5 changes: 2 additions & 3 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs
Expand Up @@ -28,8 +28,7 @@ import Cardano.Tracing.OrphanInstances.Common
import Cardano.Tracing.Render

import Ouroboros.Consensus.Block (ConvertRawHash (..), getHeader)
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, HasTxs (..), txForgetValidated,
txId)
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, HasTxs (..), txId)
import Ouroboros.Consensus.Node.Run (RunNode, estimateBlockSize)
import qualified Ouroboros.Network.AnchoredFragment as AF
import qualified Ouroboros.Network.AnchoredSeq as AS
Expand Down Expand Up @@ -430,7 +429,7 @@ instance ( ConvertTxId blk
, "agency" .= String (pack $ show stok)
, "blockHash" .= renderHeaderHash (Proxy @blk) (blockHash blk)
, "blockSize" .= toJSON (estimateBlockSize (getHeader blk))
, "txIds" .= toJSON (presentTx <$> map txForgetValidated (extractTxs blk))
, "txIds" .= toJSON (presentTx <$> extractTxs blk)
]
where
presentTx :: GenTx blk -> Value
Expand Down

0 comments on commit f60f233

Please sign in to comment.