Skip to content

Commit

Permalink
Replace fromConsensPointHF with fromConsensusPointInMode
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Nov 30, 2022
1 parent d94f110 commit 0374dd0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ changes.

- **BREAKING** `hydra-cardano-api` changes:
+ Remove `Hydra.Cardano.Api.SlotNo` module.
+ Replace `fromConsensusPointHF` with `fromConsensusPointInMode` and
`toConsensusPointHF` with `toConsensusPointInMode`.
+ Re-export new `AcquiringFailure` type from `cardano-api`.

## [0.8.1] - 2022-11-17
Expand Down
2 changes: 2 additions & 0 deletions hydra-cardano-api/src/Hydra/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ import Cardano.Api.Shelley as X (
ShelleyLedgerEra,
SigningKey (..),
VerificationKey (..),
fromConsensusPointInMode,
fromPlutusData,
toConsensusPointInMode,
toPlutusData,
)
import Cardano.Api.UTxO (
Expand Down
4 changes: 2 additions & 2 deletions hydra-node/src/Hydra/Chain/Direct.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import Hydra.Cardano.Api (
NetworkId,
Tx,
TxId,
fromConsensusPointHF,
fromConsensusPointInMode,
shelleyBasedEra,
toConsensusPointHF,
toLedgerPParams,
Expand Down Expand Up @@ -347,7 +347,7 @@ chainSyncClient handler wallet startingPoint =
pure clientStIdle
, recvMsgRollBackward = \point _tip -> ChainSyncClient $ do
-- Re-initialize the tiny wallet
reset wallet $ fromConsensusPointHF point
reset wallet $ fromConsensusPointInMode CardanoMode point
-- Rollback main chain sync handler
onRollBackward handler point
pure clientStIdle
Expand Down
7 changes: 4 additions & 3 deletions hydra-node/src/Hydra/Chain/Direct/Handlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import Control.Monad.Class.MonadSTM (throwSTM)
import Data.Sequence.Strict (StrictSeq)
import Hydra.Cardano.Api (
ChainPoint (..),
ConsensusMode (CardanoMode),
LedgerEra,
Tx,
TxId,
chainPointToSlotNo,
fromConsensusPointHF,
fromConsensusPointInMode,
fromLedgerTx,
fromLedgerTxIn,
getTxBody,
Expand Down Expand Up @@ -194,13 +195,13 @@ chainSyncHandler tracer callback getTimeHandle ctx =
where
onRollBackward :: Point Block -> m ()
onRollBackward rollbackPoint = do
let point = fromConsensusPointHF rollbackPoint
let point = fromConsensusPointInMode CardanoMode rollbackPoint
traceWith tracer $ RolledBackward{point}
callback (const . Just $ Rollback $ chainSlotFromPoint point)

onRollForward :: Block -> m ()
onRollForward blk = do
let point = fromConsensusPointHF $ blockPoint blk
let point = fromConsensusPointInMode CardanoMode $ blockPoint blk
let receivedTxs = map fromLedgerTx . toList $ getBabbageTxs blk
traceWith tracer $
RolledForward
Expand Down
5 changes: 3 additions & 2 deletions hydra-node/src/Hydra/Chain/Direct/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import qualified Data.Sequence.Strict as StrictSeq
import qualified Data.Set as Set
import Hydra.Cardano.Api (
ChainPoint,
ConsensusMode (CardanoMode),
LedgerEra,
NetworkId,
PaymentCredential (PaymentCredentialByKey),
Expand All @@ -55,7 +56,7 @@ import Hydra.Cardano.Api (
SigningKey,
StakeAddressReference (NoStakeAddress),
VerificationKey,
fromConsensusPointHF,
fromConsensusPointInMode,
makeShelleyAddress,
shelleyAddressInEra,
toLedgerAddr,
Expand Down Expand Up @@ -145,7 +146,7 @@ newTinyWallet tracer networkId (vk, sk) chainPoint queryUTxOEtc = do
atomically $ writeTVar utxoVar res
traceWith tracer $ EndInitialize{initialUTxO}
, update = \block -> do
let point = fromConsensusPointHF $ blockPoint block
let point = fromConsensusPointInMode CardanoMode $ blockPoint block
traceWith tracer $ BeginUpdate{point}
utxo' <- atomically $ do
(utxo, pparams, systemStart, epochInfo) <- readTVar utxoVar
Expand Down

0 comments on commit 0374dd0

Please sign in to comment.