Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 authored and Jimbo4350 committed Jan 31, 2024
1 parent a1a4fb1 commit 215e587
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 28 deletions.
17 changes: 2 additions & 15 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ packages:
cardano-api
cardano-api-gen

-- package cardano-api
-- ghc-options: -Werror
package cardano-api
ghc-options: -Werror

package cardano-api-gen
ghc-options: -Werror
Expand All @@ -41,16 +41,3 @@ write-ghc-environment-files: always
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-consensus.git
tag: cb4141a67d686e95d441ad17e758fb63480a0111
subdir:
ouroboros-consensus
ouroboros-consensus-cardano
ouroboros-consensus-protocol
ouroboros-consensus-diffusion
sop-extras
strict-sop-core
--sha256: sha256-HnbevSn4lfaGr8gAIDnLm9OLnyxcHhcQYZoB+x+SItc=
8 changes: 4 additions & 4 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ library internal
, mtl
, network
, optparse-applicative-fork
, ouroboros-consensus ^>= 0.14
, ouroboros-consensus-cardano ^>= 0.12
, ouroboros-consensus-diffusion ^>= 0.9
, ouroboros-consensus-protocol ^>= 0.6
, ouroboros-consensus ^>= 0.15
, ouroboros-consensus-cardano ^>= 0.13
, ouroboros-consensus-diffusion ^>= 0.10
, ouroboros-consensus-protocol ^>= 0.7
, ouroboros-network
, ouroboros-network-api ^>= 0.6.2
, ouroboros-network-framework
Expand Down
5 changes: 3 additions & 2 deletions cardano-api/internal/Cardano/Api/Convenience/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import Cardano.Ledger.CertState (DRepState (..))
import qualified Cardano.Ledger.Credential as L
import qualified Cardano.Ledger.Keys as L
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras (EraMismatch (..))
import Ouroboros.Network.Protocol.LocalStateQuery.Type (Target (..))

import Control.Monad.Trans (MonadTrans (..))
import Control.Monad.Trans.Except (ExceptT (..), runExceptT)
Expand Down Expand Up @@ -130,7 +131,7 @@ determineEra :: ()
=> LocalNodeConnectInfo
-> IO (Either AcquiringFailure AnyCardanoEra)
determineEra localNodeConnInfo =
queryNodeLocalState localNodeConnInfo Nothing QueryCurrentEra
queryNodeLocalState localNodeConnInfo VolatileTip QueryCurrentEra

-- | Execute a query against the local node. The local
-- node must be in CardanoMode.
Expand All @@ -155,6 +156,6 @@ executeQueryAnyMode :: forall result. ()
-> QueryInMode (Either EraMismatch result)
-> IO (Either QueryConvenienceError result)
executeQueryAnyMode localNodeConnInfo q = runExceptT $ do
lift (queryNodeLocalState localNodeConnInfo Nothing q)
lift (queryNodeLocalState localNodeConnInfo VolatileTip q)
& onLeft (left . AcqFailure)
& onLeft (left . QueryEraMismatch)
4 changes: 2 additions & 2 deletions cardano-api/internal/Cardano/Api/IPC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ toAcquiringFailure AcquireFailurePointNotOnChain = AFPointNotOnChain

queryNodeLocalState :: forall result. ()
=> LocalNodeConnectInfo
-> Maybe ChainPoint
-> Net.Query.Target ChainPoint
-> QueryInMode result
-> IO (Either AcquiringFailure result)
queryNodeLocalState connctInfo mpoint query = do
Expand All @@ -549,7 +549,7 @@ queryNodeLocalState connctInfo mpoint query = do
atomically (takeTMVar resultVar)
where
singleQuery
:: Maybe ChainPoint
:: Net.Query.Target ChainPoint
-> TMVar (Either AcquiringFailure result)
-> Net.Query.LocalStateQueryClient BlockInMode ChainPoint QueryInMode IO ()
singleQuery mPointVar' resultVar' =
Expand Down
5 changes: 3 additions & 2 deletions cardano-api/internal/Cardano/Api/IPC/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Cardano.Api.IPC.Version

import Cardano.Ledger.Shelley.Scripts ()
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Client as Net.Query
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Net.Query

import Control.Concurrent.STM
import Control.Monad
Expand Down Expand Up @@ -42,7 +43,7 @@ newtype LocalStateQueryExpr block point query r m a = LocalStateQueryExpr
-- | Execute a local state query expression.
executeLocalStateQueryExpr :: ()
=> LocalNodeConnectInfo
-> Maybe ChainPoint
-> Net.Query.Target ChainPoint
-> LocalStateQueryExpr BlockInMode ChainPoint QueryInMode () IO a
-> IO (Either AcquiringFailure a)
executeLocalStateQueryExpr connectInfo target f = do
Expand All @@ -68,7 +69,7 @@ setupLocalStateQueryExpr ::
-- ^ An STM expression that only returns when all protocols are complete.
-- Protocols must wait until 'waitDone' returns because premature exit will
-- cause other incomplete protocols to abort which may lead to deadlock.
-> Maybe ChainPoint
-> Net.Query.Target ChainPoint
-> TMVar (Either AcquiringFailure a)
-> NodeToClientVersion
-> LocalStateQueryExpr BlockInMode ChainPoint QueryInMode () IO a
Expand Down
5 changes: 2 additions & 3 deletions cardano-api/internal/Cardano/Api/LedgerState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ foldBlocks nodeConfigFilePath socketPath validationMode state0 accumulate = hand
}

-- | Defines the client side of the chain sync protocol.
chainSyncClient :: Word32
chainSyncClient :: Word16
-- ^ The maximum number of concurrent requests.
-> IORef a
-- ^ State accumulator. Written to on every block.
Expand Down Expand Up @@ -1950,7 +1950,7 @@ checkLedgerStateCondition nodeConfigFilePath socketPath validationMode terminati
}

-- | Defines the client side of the chain sync protocol.
chainSyncClient :: Word32
chainSyncClient :: Word16
-- ^ The maximum number of concurrent requests.
-> IORef (LedgerStateCondition, s)
-- ^ State accumulator. Written to on every block.
Expand Down Expand Up @@ -2078,4 +2078,3 @@ atTerminationEpoch terminationEpoch events =

handleIOExceptions :: MonadIOTransError FoldBlocksError t m => ExceptT FoldBlocksError IO a -> t m a
handleIOExceptions = liftEither <=< liftIO . fmap (join . first FoldBlocksIOException) . try . runExceptT

0 comments on commit 215e587

Please sign in to comment.