// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; package mempool; import "transaction.proto"; import "mempool_status.proto"; // ----------------------------------------------------------------------------- // ---------------- Mempool Service Definition // ----------------------------------------------------------------------------- service Mempool { // Adds a new transaction to the mempool with validation against existing // transactions in the mempool. Note that this function performs additional // validation that AC is unable to perform. (because AC knows only about a // single transaction, but mempool potentially knows about multiple pending // transactions) rpc AddTransactionWithValidation(AddTransactionWithValidationRequest) returns (AddTransactionWithValidationResponse) {} // Fetch ordered block of transactions rpc GetBlock(GetBlockRequest) returns (GetBlockResponse) {} // Remove committed transactions from Mempool rpc CommitTransactions(CommitTransactionsRequest) returns (CommitTransactionsResponse) {} // Check the health of mempool rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse) {} } // ----------------------------------------------------------------------------- // ---------------- AddTransactionWithValidation // ----------------------------------------------------------------------------- message AddTransactionWithValidationRequest { // Transaction from a wallet types.SignedTransaction signed_txn = 1; // Max amount of gas required to execute the transaction // Without running the program, it is very difficult to determine this number, // so we use the max gas specified by the signed transaction. // This field is still included separately from the signed transaction so that // if we have a better methodology in the future, we can more accurately // specify the max gas. uint64 max_gas_cost = 2; // Latest sequence number of the involved account from state db. uint64 latest_sequence_number = 3; // Latest account balance of the involved account from state db. uint64 account_balance = 4; } message AddTransactionWithValidationResponse { // The ledger version at the time of the transaction submitted. The submitted // transaction will have version bigger than this 'current_version' uint64 current_version = 1; // The result of the transaction submission MempoolAddTransactionStatus status = 2; } // ----------------------------------------------------------------------------- // ---------------- GetBlock // ----------------------------------------------------------------------------- message GetBlockRequest { uint64 max_block_size = 1; repeated TransactionExclusion transactions = 2; } message GetBlockResponse { types.SignedTransactionsBlock block = 1; } message TransactionExclusion { bytes sender = 1; uint64 sequence_number = 2; } // ----------------------------------------------------------------------------- // ---------------- CommitTransactions // ----------------------------------------------------------------------------- message CommitTransactionsRequest { repeated CommittedTransaction transactions = 1; // agreed monotonic timestamp microseconds since the epoch for a committed block // used by Mempool to GC expired transactions uint64 block_timestamp_usecs = 2; } message CommitTransactionsResponse {} message CommittedTransaction { bytes sender = 1; uint64 sequence_number = 2; bool is_rejected = 3; } // ----------------------------------------------------------------------------- // ---------------- HealthCheck // ----------------------------------------------------------------------------- message HealthCheckRequest { } message HealthCheckResponse { // Indicate whether Mempool is in healthy condition. bool is_healthy = 1; }