ouroboros-consensus-0.24.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Ledger.Query

Synopsis

Documentation

data family BlockQuery blk ∷ TypeType Source #

Different queries supported by the ledger, indexed by the result type.

Instances

Instances details
All SingleEraBlock xs ⇒ SameDepIndex (BlockQuery (HardForkBlock xs)) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

SameDepIndex (BlockQuery (DualBlock m a)) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

sameDepIndexBlockQuery (DualBlock m a) a0 → BlockQuery (DualBlock m a) b → Maybe (a0 :~: b) Source #

All SingleEraBlock xs ⇒ ShowQuery (BlockQuery (HardForkBlock xs)) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

Methods

showResultBlockQuery (HardForkBlock xs) result → result → String Source #

ShowQuery (BlockQuery (DualBlock m a)) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showResultBlockQuery (DualBlock m a) result → result → String Source #

SerialiseHFC xs ⇒ SerialiseResult (HardForkBlock xs) (BlockQuery (HardForkBlock xs)) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.SerialiseNodeToClient

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) (SomeSecond BlockQuery (HardForkBlock xs)) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.SerialiseNodeToClient

All SingleEraBlock xs ⇒ Show (BlockQuery (HardForkBlock xs) result) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

Methods

showsPrecIntBlockQuery (HardForkBlock xs) result → ShowS #

showBlockQuery (HardForkBlock xs) result → String #

showList ∷ [BlockQuery (HardForkBlock xs) result] → ShowS #

Show (BlockQuery (DualBlock m a) result) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showsPrecIntBlockQuery (DualBlock m a) result → ShowS #

showBlockQuery (DualBlock m a) result → String #

showList ∷ [BlockQuery (DualBlock m a) result] → ShowS #

Typeable xs ⇒ ShowProxy (BlockQuery (HardForkBlock xs) ∷ TypeType) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

(Typeable m, Typeable a) ⇒ ShowProxy (BlockQuery (DualBlock m a) ∷ TypeType) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Inject (SomeSecond BlockQuery) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Nary

Methods

inject ∷ ∀ x (xs ∷ [Type]). CanHardFork xs ⇒ InjectionIndex xs x → SomeSecond BlockQuery x → SomeSecond BlockQuery (HardForkBlock xs) Source #

(∀ result. Show (BlockQuery blk result)) ⇒ Show (SomeSecond BlockQuery blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

SameDepIndex (BlockQuery blk) ⇒ Eq (SomeSecond BlockQuery blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

data BlockQuery (HardForkBlock xs) a Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

data BlockQuery (HardForkBlock xs) a where
data BlockQuery (DualBlock m a) result Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

data BlockQuery (DualBlock m a) result

class (ShowQuery (BlockQuery blk), SameDepIndex (BlockQuery blk)) ⇒ BlockSupportsLedgerQuery blk where Source #

Query the ledger extended state.

Used by the LocalStateQuery protocol to allow clients to query the extended ledger state.

Methods

answerBlockQueryExtLedgerCfg blk → BlockQuery blk result → ExtLedgerState blk → result Source #

Answer the given query about the extended ledger state.

blockQueryIsSupportedOnVersionBlockQuery blk result → BlockNodeToClientVersion blk → Bool Source #

Is the given query supported in this NTC version?

Encoders for queries should call this function before attempting to send a query. The node will still try to answer block queries it knows about even if they are not guaranteed to be supported on the negotiated version, but clients can benefit of knowing beforehand whether the query is expected to not work, even if it decides to send it anyways.

More reasoning on how queries are versioned in Consensus can be seen in https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/QueryVersioning/. In particular this function implements the check described in https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/QueryVersioning/#checks.

data Query blk result where Source #

Different queries supported by the ledger for all block types, indexed by the result type.

Additions to the set of queries is versioned by QueryVersion

Constructors

BlockQueryBlockQuery blk result → Query blk result

This constructor is supported by all QueryVersions. The BlockQuery argument is versioned by the BlockNodeToClientVersion blk.

GetSystemStartQuery blk SystemStart

Get the SystemStart time.

Supported by QueryVersion >= QueryVersion1.

GetChainBlockNoQuery blk (WithOrigin BlockNo)

Get the GetChainBlockNo time.

Supported by QueryVersion >= QueryVersion2.

GetChainPointQuery blk (Point blk)

Get the GetChainPoint time.

Supported by QueryVersion >= QueryVersion2.

GetLedgerConfigQuery blk (LedgerConfig blk)

Get the ledger config.

This constructor is supported by QueryVersion >= QueryVersion3. Serialisation of the LedgerConfig blk result is versioned by the BlockNodeToClientVersion blk.

Instances

Instances details
(SerialiseResult blk (BlockQuery blk), Serialise (HeaderHash blk), SerialiseNodeToClient blk (LedgerConfig blk)) ⇒ SerialiseResult blk (Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

encodeResultCodecConfig blk → BlockNodeToClientVersion blk → Query blk result → result → Encoding Source #

decodeResultCodecConfig blk → BlockNodeToClientVersion blk → Query blk result → ∀ s. Decoder s result Source #

SameDepIndex (BlockQuery blk) ⇒ SameDepIndex (Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

sameDepIndexQuery blk a → Query blk b → Maybe (a :~: b) Source #

(ShowQuery (BlockQuery blk), StandardHash blk) ⇒ ShowQuery (Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

showResultQuery blk result → result → String Source #

Show (BlockQuery blk result) ⇒ Show (Query blk result) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

showsPrecIntQuery blk result → ShowS #

showQuery blk result → String #

showList ∷ [Query blk result] → ShowS #

ShowProxy (BlockQuery blk) ⇒ ShowProxy (Query blk ∷ TypeType) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

showProxyProxy (Query blk) → String Source #

Show (SomeSecond BlockQuery blk) ⇒ Show (SomeSecond Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

showsPrecIntSomeSecond Query blk → ShowS #

showSomeSecond Query blk → String #

showList ∷ [SomeSecond Query blk] → ShowS #

Eq (SomeSecond BlockQuery blk) ⇒ Eq (SomeSecond Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

(==)SomeSecond Query blk → SomeSecond Query blk → Bool #

(/=)SomeSecond Query blk → SomeSecond Query blk → Bool #

data QueryVersion Source #

Version of the `Query blk` type.

Multiple top level queries are now supported. The encoding now has constructor tags for the different top level queries for QueryVersion1 onwards.

Instances

Instances details
Bounded QueryVersion Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query.Version

Enum QueryVersion Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query.Version

Show QueryVersion Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query.Version

Eq QueryVersion Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query.Version

Ord QueryVersion Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query.Version

class (∀ result. Show (query result)) ⇒ ShowQuery (query ∷ TypeType) where Source #

To implement Show for:

('Message' ('LocalStateQuery' block query) st st')

we need a way to print the query GADT and its type index, result. This class contain the method we need to provide this Show instance.

We use a type class for this, as this Show constraint propagates to a lot of places.

Methods

showResult ∷ query result → result → String Source #

Instances

Instances details
ShowQuery QueryAnytime Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

Methods

showResultQueryAnytime result → result → String Source #

All SingleEraBlock xs ⇒ ShowQuery (QueryHardFork xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

Methods

showResultQueryHardFork xs result → result → String Source #

All SingleEraBlock xs ⇒ ShowQuery (QueryIfCurrent xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

Methods

showResultQueryIfCurrent xs result → result → String Source #

All SingleEraBlock xs ⇒ ShowQuery (BlockQuery (HardForkBlock xs)) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

Methods

showResultBlockQuery (HardForkBlock xs) result → result → String Source #

ShowQuery (BlockQuery (DualBlock m a)) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showResultBlockQuery (DualBlock m a) result → result → String Source #

(ShowQuery (BlockQuery blk), StandardHash blk) ⇒ ShowQuery (Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

showResultQuery blk result → result → String Source #

answerQuery ∷ (BlockSupportsLedgerQuery blk, ConfigSupportsNode blk, HasAnnTip blk) ⇒ ExtLedgerCfg blk → Query blk result → ExtLedgerState blk → result Source #

Answer the given query about the extended ledger state.

nodeToClientVersionToQueryVersionNodeToClientVersionQueryVersion Source #

Get the QueryVersion supported by this NodeToClientVersion.