| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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
- data LeiosFetchClientContext (m ∷ Type → Type) peer = MkLeiosFetchClientContext {
- lfcStaticEnv ∷ !LeiosFetchStaticEnv
- lfcOutstanding ∷ !(StrictMVar m (LeiosOutstanding peer))
- lfcReady ∷ !(StrictMVar m ())
- lfcTxCache ∷ !(LeiosTxCache m () Version PackedEndorserBlock)
- lfcWriter ∷ !(LeiosDbWriter m)
- lfcNotify ∷ !(LeiosAcquisition → STM m ())
- lfcSystemTime ∷ !(SystemTime m)
- lfcTracer ∷ !(Tracer m (TraceLeiosFetchClientEvent peer))
- data ExnLeiosFetchInvalidReply
- = ExnLeiosBlockWrongHash !LeiosPoint !EndorserBlockHash
- | ExnLeiosBlockWrongSize !LeiosPoint !BytesSize !BytesSize
- | ExnLeiosBlockUndecodable !LeiosPoint !DecoderError
- | ExnLeiosBlockTooBig !LeiosPoint !BytesSize !BytesSize
- | ExnLeiosClosureTooBig !LeiosPoint !Word64 !Word64
- | ExnLeiosBlockTxsWrongCount !LeiosPoint !Int !Int
- | ExnLeiosBlockTxsJobMismatch !LeiosPoint !LeiosJobId !JobMismatch
- data JobMismatch
- awaitTerminate ∷ ∀ (m ∷ Type → Type). IOLike m ⇒ ControlMessageSTM m → STM m ()
- nextLeiosFetchJob ∷ ∀ peer (m ∷ Type → Type). (Ord peer, IOLike m) ⇒ LeiosFetchClientContext m peer → peer → StrictTVar m (Seq LeiosFetchRequest) → STM m (SomeLeiosFetchJob LeiosPoint (Serialised EndorserBlock) LeiosTx m)
- processLeiosBlock ∷ (Ord peer, IOLike m) ⇒ LeiosFetchClientContext m peer → peer → LeiosBlockRequest → Serialised EndorserBlock → m ()
- processLeiosBlockTxs ∷ (Ord peer, IOLike m) ⇒ LeiosFetchClientContext m peer → peer → LeiosBlockTxsRequest → Vector LeiosTx → m ()
- acquireForgedEb ∷ IOLike m ⇒ LeiosFetchClientContext m peer → ElectionId → ForgedEndorserBlock → m ()
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. |
Instances
data JobMismatch Source #
How a job's transactions differ from what it covers.
Constructors
| JobBytesSizeMismatch | |
| JobCommitmentMismatch |
Instances
| Show JobMismatch Source # | |
Defined in Ouroboros.Consensus.MiniProtocol.LeiosFetch.Client.Replies Methods showsPrec ∷ Int → JobMismatch → ShowS # show ∷ JobMismatch → String # showList ∷ [JobMismatch] → ShowS # | |
awaitTerminate ∷ ∀ (m ∷ Type → Type). IOLike m ⇒ ControlMessageSTM m → STM m () Source #
Blocks until this peer's client should stop.
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.