Skip to content

Commit

Permalink
Update deps 20210723
Browse files Browse the repository at this point in the history
Co-authored-by: Duncan Coutts <duncan@well-typed.com>
  • Loading branch information
Jimbo4350 and dcoutts committed Jul 26, 2021
1 parent cffa06c commit 8c92fb4
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 36 deletions.
26 changes: 14 additions & 12 deletions cabal.project
Original file line number Diff line number Diff line change
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
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ module Cardano.Api (
ScriptDatum(..),
ScriptRedeemer,
scriptWitnessScript,
renderScriptWitnessIndex,

-- *** Languages supported in each era
ScriptLanguageInEra(..),
Expand Down
5 changes: 2 additions & 3 deletions cardano-api/src/Cardano/Api/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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 +157,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 @ledgerera txs) ]

obtainConsensusShelleyBasedEra
:: forall era ledgerera a.
Expand Down
14 changes: 12 additions & 2 deletions cardano-api/src/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,22 @@ 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

--TODO: in the Byron case the per-byte is non-integral, would need different
-- parameters. e.g. a new data type for fee params, Byron vs Shelley
Expand Down
2 changes: 2 additions & 0 deletions cardano-api/src/Cardano/Api/Shelley.hs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
3 changes: 3 additions & 0 deletions cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
4 changes: 4 additions & 0 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ instance ToObject (AlonzoPredFail (Alonzo.AlonzoEra StandardCrypto)) where
, "disallowed" .= Set.toList disallowed
, "acceptable" .= Set.toList acceptable
]
toObject _ (ExtraRedeemers rdmrs) =
mkObject [ "kind" .= String "ExtraRedeemers"
, "rdmrs" .= map (Api.renderScriptWitnessIndex . Api.fromAlonzoRdmrPtr) rdmrs
]

renderWitnessPPDataHash :: Maybe (Alonzo.WitnessPPDataHash StandardCrypto) -> Aeson.Value
renderWitnessPPDataHash (Just witPPDataHash) =
Expand Down

0 comments on commit 8c92fb4

Please sign in to comment.