Skip to content

Commit

Permalink
Merge pull request #5423 from input-output-hk/sl/bump-cli
Browse files Browse the repository at this point in the history
cardano-node 8.2.1
  • Loading branch information
disassembler authored Aug 6, 2023
2 parents 8163a92 + 767e629 commit a29ee68
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 75 deletions.
2 changes: 1 addition & 1 deletion bench/plutus-scripts-bench/plutus-scripts-bench.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ library
-- IOG dependencies
--------------------------
build-depends:
, cardano-api ^>= 8.8
, cardano-api ^>= 8.12
, plutus-ledger-api >=1.0.0
, plutus-tx >=1.0.0
, plutus-tx-plugin >=1.0.0
Expand Down
12 changes: 6 additions & 6 deletions bench/tx-generator/tx-generator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ library
, attoparsec
, base16-bytestring
, bytestring
, cardano-api ^>= 8.8
, cardano-api ^>= 8.12
, cardano-binary
, cardano-cli ^>= 8.4
, cardano-cli ^>= 8.5
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-data
Expand Down Expand Up @@ -193,8 +193,8 @@ test-suite tx-generator-apitest
, bytestring
, filepath
, optparse-applicative-fork
, cardano-api ^>= 8.8
, cardano-cli ^>= 8.4
, cardano-api ^>= 8.12
, cardano-cli ^>= 8.5
, cardano-node
, plutus-tx
, transformers
Expand All @@ -209,8 +209,8 @@ test-suite tx-generator-apitest
, bytestring
, filepath
, optparse-applicative-fork
, cardano-api ^>= 8.8
, cardano-cli ^>= 8.4
, cardano-api ^>= 8.12
, cardano-cli ^>= 8.5
, cardano-node
, transformers
, transformers-except
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-07-27T21:50:17Z
, cardano-haskell-packages 2023-07-27T18:37:22Z
, cardano-haskell-packages 2023-08-06T03:00:00Z

packages:
cardano-client-demo
Expand Down
107 changes: 78 additions & 29 deletions cardano-client-demo/StakeCredentialHistory.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand All @@ -15,11 +16,14 @@ import Cardano.Ledger.Compactible (Compactible (..))
import qualified Cardano.Ledger.Core as LC
import Cardano.Ledger.Crypto (StandardCrypto)
import qualified Cardano.Ledger.Shelley.API as L
import qualified Cardano.Ledger.Shelley.API as Shelley
import qualified Cardano.Ledger.Shelley.Rewards as L
import qualified Cardano.Ledger.Shelley.RewardUpdate as L
import qualified Cardano.Ledger.UMap as UM
import qualified Ouroboros.Consensus.Shelley.Ledger as Shelley

import qualified Cardano.Api.Ledger as L
import qualified Cardano.Ledger.Coin as L
import qualified Codec.Binary.Bech32 as Bech32
import Control.Monad.Trans.Except (runExceptT)
import Control.Monad.Trans.Fail.String
Expand Down Expand Up @@ -254,7 +258,7 @@ main = do
_
(BlockInMode
(Block (BlockHeader slotNo _blockHeaderHash (BlockNo _blockNoI)) transactions)
_era)
eim)
state -> do
let getGoSnapshot = L.unStake . L.ssStake . L.ssStakeGo . L.esSnapshots . L.nesEs
getBalances = UM.rewardMap
Expand Down Expand Up @@ -286,8 +290,8 @@ main = do
("conway", L.nesEL ls, Just (L.nesRu ls, getGoSnapshot ls, getBalances ls, getPV ls))

let txBodyComponents = map ( (\(TxBody txbc) -> txbc) . getTxBody ) transactions

mapM_ (delegationEvents targetCredAsAPI epochNo slotNo) txBodyComponents
let sbe'm = shelleyBasedEraFromEraInMode eim
mapM_ (delegationEvents sbe'm targetCredAsAPI epochNo slotNo) txBodyComponents
mapM_ (withdrawalEvents targetCredAsAPI epochNo slotNo) txBodyComponents

lastcheck <- displayCheckpoint slotNo (lastCheckpoint state) (checkpoint args)
Expand Down Expand Up @@ -315,7 +319,6 @@ main = do

return ()
where

-- CheckPoints --
displayCheckpoint :: SlotNo -> SlotNo -> CheckPoint -> IO SlotNo
displayCheckpoint _ lastcheck CheckPointOff = return lastcheck
Expand All @@ -337,31 +340,64 @@ main = do
else return pvLast

-- Delegation Events --
delegationEvents :: StakeCredential -> EpochNo -> SlotNo -> TxBodyContent ViewTx era -> IO ()
delegationEvents t epochNo slotNo txbc = case txCertificates txbc of
TxCertificatesNone -> return ()
TxCertificates _ cs _ -> mapM_ msg $ mapMaybe (targetedCert t epochNo slotNo) cs

targetedCert :: StakeCredential -> EpochNo -> SlotNo -> Certificate era -> Maybe (Event c)
targetedCert t epochNo slotNo = \case
StakeAddressRegistrationCertificate cred ->
if t == cred then Just (StakeRegistrationEvent epochNo slotNo) else Nothing
StakeAddressDeregistrationCertificate cred ->
if t == cred then Just (StakeDeRegistrationEvent epochNo slotNo) else Nothing
StakeAddressPoolDelegationCertificate cred pool ->
if t == cred then Just (DelegationEvent slotNo pool) else Nothing
StakePoolRegistrationCertificate pool ->
inPoolCert t slotNo pool
StakePoolRetirementCertificate _ _ -> Nothing
GenesisKeyDelegationCertificate {} -> Nothing
MIRCertificate pot (StakeAddressesMIR mir) ->
inMir t epochNo slotNo mir pot
MIRCertificate _ (SendToReservesMIR _) -> Nothing
MIRCertificate _ (SendToTreasuryMIR _) -> Nothing

-- TODO CIP-1694 These are also delegation events. Should there be new events for these?
CommitteeDelegationCertificate _ _ -> Nothing
CommitteeHotKeyDeregistrationCertificate _ -> Nothing
delegationEvents :: Maybe (ShelleyBasedEra era) -> StakeCredential -> EpochNo -> SlotNo -> TxBodyContent ViewTx era -> IO ()
delegationEvents sbe'm t epochNo slotNo txbc = do
case (txCertificates txbc, sbe'm) of
(TxCertificates _ cs _, Just sbe) -> mapM_ msg $ mapMaybe (targetedCert sbe t epochNo slotNo) cs
(_, _) -> return ()

targetedCert :: ShelleyBasedEra era -> StakeCredential -> EpochNo -> SlotNo -> Certificate era -> Maybe (Event c)
targetedCert sbe t epochNo slotNo = shelleyBasedEraConstraints sbe $ \case
ShelleyRelatedCertificate _ c ->
case c of
L.ShelleyTxCertDelegCert (L.ShelleyRegCert cred) ->
if t == fromShelleyStakeCredential cred then Just (StakeRegistrationEvent epochNo slotNo) else Nothing
L.ShelleyTxCertDelegCert (L.ShelleyUnRegCert cred) ->
if t == fromShelleyStakeCredential cred then Just (StakeDeRegistrationEvent epochNo slotNo) else Nothing
L.ShelleyTxCertDelegCert (L.ShelleyDelegCert cred poolId) ->
if t == fromShelleyStakeCredential cred then Just (DelegationEvent slotNo (StakePoolKeyHash poolId)) else Nothing
L.ShelleyTxCertPool (L.RetirePool _poolId _retirementEpoch) ->
Nothing
L.ShelleyTxCertPool (L.RegPool poolParams) ->
inPoolCert t slotNo (fromShelleyPoolParams poolParams)
L.ShelleyTxCertGenesisDeleg (L.GenesisDelegCert _genesisKeyHash _delegateKeyHash _vrfKeyHash) ->
Nothing
L.ShelleyTxCertMir (L.MIRCert pot (L.StakeAddressesMIR mir)) -> do
let addrs = flip map (Map.assocs mir) $ \(cred, L.DeltaCoin coin) -> (fromShelleyStakeCredential cred, Lovelace coin)
inMir t epochNo slotNo addrs pot
L.ShelleyTxCertMir (L.MIRCert _pot (L.SendToOppositePotMIR _coin)) -> do
Nothing -- TODO: unsure if Nothing

-- TODO: Any events for ConwayCertificates?
ConwayCertificate w cert ->
conwayEraOnwardsConstraints w $
case cert of
L.RegDRepTxCert _credential _coin ->
Nothing
L.UnRegDRepTxCert _credential _coin ->
Nothing
L.AuthCommitteeHotKeyTxCert (Shelley.KeyHash _coldKey) (Shelley.KeyHash _hotKey) ->
Nothing
L.ResignCommitteeColdTxCert (Shelley.KeyHash _coldKey) ->
Nothing
L.RegTxCert _stakeCredential ->
Nothing
L.UnRegTxCert _stakeCredential ->
Nothing
L.RegDepositTxCert _stakeCredential _deposit ->
Nothing
L.UnRegDepositTxCert _stakeCredential _refund ->
Nothing
L.DelegTxCert _stakeCredential _delegatee ->
Nothing
L.RegDepositDelegTxCert _stakeCredential _delegatee _deposit ->
Nothing
L.RegPoolTxCert _poolParams ->
Nothing
L.RetirePoolTxCert (Shelley.KeyHash _kh) _epoch ->
Nothing
L.DelegStakeTxCert _stakeCredential (Shelley.KeyHash _kh) ->
Nothing

stakeCredentialFromStakeAddress (StakeAddress _ cred) = fromShelleyStakeCredential cred

Expand Down Expand Up @@ -412,3 +448,16 @@ main = do
-- Reward Calculation End Event --
rewardEndEvent epochLast epochCurrent slot rs t =
epochEvent epochLast epochCurrent slot rs t RewardEndEvent

shelleyBasedEraFromEraInMode :: EraInMode era mode -> Maybe (ShelleyBasedEra era)
shelleyBasedEraFromEraInMode = \case
ByronEraInByronMode -> Nothing
ByronEraInCardanoMode -> Nothing
ShelleyEraInCardanoMode -> Just ShelleyBasedEraShelley
ShelleyEraInShelleyMode -> Just ShelleyBasedEraShelley
AllegraEraInCardanoMode -> Just ShelleyBasedEraAllegra
MaryEraInCardanoMode -> Just ShelleyBasedEraMary
AlonzoEraInCardanoMode -> Just ShelleyBasedEraAlonzo
BabbageEraInCardanoMode -> Just ShelleyBasedEraBabbage
ConwayEraInCardanoMode -> Just ShelleyBasedEraConway

2 changes: 1 addition & 1 deletion cardano-node-chairman/cardano-node-chairman.cabal
Original file line number Diff line number Diff line change
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.3
, cardano-cli:cardano-cli ^>= 8.5
, cardano-node-chairman:cardano-node-chairman
9 changes: 8 additions & 1 deletion cardano-node/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog for cardano-node

# 8.2.0 -- July 2023
## 8.2.1 -- August 2023

- prevent SIGHUP from killing node during ledger replay
- upgrade cardano-cli to 8.4.1.0
- upgrade cardano-api to 8.10.2.0


## 8.2.0 -- July 2023

### node changes

Expand Down
6 changes: 3 additions & 3 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.2.0
version: 8.2.1
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.8
, cardano-api ^>= 8.12
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-git-rev
Expand Down Expand Up @@ -235,7 +235,7 @@ test-suite cardano-node-test
, aeson >= 1.5.6.0
, bytestring
, cardano-crypto-class
, cardano-api ^>= 8.8
, cardano-api ^>= 8.12
, cardano-ledger-core
, cardano-node
, cardano-slotting >= 0.1
Expand Down
21 changes: 0 additions & 21 deletions cardano-node/src/Cardano/Tracing/OrphanInstances/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ module Cardano.Tracing.OrphanInstances.Common
) where

import Data.Aeson hiding (Value)
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Short as SBS
import Data.Scientific (coefficient)
import Data.Text (Text)
import qualified Data.Text as Text
import qualified Data.Text.Encoding as Text
import Data.Void (Void)
import Network.Socket (PortNumber)
import Text.Read (readMaybe)
Expand All @@ -59,9 +56,6 @@ import Cardano.BM.Tracing (HasPrivacyAnnotation (..), HasSeverityAnnot
Severity (..), ToObject (..), Tracer (..), TracingVerbosity (..),
Transformable (..))
import Cardano.Node.Handlers.Shutdown ()
import Ouroboros.Consensus.Byron.Ledger.Block (ByronHash (..))
import Ouroboros.Consensus.HardFork.Combinator (OneEraHash (..))
import Ouroboros.Network.Block (HeaderHash, Tip (..))
-- | A bit of a weird one, but needed because some of the very general
-- consensus interfaces are sometimes instantiated to 'Void', when there are
-- no cases needed.
Expand All @@ -88,21 +82,6 @@ instance FromJSON PortNumber where
parseJSON invalid = fail $ "Parsing of port number failed due to type mismatch. "
<> "Encountered: " <> show invalid

instance ToJSON (HeaderHash blk) => ToJSON (Tip blk) where
toJSON TipGenesis = object [ "genesis" .= True ]
toJSON (Tip slotNo headerHash blockNo) =
object
[ "slotNo" .= slotNo
, "headerHash" .= headerHash
, "blockNo" .= blockNo
]

instance ToJSON (OneEraHash xs) where
toJSON (OneEraHash bs) =
toJSON . Text.decodeLatin1 . B16.encode . SBS.fromShort $ bs

deriving newtype instance ToJSON ByronHash

instance HasPrivacyAnnotation ResourceStats
instance HasSeverityAnnotation ResourceStats where
getSeverityAnnotation _ = Info
Expand Down
6 changes: 3 additions & 3 deletions cardano-submit-api/cardano-submit-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ library
, aeson
, async
, bytestring
, cardano-api ^>= 8.8
, cardano-api ^>= 8.12
, cardano-binary
, cardano-cli ^>= 8.4
, cardano-cli ^>= 8.5
, cardano-crypto-class ^>= 2.1
, cardano-ledger-byron ^>= 1.0
, formatting
Expand Down Expand Up @@ -86,7 +86,7 @@ executable cardano-submit-api
ghc-options: -threaded -rtsopts "-with-rtsopts=-T -I0"
build-depends: base
, optparse-applicative-fork
, cardano-cli ^>= 8.4
, cardano-cli ^>= 8.5
, cardano-crypto-class ^>= 2.1
, cardano-submit-api

Expand Down
12 changes: 6 additions & 6 deletions cardano-testnet/cardano-testnet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ library
build-depends: aeson
, ansi-terminal
, bytestring
, cardano-api ^>= 8.8
, cardano-cli ^>= 8.4
, cardano-api ^>= 8.12
, cardano-cli ^>= 8.5
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-ledger-alonzo
Expand Down Expand Up @@ -150,7 +150,7 @@ test-suite cardano-testnet-golden
ghc-options: -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T

build-tool-depends: cardano-node:cardano-node
, cardano-cli:cardano-cli ^>= 8.4
, cardano-cli:cardano-cli ^>= 8.5
, cardano-submit-api:cardano-submit-api
, cardano-testnet:cardano-testnet

Expand All @@ -176,8 +176,8 @@ test-suite cardano-testnet-test
build-depends: aeson
, async
, bytestring
, cardano-api ^>= 8.8
, cardano-cli ^>= 8.4
, cardano-api ^>= 8.12
, cardano-cli ^>= 8.5
, cardano-crypto-class
, cardano-testnet
, containers
Expand All @@ -194,6 +194,6 @@ test-suite cardano-testnet-test
ghc-options: -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T

build-tool-depends: cardano-node:cardano-node
, cardano-cli:cardano-cli ^>= 8.4
, cardano-cli:cardano-cli ^>= 8.5
, cardano-submit-api:cardano-submit-api
, cardano-testnet:cardano-testnet
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a29ee68

Please sign in to comment.