mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 00:15:51 +00:00
Rearrange sources (#4997)
This commit is contained in:
committed by
John Freeman
parent
2e902dee53
commit
e416ee72ca
4
include/xrpl/proto/README.md
Normal file
4
include/xrpl/proto/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Proto
|
||||
|
||||
This holds protocol buffers source code. The protoc tool stores the output
|
||||
of the .proto files in the build directory.
|
||||
80
include/xrpl/proto/org/xrpl/rpc/v1/README.md
Normal file
80
include/xrpl/proto/org/xrpl/rpc/v1/README.md
Normal file
@@ -0,0 +1,80 @@
|
||||
This folder contains the protocol buffer definitions used by the rippled gRPC API.
|
||||
The gRPC API attempts to mimic the JSON/Websocket API as much as possible.
|
||||
As of April 2020, the gRPC API supports a subset of the full rippled API:
|
||||
tx, account_tx, account_info, fee and submit.
|
||||
|
||||
### Making Changes
|
||||
|
||||
#### Wire Format and Backwards Compatibility
|
||||
|
||||
When making changes to the protocol buffer definitions in this folder, care must
|
||||
be taken to ensure the changes do not break the wire format, which would break
|
||||
backwards compatibility. At a high level, do not change any existing fields.
|
||||
This includes the field's name, type and field number. Do not remove any
|
||||
existing fields. It is always safe to add fields; just remember to give each of
|
||||
the new fields a unique field number. The field numbers don't have to be in any
|
||||
particular order and there can be gaps. More info about what changes break the
|
||||
wire format can be found
|
||||
[here](https://developers.google.com/protocol-buffers/docs/proto3#updating).
|
||||
|
||||
#### Conventions
|
||||
|
||||
For fields that are reused across different message types, we define the field as a unique
|
||||
message type in common.proto. The name of the message type is the same as the
|
||||
field name, with the exception that the field name itself is snake case, whereas
|
||||
the message type is in Pascal case. The message type has one field, called
|
||||
`value`. This pattern does not need to be strictly followed across the entire API,
|
||||
but should be followed for transactions and ledger objects, since there is a high rate
|
||||
of field reuse across different transactions and ledger objects.
|
||||
The motivation for this pattern is two-fold. First, we ensure the field has the
|
||||
same type everywhere that the field is used. Second, wrapping primitive types in
|
||||
their own message type prevents default initialization of those primitive types.
|
||||
For example, `uint32` is initialized to `0` if not explicitly set;
|
||||
there is no way to tell if the client or server set the field to `0` (which may be
|
||||
a valid value for the field) or the field was default initialized.
|
||||
|
||||
#### Name Collisions
|
||||
|
||||
Each message type must have a unique name. To resolve collisions, add a suffix
|
||||
to one or more message types. For instance, ledger objects and transaction types
|
||||
often have the same name (`DepositPreauth` for example). To resolve this, the
|
||||
`DepositPreauth` ledger object is named `DepositPreauthObject`.
|
||||
|
||||
#### To add a field or message type
|
||||
|
||||
To add a field to a message, define the fields type, name and unique index.
|
||||
To add a new message type, give the message type a unique name.
|
||||
Then, add the appropriate C++ code in GRPCHelpers.cpp, or in the handler itself,
|
||||
to serialize/deserialize the new field or message type.
|
||||
|
||||
#### To add a new gRPC method
|
||||
|
||||
To add a new gRPC method, add the gRPC method in xrp_ledger.proto. The method name
|
||||
should begin with a verb. Define the request and response types in their own
|
||||
file. The name of the request type should be the method name suffixed with `Request`, and
|
||||
the response type name should be the method name suffixed with `Response`. For
|
||||
example, the `GetAccountInfo` method has request type `GetAccountInfoRequest` and
|
||||
response type `GetAccountInfoResponse`.
|
||||
|
||||
After defining the protobuf messages for the new method, add an instantiation of the
|
||||
templated `CallData` class in GRPCServerImpl::setupListeners(). The template
|
||||
parameters should be the request type and the response type.
|
||||
|
||||
Finally, define the handler itself in the appropriate file under the
|
||||
src/ripple/rpc/handlers folder. If the method already has a JSON/Websocket
|
||||
equivalent, write the gRPC handler in the same file, and abstract common logic
|
||||
into helper functions (see Tx.cpp or AccountTx.cpp for an example).
|
||||
|
||||
#### Testing
|
||||
|
||||
When modifying an existing gRPC method, be sure to test that modification in the
|
||||
corresponding, existing unit test. When creating a new gRPC method, implement a class that
|
||||
derives from GRPCTestClientBase, and use the newly created class to call the new
|
||||
method. See the class `GrpcTxClient` in the file Tx_test.cpp for an example.
|
||||
The gRPC tests are paired with their JSON counterpart, and the tests should
|
||||
mirror the JSON test as much as possible.
|
||||
|
||||
Refer to the Protocol Buffers [language
|
||||
guide](https://developers.google.com/protocol-buffers/docs/proto3)
|
||||
for more detailed information about Protocol Buffers.
|
||||
|
||||
94
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger.proto
Normal file
94
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger.proto
Normal file
@@ -0,0 +1,94 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package org.xrpl.rpc.v1;
|
||||
option java_package = "org.xrpl.rpc.v1";
|
||||
option java_multiple_files = true;
|
||||
|
||||
import "org/xrpl/rpc/v1/ledger.proto";
|
||||
|
||||
message GetLedgerRequest
|
||||
{
|
||||
|
||||
LedgerSpecifier ledger = 1;
|
||||
|
||||
// If true, include transactions contained in this ledger
|
||||
bool transactions = 2;
|
||||
|
||||
// If true and transactions, include full transactions and metadata
|
||||
// If false and transactions, include only transaction hashes
|
||||
bool expand = 3;
|
||||
|
||||
// If true, include state map difference between this ledger and the
|
||||
// previous ledger. This includes all added, modified or deleted ledger
|
||||
// objects
|
||||
bool get_objects = 4;
|
||||
|
||||
// If the request needs to be forwarded from a reporting node to a p2p node,
|
||||
// the reporting node will set this field. Clients should not set this
|
||||
// field.
|
||||
string client_ip = 5;
|
||||
|
||||
// Identifying string. If user is set, client_ip is not set, and request is
|
||||
// coming from a secure_gateway host, then the client is not subject to
|
||||
// resource controls
|
||||
string user = 6;
|
||||
|
||||
// For every object in the diff, get the object's predecessor and successor
|
||||
// in the state map. Only used if get_objects is also true.
|
||||
bool get_object_neighbors = 7;
|
||||
}
|
||||
|
||||
message GetLedgerResponse
|
||||
{
|
||||
bytes ledger_header = 1;
|
||||
|
||||
oneof transactions
|
||||
{
|
||||
// Just the hashes
|
||||
TransactionHashList hashes_list = 2;
|
||||
|
||||
// Full transactions and metadata
|
||||
TransactionAndMetadataList transactions_list = 3;
|
||||
}
|
||||
|
||||
// True if the ledger has been validated
|
||||
bool validated = 4;
|
||||
|
||||
// State map difference between this ledger and the previous ledger
|
||||
RawLedgerObjects ledger_objects = 5;
|
||||
|
||||
// True if the skiplist object is included in ledger_objects
|
||||
bool skiplist_included = 6;
|
||||
|
||||
// True if request was exempt from resource controls
|
||||
bool is_unlimited = 7;
|
||||
|
||||
// True if the response contains the state map diff
|
||||
bool objects_included = 8;
|
||||
|
||||
// True if the response contains key of objects adjacent to objects in state
|
||||
// map diff
|
||||
bool object_neighbors_included = 9;
|
||||
|
||||
|
||||
// Successor information for book directories modified as part of this
|
||||
// ledger
|
||||
repeated BookSuccessor book_successors = 10;
|
||||
}
|
||||
|
||||
message TransactionHashList
|
||||
{
|
||||
repeated bytes hashes = 1;
|
||||
}
|
||||
|
||||
message TransactionAndMetadata
|
||||
{
|
||||
bytes transaction_blob = 1;
|
||||
|
||||
bytes metadata_blob = 2;
|
||||
}
|
||||
|
||||
message TransactionAndMetadataList
|
||||
{
|
||||
repeated TransactionAndMetadata transactions = 1;
|
||||
}
|
||||
53
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger_data.proto
Normal file
53
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger_data.proto
Normal file
@@ -0,0 +1,53 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package org.xrpl.rpc.v1;
|
||||
option java_package = "org.xrpl.rpc.v1";
|
||||
option java_multiple_files = true;
|
||||
|
||||
import "org/xrpl/rpc/v1/ledger.proto";
|
||||
|
||||
// Get ledger objects for a specific ledger. You can iterate through several
|
||||
// calls to retrieve the entire contents of a single ledger version.
|
||||
message GetLedgerDataRequest
|
||||
{
|
||||
// If set, only objects with a key greater than marker are returned.
|
||||
// This can be used to pick up where a previous call left off.
|
||||
// Set marker to the value of marker in the previous response.
|
||||
bytes marker = 1;
|
||||
|
||||
LedgerSpecifier ledger = 2;
|
||||
|
||||
// If set, only objects with a key less than end_marker are returned
|
||||
bytes end_marker = 3;
|
||||
|
||||
// If the request needs to be forwarded from a reporting node to a p2p node,
|
||||
// the reporting node will set this field. Clients should not set this
|
||||
// field.
|
||||
string client_ip = 4;
|
||||
|
||||
// Identifying string. If user is set, client_ip is not set, and request is
|
||||
// coming from a secure_gateway host, then the client is not subject to
|
||||
// resource controls
|
||||
string user = 6;
|
||||
}
|
||||
|
||||
message GetLedgerDataResponse
|
||||
{
|
||||
// Sequence of the ledger containing the returned ledger objects
|
||||
uint32 ledger_index = 1;
|
||||
|
||||
// Hash of the ledger containing the returned ledger objects
|
||||
bytes ledger_hash = 2;
|
||||
|
||||
// Ledger objects
|
||||
RawLedgerObjects ledger_objects = 3;
|
||||
|
||||
// Key to be passed into a subsequent call to continue iteration. If not
|
||||
// set, there are no more objects left in the ledger, or no more objects
|
||||
// with key less than end_marker (if end_marker was set in the request)
|
||||
bytes marker = 4;
|
||||
|
||||
// True if request was exempt from resource controls
|
||||
bool is_unlimited = 7;
|
||||
}
|
||||
|
||||
32
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger_diff.proto
Normal file
32
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger_diff.proto
Normal file
@@ -0,0 +1,32 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package org.xrpl.rpc.v1;
|
||||
option java_package = "org.xrpl.rpc.v1";
|
||||
option java_multiple_files = true;
|
||||
|
||||
import "org/xrpl/rpc/v1/ledger.proto";
|
||||
|
||||
|
||||
// Get the state map difference between the two specified ledgers
|
||||
message GetLedgerDiffRequest
|
||||
{
|
||||
LedgerSpecifier base_ledger = 1;
|
||||
|
||||
LedgerSpecifier desired_ledger = 2;
|
||||
|
||||
// If true, include the full ledger object. If false, only keys are included.
|
||||
bool include_blobs = 3;
|
||||
|
||||
// If the request needs to be forwarded from a reporting node to a p2p node,
|
||||
// the reporting node will set this field. Clients should not set this
|
||||
// field.
|
||||
string client_ip = 4;
|
||||
}
|
||||
|
||||
message GetLedgerDiffResponse
|
||||
{
|
||||
// All ledger objects that were added, modified or deleted between
|
||||
// base_ledger and desired_ledger
|
||||
RawLedgerObjects ledger_objects = 1;
|
||||
}
|
||||
|
||||
31
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger_entry.proto
Normal file
31
include/xrpl/proto/org/xrpl/rpc/v1/get_ledger_entry.proto
Normal file
@@ -0,0 +1,31 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package org.xrpl.rpc.v1;
|
||||
option java_package = "org.xrpl.rpc.v1";
|
||||
option java_multiple_files = true;
|
||||
|
||||
import "org/xrpl/rpc/v1/ledger.proto";
|
||||
|
||||
// Get a single ledger object
|
||||
message GetLedgerEntryRequest
|
||||
{
|
||||
// Key of the desired object
|
||||
bytes key = 1;
|
||||
|
||||
// Ledger containing the object
|
||||
LedgerSpecifier ledger = 2;
|
||||
|
||||
// If the request needs to be forwarded from a reporting node to a p2p node,
|
||||
// the reporting node will set this field. Clients should not set this
|
||||
// field.
|
||||
string client_ip = 3;
|
||||
}
|
||||
|
||||
message GetLedgerEntryResponse
|
||||
{
|
||||
RawLedgerObject ledger_object = 1;
|
||||
|
||||
// Ledger containing the object. Will match the value specified in the
|
||||
// request.
|
||||
LedgerSpecifier ledger = 2;
|
||||
}
|
||||
75
include/xrpl/proto/org/xrpl/rpc/v1/ledger.proto
Normal file
75
include/xrpl/proto/org/xrpl/rpc/v1/ledger.proto
Normal file
@@ -0,0 +1,75 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package org.xrpl.rpc.v1;
|
||||
option java_package = "org.xrpl.rpc.v1";
|
||||
option java_multiple_files = true;
|
||||
|
||||
// Next field: 4
|
||||
message LedgerSpecifier
|
||||
{
|
||||
// Next field: 4
|
||||
enum Shortcut
|
||||
{
|
||||
SHORTCUT_UNSPECIFIED = 0;
|
||||
SHORTCUT_VALIDATED = 1;
|
||||
SHORTCUT_CLOSED = 2;
|
||||
SHORTCUT_CURRENT = 3;
|
||||
}
|
||||
|
||||
oneof ledger
|
||||
{
|
||||
Shortcut shortcut = 1;
|
||||
uint32 sequence = 2;
|
||||
// 32 bytes
|
||||
bytes hash = 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Next field: 3
|
||||
message RawLedgerObject
|
||||
{
|
||||
// Raw data of the ledger object. In GetLedgerResponse and
|
||||
// GetLedgerDiffResponse, data will be empty if the object was deleted.
|
||||
bytes data = 1;
|
||||
|
||||
// Key of the ledger object
|
||||
bytes key = 2;
|
||||
|
||||
enum ModificationType
|
||||
{
|
||||
UNSPECIFIED = 0;
|
||||
CREATED = 1;
|
||||
MODIFIED = 2;
|
||||
DELETED = 3;
|
||||
}
|
||||
|
||||
// Whether the object was created, modified or deleted
|
||||
ModificationType mod_type = 3;
|
||||
|
||||
// Key of the object preceding this object in the desired ledger
|
||||
bytes predecessor = 4;
|
||||
|
||||
// Key of the object succeeding this object in the desired ledger
|
||||
bytes successor = 5;
|
||||
}
|
||||
|
||||
message RawLedgerObjects
|
||||
{
|
||||
repeated RawLedgerObject objects = 1;
|
||||
}
|
||||
|
||||
// Successor information for book directories. The book base is (usually) not
|
||||
// an actual object, yet we need to be able to ask for the successor to the
|
||||
// book base.
|
||||
message BookSuccessor {
|
||||
|
||||
// Base of the book in question
|
||||
bytes book_base = 1;
|
||||
|
||||
// First book directory in the book. An empty value here means the entire
|
||||
// book is deleted
|
||||
bytes first_book = 2;
|
||||
|
||||
};
|
||||
|
||||
33
include/xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.proto
Normal file
33
include/xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.proto
Normal file
@@ -0,0 +1,33 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package org.xrpl.rpc.v1;
|
||||
option java_package = "org.xrpl.rpc.v1";
|
||||
option java_multiple_files = true;
|
||||
|
||||
import "org/xrpl/rpc/v1/get_ledger.proto";
|
||||
import "org/xrpl/rpc/v1/get_ledger_entry.proto";
|
||||
import "org/xrpl/rpc/v1/get_ledger_data.proto";
|
||||
import "org/xrpl/rpc/v1/get_ledger_diff.proto";
|
||||
|
||||
|
||||
// These methods are binary only methods for retrieiving arbitrary ledger state
|
||||
// via gRPC. These methods are used by clio and reporting mode, but can also be
|
||||
// used by any client that wants to extract ledger state in an efficient manner.
|
||||
// They do not directly mimic the JSON equivalent methods.
|
||||
service XRPLedgerAPIService {
|
||||
|
||||
// Get a specific ledger, optionally including transactions and any modified,
|
||||
// added or deleted ledger objects
|
||||
rpc GetLedger(GetLedgerRequest) returns (GetLedgerResponse);
|
||||
|
||||
// Get a specific ledger object from a specific ledger
|
||||
rpc GetLedgerEntry(GetLedgerEntryRequest) returns (GetLedgerEntryResponse);
|
||||
|
||||
// Iterate through all ledger objects in a specific ledger
|
||||
rpc GetLedgerData(GetLedgerDataRequest) returns (GetLedgerDataResponse);
|
||||
|
||||
// Get all ledger objects that are different between the two specified
|
||||
// ledgers. Note, this method has no JSON equivalent.
|
||||
rpc GetLedgerDiff(GetLedgerDiffRequest) returns (GetLedgerDiffResponse);
|
||||
|
||||
}
|
||||
452
include/xrpl/proto/ripple.proto
Normal file
452
include/xrpl/proto/ripple.proto
Normal file
@@ -0,0 +1,452 @@
|
||||
syntax = "proto2";
|
||||
package protocol;
|
||||
|
||||
// Unused numbers in the list below may have been used previously. Please don't
|
||||
// reassign them for reuse unless you are 100% certain that there won't be a
|
||||
// conflict. Even if you're sure, it's probably best to assign a new type.
|
||||
enum MessageType
|
||||
{
|
||||
mtMANIFESTS = 2;
|
||||
mtPING = 3;
|
||||
mtCLUSTER = 5;
|
||||
mtENDPOINTS = 15;
|
||||
mtTRANSACTION = 30;
|
||||
mtGET_LEDGER = 31;
|
||||
mtLEDGER_DATA = 32;
|
||||
mtPROPOSE_LEDGER = 33;
|
||||
mtSTATUS_CHANGE = 34;
|
||||
mtHAVE_SET = 35;
|
||||
mtVALIDATION = 41;
|
||||
mtGET_OBJECTS = 42;
|
||||
mtGET_SHARD_INFO = 50;
|
||||
mtSHARD_INFO = 51;
|
||||
mtGET_PEER_SHARD_INFO = 52;
|
||||
mtPEER_SHARD_INFO = 53;
|
||||
mtVALIDATORLIST = 54;
|
||||
mtSQUELCH = 55;
|
||||
mtVALIDATORLISTCOLLECTION = 56;
|
||||
mtPROOF_PATH_REQ = 57;
|
||||
mtPROOF_PATH_RESPONSE = 58;
|
||||
mtREPLAY_DELTA_REQ = 59;
|
||||
mtREPLAY_DELTA_RESPONSE = 60;
|
||||
mtGET_PEER_SHARD_INFO_V2 = 61;
|
||||
mtPEER_SHARD_INFO_V2 = 62;
|
||||
mtHAVE_TRANSACTIONS = 63;
|
||||
mtTRANSACTIONS = 64;
|
||||
}
|
||||
|
||||
// token, iterations, target, challenge = issue demand for proof of work
|
||||
// token, response = give solution to proof of work
|
||||
// token, result = report result of pow
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/* Provides the current ephemeral key for a validator. */
|
||||
message TMManifest
|
||||
{
|
||||
// A Manifest object in the Ripple serialization format.
|
||||
required bytes stobject = 1;
|
||||
}
|
||||
|
||||
message TMManifests
|
||||
{
|
||||
repeated TMManifest list = 1;
|
||||
|
||||
// The manifests sent when a peer first connects to another peer are `history`.
|
||||
optional bool history = 2 [deprecated=true];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// The status of a node in our cluster
|
||||
message TMClusterNode
|
||||
{
|
||||
required string publicKey = 1;
|
||||
required uint32 reportTime = 2;
|
||||
required uint32 nodeLoad = 3;
|
||||
optional string nodeName = 4;
|
||||
optional string address = 5;
|
||||
}
|
||||
|
||||
// Sources that are placing load on the server
|
||||
message TMLoadSource
|
||||
{
|
||||
required string name = 1;
|
||||
required uint32 cost = 2;
|
||||
optional uint32 count = 3; // number of connections
|
||||
}
|
||||
|
||||
// The status of all nodes in the cluster
|
||||
message TMCluster
|
||||
{
|
||||
repeated TMClusterNode clusterNodes = 1;
|
||||
repeated TMLoadSource loadSources = 2;
|
||||
}
|
||||
|
||||
// Node public key
|
||||
message TMLink
|
||||
{
|
||||
required bytes nodePubKey = 1 [deprecated=true]; // node public key
|
||||
}
|
||||
|
||||
// Request info on shards held
|
||||
message TMGetPeerShardInfo
|
||||
{
|
||||
required uint32 hops = 1 [deprecated=true]; // number of hops to travel
|
||||
optional bool lastLink = 2 [deprecated=true]; // true if last link in the peer chain
|
||||
repeated TMLink peerChain = 3 [deprecated=true]; // public keys used to route messages
|
||||
}
|
||||
|
||||
// Info about shards held
|
||||
message TMPeerShardInfo
|
||||
{
|
||||
required string shardIndexes = 1 [deprecated=true]; // rangeSet of shard indexes
|
||||
optional bytes nodePubKey = 2 [deprecated=true]; // node public key
|
||||
optional string endpoint = 3 [deprecated=true]; // ipv6 or ipv4 address
|
||||
optional bool lastLink = 4 [deprecated=true]; // true if last link in the peer chain
|
||||
repeated TMLink peerChain = 5 [deprecated=true]; // public keys used to route messages
|
||||
}
|
||||
|
||||
// Peer public key
|
||||
message TMPublicKey
|
||||
{
|
||||
required bytes publicKey = 1;
|
||||
}
|
||||
|
||||
// Request peer shard information
|
||||
message TMGetPeerShardInfoV2
|
||||
{
|
||||
// Peer public keys used to route messages
|
||||
repeated TMPublicKey peerChain = 1;
|
||||
|
||||
// Remaining times to relay
|
||||
required uint32 relays = 2;
|
||||
}
|
||||
|
||||
// Peer shard information
|
||||
message TMPeerShardInfoV2
|
||||
{
|
||||
message TMIncomplete
|
||||
{
|
||||
required uint32 shardIndex = 1;
|
||||
required uint32 state = 2;
|
||||
|
||||
// State completion percent, 1 - 100
|
||||
optional uint32 progress = 3;
|
||||
}
|
||||
|
||||
// Message creation time
|
||||
required uint32 timestamp = 1;
|
||||
|
||||
// Incomplete shards being acquired or verified
|
||||
repeated TMIncomplete incomplete = 2;
|
||||
|
||||
// Verified immutable shards (RangeSet)
|
||||
optional string finalized = 3;
|
||||
|
||||
// Public key of node that authored the shard info
|
||||
required bytes publicKey = 4;
|
||||
|
||||
// Digital signature of node that authored the shard info
|
||||
required bytes signature = 5;
|
||||
|
||||
// Peer public keys used to route messages
|
||||
repeated TMPublicKey peerChain = 6;
|
||||
}
|
||||
|
||||
// A transaction can have only one input and one output.
|
||||
// If you want to send an amount that is greater than any single address of yours
|
||||
// you must first combine coins from one address to another.
|
||||
|
||||
enum TransactionStatus
|
||||
{
|
||||
tsNEW = 1; // origin node did/could not validate
|
||||
tsCURRENT = 2; // scheduled to go in this ledger
|
||||
tsCOMMITED = 3; // in a closed ledger
|
||||
tsREJECT_CONFLICT = 4;
|
||||
tsREJECT_INVALID = 5;
|
||||
tsREJECT_FUNDS = 6;
|
||||
tsHELD_SEQ = 7;
|
||||
tsHELD_LEDGER = 8; // held for future ledger
|
||||
}
|
||||
|
||||
message TMTransaction
|
||||
{
|
||||
required bytes rawTransaction = 1;
|
||||
required TransactionStatus status = 2;
|
||||
optional uint64 receiveTimestamp = 3;
|
||||
optional bool deferred = 4; // not applied to open ledger
|
||||
}
|
||||
|
||||
message TMTransactions
|
||||
{
|
||||
repeated TMTransaction transactions = 1;
|
||||
}
|
||||
|
||||
|
||||
enum NodeStatus
|
||||
{
|
||||
nsCONNECTING = 1; // acquiring connections
|
||||
nsCONNECTED = 2; // convinced we are connected to the real network
|
||||
nsMONITORING = 3; // we know what the previous ledger is
|
||||
nsVALIDATING = 4; // we have the full ledger contents
|
||||
nsSHUTTING = 5; // node is shutting down
|
||||
}
|
||||
|
||||
enum NodeEvent
|
||||
{
|
||||
neCLOSING_LEDGER = 1; // closing a ledger because its close time has come
|
||||
neACCEPTED_LEDGER = 2; // accepting a closed ledger, we have finished computing it
|
||||
neSWITCHED_LEDGER = 3; // changing due to network consensus
|
||||
neLOST_SYNC = 4;
|
||||
}
|
||||
|
||||
message TMStatusChange
|
||||
{
|
||||
optional NodeStatus newStatus = 1;
|
||||
optional NodeEvent newEvent = 2;
|
||||
optional uint32 ledgerSeq = 3;
|
||||
optional bytes ledgerHash = 4;
|
||||
optional bytes ledgerHashPrevious = 5;
|
||||
optional uint64 networkTime = 6;
|
||||
optional uint32 firstSeq = 7;
|
||||
optional uint32 lastSeq = 8;
|
||||
}
|
||||
|
||||
|
||||
// Announce to the network our position on a closing ledger
|
||||
message TMProposeSet
|
||||
{
|
||||
required uint32 proposeSeq = 1;
|
||||
required bytes currentTxHash = 2; // the hash of the ledger we are proposing
|
||||
required bytes nodePubKey = 3;
|
||||
required uint32 closeTime = 4;
|
||||
required bytes signature = 5; // signature of above fields
|
||||
required bytes previousledger = 6;
|
||||
repeated bytes addedTransactions = 10; // not required if number is large
|
||||
repeated bytes removedTransactions = 11; // not required if number is large
|
||||
|
||||
// node vouches signature is correct
|
||||
optional bool checkedSignature = 7 [deprecated=true];
|
||||
|
||||
// Number of hops traveled
|
||||
optional uint32 hops = 12 [deprecated=true];
|
||||
}
|
||||
|
||||
enum TxSetStatus
|
||||
{
|
||||
tsHAVE = 1; // We have this set locally
|
||||
tsCAN_GET = 2; // We have a peer with this set
|
||||
tsNEED = 3; // We need this set and can't get it
|
||||
}
|
||||
|
||||
message TMHaveTransactionSet
|
||||
{
|
||||
required TxSetStatus status = 1;
|
||||
required bytes hash = 2;
|
||||
}
|
||||
|
||||
// Validator list (UNL)
|
||||
message TMValidatorList
|
||||
{
|
||||
required bytes manifest = 1;
|
||||
required bytes blob = 2;
|
||||
required bytes signature = 3;
|
||||
required uint32 version = 4;
|
||||
}
|
||||
|
||||
// Validator List v2
|
||||
message ValidatorBlobInfo
|
||||
{
|
||||
optional bytes manifest = 1;
|
||||
required bytes blob = 2;
|
||||
required bytes signature = 3;
|
||||
}
|
||||
|
||||
// Collection of Validator List v2 (UNL)
|
||||
message TMValidatorListCollection
|
||||
{
|
||||
required uint32 version = 1;
|
||||
required bytes manifest = 2;
|
||||
repeated ValidatorBlobInfo blobs = 3;
|
||||
}
|
||||
|
||||
// Used to sign a final closed ledger after reprocessing
|
||||
message TMValidation
|
||||
{
|
||||
// The serialized validation
|
||||
required bytes validation = 1;
|
||||
|
||||
// node vouches signature is correct
|
||||
optional bool checkedSignature = 2 [deprecated = true];
|
||||
|
||||
// Number of hops traveled
|
||||
optional uint32 hops = 3 [deprecated = true];
|
||||
}
|
||||
|
||||
// An array of Endpoint messages
|
||||
message TMEndpoints
|
||||
{
|
||||
// Previously used - don't reuse.
|
||||
reserved 2;
|
||||
|
||||
// This field is used to allow the TMEndpoints message format to be
|
||||
// modified as necessary in the future.
|
||||
required uint32 version = 1;
|
||||
|
||||
// An update to the Endpoint type that uses a string
|
||||
// to represent endpoints, thus allowing ipv6 or ipv4 addresses
|
||||
message TMEndpointv2
|
||||
{
|
||||
required string endpoint = 1;
|
||||
required uint32 hops = 2;
|
||||
}
|
||||
repeated TMEndpointv2 endpoints_v2 = 3;
|
||||
};
|
||||
|
||||
message TMIndexedObject
|
||||
{
|
||||
optional bytes hash = 1;
|
||||
optional bytes nodeID = 2;
|
||||
optional bytes index = 3;
|
||||
optional bytes data = 4;
|
||||
optional uint32 ledgerSeq = 5;
|
||||
}
|
||||
|
||||
message TMGetObjectByHash
|
||||
{
|
||||
enum ObjectType {
|
||||
otUNKNOWN = 0;
|
||||
otLEDGER = 1;
|
||||
otTRANSACTION = 2;
|
||||
otTRANSACTION_NODE = 3;
|
||||
otSTATE_NODE = 4;
|
||||
otCAS_OBJECT = 5;
|
||||
otFETCH_PACK = 6;
|
||||
otTRANSACTIONS = 7;
|
||||
}
|
||||
|
||||
required ObjectType type = 1;
|
||||
required bool query = 2; // is this a query or a reply?
|
||||
optional uint32 seq = 3; // used to match replies to queries
|
||||
optional bytes ledgerHash = 4; // the hash of the ledger these queries are for
|
||||
optional bool fat = 5; // return related nodes
|
||||
repeated TMIndexedObject objects = 6; // the specific objects requested
|
||||
}
|
||||
|
||||
|
||||
message TMLedgerNode
|
||||
{
|
||||
required bytes nodedata = 1;
|
||||
optional bytes nodeid = 2; // missing for ledger base data
|
||||
}
|
||||
|
||||
enum TMLedgerInfoType
|
||||
{
|
||||
liBASE = 0; // basic ledger info
|
||||
liTX_NODE = 1; // transaction node
|
||||
liAS_NODE = 2; // account state node
|
||||
liTS_CANDIDATE = 3; // candidate transaction set
|
||||
}
|
||||
|
||||
enum TMLedgerType
|
||||
{
|
||||
ltACCEPTED = 0;
|
||||
ltCURRENT = 1; // no longer supported
|
||||
ltCLOSED = 2;
|
||||
}
|
||||
|
||||
enum TMQueryType
|
||||
{
|
||||
qtINDIRECT = 0;
|
||||
}
|
||||
|
||||
message TMGetLedger
|
||||
{
|
||||
required TMLedgerInfoType itype = 1;
|
||||
optional TMLedgerType ltype = 2;
|
||||
optional bytes ledgerHash = 3; // Can also be the transaction set hash if liTS_CANDIDATE
|
||||
optional uint32 ledgerSeq = 4;
|
||||
repeated bytes nodeIDs = 5;
|
||||
optional uint64 requestCookie = 6;
|
||||
optional TMQueryType queryType = 7;
|
||||
optional uint32 queryDepth = 8; // How deep to go, number of extra levels
|
||||
}
|
||||
|
||||
enum TMReplyError
|
||||
{
|
||||
reNO_LEDGER = 1; // We don't have the ledger you are asking about
|
||||
reNO_NODE = 2; // We don't have any of the nodes you are asking for
|
||||
reBAD_REQUEST = 3; // The request is wrong, e.g. wrong format
|
||||
}
|
||||
|
||||
message TMLedgerData
|
||||
{
|
||||
required bytes ledgerHash = 1;
|
||||
required uint32 ledgerSeq = 2;
|
||||
required TMLedgerInfoType type = 3;
|
||||
repeated TMLedgerNode nodes = 4;
|
||||
optional uint32 requestCookie = 5;
|
||||
optional TMReplyError error = 6;
|
||||
}
|
||||
|
||||
message TMPing
|
||||
{
|
||||
enum pingType {
|
||||
ptPING = 0; // we want a reply
|
||||
ptPONG = 1; // this is a reply
|
||||
}
|
||||
required pingType type = 1;
|
||||
optional uint32 seq = 2; // detect stale replies, ensure other side is reading
|
||||
optional uint64 pingTime = 3; // know when we think we sent the ping
|
||||
optional uint64 netTime = 4;
|
||||
}
|
||||
|
||||
message TMSquelch
|
||||
{
|
||||
required bool squelch = 1; // squelch if true, otherwise unsquelch
|
||||
required bytes validatorPubKey = 2; // validator's public key
|
||||
optional uint32 squelchDuration = 3; // squelch duration in seconds
|
||||
}
|
||||
|
||||
enum TMLedgerMapType
|
||||
{
|
||||
lmTRANASCTION = 1; // transaction map
|
||||
lmACCOUNT_STATE = 2; // account state map
|
||||
}
|
||||
|
||||
message TMProofPathRequest
|
||||
{
|
||||
required bytes key = 1;
|
||||
required bytes ledgerHash = 2;
|
||||
required TMLedgerMapType type = 3;
|
||||
}
|
||||
|
||||
message TMProofPathResponse
|
||||
{
|
||||
required bytes key = 1;
|
||||
required bytes ledgerHash = 2;
|
||||
required TMLedgerMapType type = 3;
|
||||
optional bytes ledgerHeader = 4;
|
||||
repeated bytes path = 5;
|
||||
optional TMReplyError error = 6;
|
||||
}
|
||||
|
||||
message TMReplayDeltaRequest
|
||||
{
|
||||
required bytes ledgerHash = 1;
|
||||
}
|
||||
|
||||
message TMReplayDeltaResponse
|
||||
{
|
||||
required bytes ledgerHash = 1;
|
||||
optional bytes ledgerHeader = 2;
|
||||
repeated bytes transaction = 3;
|
||||
optional TMReplyError error = 4;
|
||||
}
|
||||
|
||||
message TMHaveTransactions
|
||||
{
|
||||
repeated bytes hashes = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user