Skip to content
Juvix imports

module arch.node.engines.mempool_worker_messages;

import prelude open;
import arch.node.types.basics open;
import arch.node.types.identities open;

Mempool Worker Messages

These are the specific messages that the Mempool Worker engine can receive/respond to.

Message interface

MempoolWorkerMsgTransactionRequest TransactionRequest

A request from a user or solver to order and execute a transaction candidate.

type TransactionRequest : Type :=
mkTransactionRequest@{
tx : TransactionCandidate;
resubmission : Option TxFingerprint;
};
Arguments
tx
The transaction candidate to be ordered and executed.
resubmission
Optional reference to a previous occurrence of the same transaction candidate (currently unused).

MempoolWorkerMsgTransactionAck TransactionAck

Acknowledgment sent to the user or solver that a transaction request has been accepted.

type TransactionAck : Type :=
mkTransactionAck@{
tx_hash : Hash;
batch_number : BatchNumber;
batch_start : WallClockTime;
worker_id : EngineID;
signature : Signature;
};
Arguments
tx_hash
The hash of the acknowledged transaction candidate (Currently unused).
batch_number
The batch number assigned to the transaction (Currently unused).
batch_start
The wall clock time when the batch was opened (Currently unused).
worker_id
The external identity of the worker engine that processed the transaction.
signature
The signature of the worker engine over the above fields (Currently unused).

MempoolWorkerMsg

type MempoolWorkerMsg :=
| MempoolWorkerMsgTransactionRequest TransactionRequest
| MempoolWorkerMsgTransactionAck TransactionAck;

Sequence Diagrams

Transaction Request Flow

sequenceDiagram
    participant User
    participant MempoolWorker
    participant Shard
    participant Executor

    User->>MempoolWorker: MempoolWorkerMsgTransactionRequest
    MempoolWorker->>User: MempoolWorkerMsgTransactionAck
    MempoolWorker->>Shard: KVSAcquireLock
    Shard->>MempoolWorker: KVSLockAcquired
    MempoolWorker->>Executor: ExecutorPIDAssigned
    Executor->>MempoolWorker: ExecutorFinished
Sequence Diagram: Transaction Request Flow