ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.MiniProtocol.LeiosFetch.Client.Replies

Description

What the node's LeiosFetch clients do: send the requests the decision logic assigned to their peer, and take in the replies.

Taking in a reply is where the node acquires an endorser block or its transactions, so it is also where it emits each acquisition, once the write is durable: AcquiredEb when the body is, and AcquiredEbTxs when no job of its closure remains. An endorser block the node forged is acquired here too, as one that arrived with no peer (acquireForgedEb).

Synopsis

Documentation

data LeiosFetchClientContext (m ∷ Type → Type) peer Source #

What every LeiosFetch client of the node shares.

Constructors

MkLeiosFetchClientContext 

Fields

data ExnLeiosFetchInvalidReply Source #

A reply an honest peer would not send; the ensuing thread death disconnects it.

Constructors

ExnLeiosBlockWrongHash

The endorser block does not have the requested hash.

Fields

ExnLeiosBlockWrongSize

The endorser block has the requested hash, but not the size the peer offered it at.

Fields

ExnLeiosBlockUndecodable !LeiosPoint !DecoderError

The endorser block has the requested hash, but does not decode, so no honest peer holds it.

ExnLeiosBlockTooBig

The endorser block is larger than the ledger allows.

Fields

ExnLeiosClosureTooBig

The endorser block references more transaction bytes than the ledger allows.

Fields

ExnLeiosBlockTxsWrongCount

Not as many transactions arrived as were requested.

Fields

ExnLeiosBlockTxsJobMismatch !LeiosPoint !LeiosJobId !JobMismatch

The transactions that arrived for a job are not the ones its endorser block lists.

data JobMismatch Source #

How a job's transactions differ from what it covers.

Instances

Instances details
Show JobMismatch Source # 
Instance details

Defined in Ouroboros.Consensus.MiniProtocol.LeiosFetch.Client.Replies

awaitTerminate ∷ ∀ (m ∷ Type → Type). IOLike m ⇒ ControlMessageSTM m → STM m () Source #

Blocks until this peer's client should stop.

nextLeiosFetchJob Source #

Arguments

∷ ∀ peer (m ∷ Type → Type). (Ord peer, IOLike m) 
⇒ LeiosFetchClientContext m peer 
→ peer 
→ StrictTVar m (Seq LeiosFetchRequest)

the requests the decision logic assigned to this peer and the client has not sent yet

→ STM m (SomeLeiosFetchJob LeiosPoint (Serialised EndorserBlock) LeiosTx m) 

The next request the decision logic assigned to this peer, with what to do with its reply. Blocks until there is one.

processLeiosBlock ∷ (Ord peer, IOLike m) ⇒ LeiosFetchClientContext m peer → peer → LeiosBlockRequest → Serialised EndorserBlock → m () Source #

Take in an endorser block that arrived in reply to this request.

The hash is the whole of it: these bytes either are the endorser block we asked for or they are not, and no announcement gets a say. Bytes that are the right block but not the size the peer offered still cost the peer its connection. Bytes larger than the ledger allows, referencing more transaction bytes than it allows, or that do not decode, are never written, so the node never offers them onward.

The hash is checked before the bytes are decoded. They decode at Dijkstra's ledger version, the only era with endorser blocks.

processLeiosBlockTxs ∷ (Ord peer, IOLike m) ⇒ LeiosFetchClientContext m peer → peer → LeiosBlockTxsRequest → Vector LeiosTx → m () Source #

Take in transactions that arrived in reply to this request.

acquireForgedEb ∷ IOLike m ⇒ LeiosFetchClientContext m peer → ElectionId → ForgedEndorserBlock → m () Source #

Acquire an endorser block the node's own forge produced in this election, as one that arrived with no peer: take its body into the LeiosTxCache, write it and all its txs, and once both writes land, record those txs in the LeiosTxCache as validated, hold it with no job left (holdForgedEb) and emit the acquisitions not yet emitted at its point.

Its bytes are not checked: the forge built the body from these very txs. No tx is filled from another point, since all of them are written.

So AcquiredEb, and with it the node's offer of the body, waits for the txs write as well as the body's.