libra_client 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +8 -6
- data/lib/libra/version.rb +1 -1
- data/libra_client.gemspec +1 -0
- data/proto-lib/admission_control_pb.rb +10 -7
- data/proto-lib/consensus_pb.rb +105 -0
- data/proto-lib/events_pb.rb +1 -1
- data/proto-lib/execution_pb.rb +51 -0
- data/proto-lib/execution_services_pb.rb +37 -0
- data/proto-lib/language_storage_pb.rb +17 -0
- data/proto-lib/mempool_pb.rb +18 -0
- data/proto-lib/mempool_status_pb.rb +7 -2
- data/proto-lib/network_pb.rb +59 -0
- data/proto-lib/node_debug_interface_pb.rb +39 -0
- data/proto-lib/node_debug_interface_services_pb.rb +32 -0
- data/proto-lib/proof_pb.rb +6 -0
- data/proto-lib/secret_service_pb.rb +54 -0
- data/proto-lib/secret_service_services_pb.rb +34 -0
- data/proto-lib/state_synchronizer_pb.rb +33 -0
- data/proto-lib/storage_pb.rb +61 -0
- data/proto-lib/storage_services_pb.rb +47 -0
- data/proto-lib/transaction_pb.rb +11 -0
- data/proto-lib/validator_public_keys_pb.rb +19 -0
- data/proto-lib/validator_set_pb.rb +17 -0
- data/proto-lib/vm_errors_pb.rb +84 -70
- data/protos/admission_control.proto +11 -4
- data/protos/consensus.proto +147 -0
- data/protos/events.proto +1 -1
- data/protos/execution.proto +92 -0
- data/protos/language_storage.proto +12 -0
- data/protos/mempool.proto +18 -0
- data/protos/mempool_status.proto +6 -1
- data/protos/network.proto +81 -0
- data/protos/node_debug_interface.proto +40 -0
- data/protos/proof.proto +15 -0
- data/protos/secret_service.proto +64 -0
- data/protos/state_synchronizer.proto +29 -0
- data/protos/storage.proto +115 -0
- data/protos/transaction.proto +16 -1
- data/protos/validator_public_keys.proto +18 -0
- data/protos/validator_set.proto +13 -0
- data/protos/vm_errors.proto +87 -71
- metadata +42 -2
@@ -6,11 +6,9 @@ syntax = "proto3";
|
|
6
6
|
package admission_control;
|
7
7
|
|
8
8
|
import "get_with_proof.proto";
|
9
|
+
import "mempool_status.proto";
|
9
10
|
import "transaction.proto";
|
10
|
-
import "proof.proto";
|
11
|
-
import "ledger_info.proto";
|
12
11
|
import "vm_errors.proto";
|
13
|
-
import "mempool_status.proto";
|
14
12
|
|
15
13
|
// -----------------------------------------------------------------------------
|
16
14
|
// ---------------- Submit transaction
|
@@ -21,11 +19,20 @@ message SubmitTransactionRequest {
|
|
21
19
|
types.SignedTransaction signed_txn = 1;
|
22
20
|
}
|
23
21
|
|
22
|
+
// AC response status containing code and optionally an error message.
|
23
|
+
message AdmissionControlStatus {
|
24
|
+
AdmissionControlStatusCode code = 1;
|
25
|
+
string message = 2;
|
26
|
+
}
|
27
|
+
|
24
28
|
// Additional statuses that are possible from admission control in addition
|
25
29
|
// to VM statuses.
|
26
|
-
enum
|
30
|
+
enum AdmissionControlStatusCode {
|
31
|
+
// Validator accepted the transaction.
|
27
32
|
Accepted = 0;
|
33
|
+
// The sender is blacklisted.
|
28
34
|
Blacklisted = 1;
|
35
|
+
// The transaction is rejected, e.g. due to incorrect signature.
|
29
36
|
Rejected = 2;
|
30
37
|
}
|
31
38
|
|
@@ -0,0 +1,147 @@
|
|
1
|
+
// Copyright (c) The Libra Core Contributors
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
3
|
+
|
4
|
+
syntax = "proto3";
|
5
|
+
|
6
|
+
package network;
|
7
|
+
|
8
|
+
import "ledger_info.proto";
|
9
|
+
import "transaction.proto";
|
10
|
+
|
11
|
+
message ConsensusMsg {
|
12
|
+
oneof message {
|
13
|
+
Proposal proposal = 1;
|
14
|
+
Vote vote = 2;
|
15
|
+
RequestBlock request_block = 3;
|
16
|
+
RespondBlock respond_block = 4;
|
17
|
+
TimeoutMsg timeout_msg = 5;
|
18
|
+
SyncInfo sync_info = 6;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
message Proposal {
|
23
|
+
// The proposed block
|
24
|
+
Block proposed_block = 1;
|
25
|
+
// Information about the highest QC, LedgerInfo, TimeoutCertificate, etc.
|
26
|
+
SyncInfo sync_info = 2;
|
27
|
+
}
|
28
|
+
|
29
|
+
message PacemakerTimeout {
|
30
|
+
// Round that has timed out (e.g. we propose to switch to round + 1)
|
31
|
+
uint64 round = 1;
|
32
|
+
// Author of timeout
|
33
|
+
bytes author = 2;
|
34
|
+
// Signature that this timeout was authored by owner
|
35
|
+
bytes signature = 3;
|
36
|
+
// Optional vote for the given round
|
37
|
+
Vote vote = 4;
|
38
|
+
}
|
39
|
+
|
40
|
+
message TimeoutMsg {
|
41
|
+
// Information about the highest QC, LedgerInfo, TimeoutCertificate, etc.
|
42
|
+
SyncInfo sync_info = 1;
|
43
|
+
// Timeout
|
44
|
+
PacemakerTimeout pacemaker_timeout = 2;
|
45
|
+
// Signature that this timeout was authored by owner
|
46
|
+
bytes signature = 3;
|
47
|
+
}
|
48
|
+
|
49
|
+
message SyncInfo {
|
50
|
+
// Highest quorum certificate
|
51
|
+
QuorumCert highest_quorum_cert = 1;
|
52
|
+
// Highest ledger info
|
53
|
+
QuorumCert highest_ledger_info = 2;
|
54
|
+
// Optional highest timeout certificate if available
|
55
|
+
PacemakerTimeoutCertificate highest_timeout_cert = 3;
|
56
|
+
}
|
57
|
+
|
58
|
+
message PacemakerTimeoutCertificate {
|
59
|
+
// Round for which this certificate was created
|
60
|
+
uint64 round = 1;
|
61
|
+
// List of certified timeouts
|
62
|
+
repeated PacemakerTimeout timeouts = 2;
|
63
|
+
}
|
64
|
+
|
65
|
+
message Block {
|
66
|
+
// This block's id as a hash value
|
67
|
+
bytes id = 1;
|
68
|
+
// Parent block id of this block as a hash value (all zeros to indicate the
|
69
|
+
// genesis block)
|
70
|
+
bytes parent_id = 2;
|
71
|
+
// Payload of the block (e.g. one or more transaction(s)
|
72
|
+
bytes payload = 3;
|
73
|
+
// The round of the block (internal monotonically increasing counter).
|
74
|
+
uint64 round = 4;
|
75
|
+
// The height of the block (position in the chain).
|
76
|
+
uint64 height = 5;
|
77
|
+
// The approximate physical microseconds since the epoch when the block was proposed
|
78
|
+
uint64 timestamp_usecs = 6;
|
79
|
+
// Contains the quorum certified ancestor and whether the quorum certified
|
80
|
+
// ancestor was voted on successfully
|
81
|
+
QuorumCert quorum_cert = 7;
|
82
|
+
// Author of the block that can be validated by the author's public key and
|
83
|
+
// the signature
|
84
|
+
bytes author = 8;
|
85
|
+
// Signature that the hash of this block has been authored by the owner of the
|
86
|
+
// private key
|
87
|
+
bytes signature = 9;
|
88
|
+
}
|
89
|
+
|
90
|
+
message QuorumCert {
|
91
|
+
// The vote information certified by the quorum.
|
92
|
+
VoteData vote_data = 1;
|
93
|
+
// LedgerInfo with at least 2f+1 signatures. The LedgerInfo's consensus data
|
94
|
+
// hash is a digest that covers vote data hash.
|
95
|
+
types.LedgerInfoWithSignatures signed_ledger_info = 2;
|
96
|
+
}
|
97
|
+
|
98
|
+
message VoteData {
|
99
|
+
// The id of the block being vote for.
|
100
|
+
bytes block_id = 1;
|
101
|
+
// The round of the block being voted for
|
102
|
+
uint64 round = 2;
|
103
|
+
// The id and the version of the state after executing the block.
|
104
|
+
bytes executed_state_id = 3;
|
105
|
+
uint64 version = 4;
|
106
|
+
// The id of the parent block
|
107
|
+
bytes parent_block_id = 5;
|
108
|
+
// The round of the parent block
|
109
|
+
uint64 parent_block_round = 6;
|
110
|
+
// The id of the grandparent block
|
111
|
+
bytes grandparent_block_id = 7;
|
112
|
+
// The round of the grandparent block
|
113
|
+
uint64 grandparent_block_round = 8;
|
114
|
+
}
|
115
|
+
|
116
|
+
message Vote {
|
117
|
+
// The actual vote information.
|
118
|
+
VoteData vote_data = 1;
|
119
|
+
// Author of the vote.
|
120
|
+
bytes author = 2;
|
121
|
+
// The ledger info carried with the vote (corresponding to the block of a
|
122
|
+
// potentially committed txn).
|
123
|
+
types.LedgerInfo ledger_info = 3;
|
124
|
+
// Signature of the ledger info.
|
125
|
+
bytes signature = 4;
|
126
|
+
}
|
127
|
+
|
128
|
+
message RequestBlock {
|
129
|
+
// The id of the requested block.
|
130
|
+
bytes block_id = 1;
|
131
|
+
uint64 num_blocks = 2;
|
132
|
+
}
|
133
|
+
|
134
|
+
enum BlockRetrievalStatus {
|
135
|
+
// Successfully fill in the request.
|
136
|
+
SUCCEEDED = 0;
|
137
|
+
// Can not find the block corresponding to block_id.
|
138
|
+
ID_NOT_FOUND = 1;
|
139
|
+
// Can not find enough blocks but find some.
|
140
|
+
NOT_ENOUGH_BLOCKS = 2;
|
141
|
+
}
|
142
|
+
|
143
|
+
message RespondBlock {
|
144
|
+
BlockRetrievalStatus status = 1;
|
145
|
+
// The responded block.
|
146
|
+
repeated Block blocks = 2;
|
147
|
+
}
|
data/protos/events.proto
CHANGED
@@ -0,0 +1,92 @@
|
|
1
|
+
// Copyright (c) The Libra Core Contributors
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
3
|
+
|
4
|
+
syntax = "proto3";
|
5
|
+
|
6
|
+
package execution;
|
7
|
+
|
8
|
+
import "get_with_proof.proto";
|
9
|
+
import "ledger_info.proto";
|
10
|
+
import "transaction.proto";
|
11
|
+
import "validator_set.proto";
|
12
|
+
import "vm_errors.proto";
|
13
|
+
|
14
|
+
// -----------------------------------------------------------------------------
|
15
|
+
// ---------------- Execution Service Definition
|
16
|
+
// -----------------------------------------------------------------------------
|
17
|
+
service Execution {
|
18
|
+
// Execute a list of signed transactions given by consensus. Return the id
|
19
|
+
// of the block and the root hash of the ledger after applying transactions
|
20
|
+
// in this block.
|
21
|
+
rpc ExecuteBlock(ExecuteBlockRequest) returns (ExecuteBlockResponse) {}
|
22
|
+
|
23
|
+
// Commit a previously executed block that has been agreed by consensus.
|
24
|
+
rpc CommitBlock(CommitBlockRequest) returns (CommitBlockResponse) {}
|
25
|
+
|
26
|
+
// Execute and commit a list of signed transactions received from peer
|
27
|
+
// during synchronization. Return the id of the block
|
28
|
+
rpc ExecuteChunk(ExecuteChunkRequest) returns (ExecuteChunkResponse) {}
|
29
|
+
}
|
30
|
+
|
31
|
+
message ExecuteBlockRequest {
|
32
|
+
// The list of transactions from consensus.
|
33
|
+
repeated types.SignedTransaction transactions = 1;
|
34
|
+
|
35
|
+
// Id of the parent block.
|
36
|
+
// We're going to use a special GENESIS_BLOCK_ID constant defined in
|
37
|
+
// crypto::hash module to refer to the block id of the Genesis block, which is
|
38
|
+
// executed in a special way.
|
39
|
+
bytes parent_block_id = 2;
|
40
|
+
|
41
|
+
// Id of the current block.
|
42
|
+
bytes block_id = 3;
|
43
|
+
}
|
44
|
+
|
45
|
+
// Result of transaction execution.
|
46
|
+
message ExecuteBlockResponse {
|
47
|
+
// Root hash of the ledger after applying all the transactions in this
|
48
|
+
// block.
|
49
|
+
bytes root_hash = 1;
|
50
|
+
|
51
|
+
// The execution result of the transactions. Each transaction has a status
|
52
|
+
// field that indicates whether it should be included in the ledger once the
|
53
|
+
// block is committed.
|
54
|
+
repeated types.VMStatus status = 2;
|
55
|
+
|
56
|
+
// The corresponding ledger version when this block is committed.
|
57
|
+
uint64 version = 3;
|
58
|
+
|
59
|
+
// If set, this field designates that if this block is committed, then the
|
60
|
+
// next epoch will start immediately with the included set of validators.
|
61
|
+
types.ValidatorSet validators = 4;
|
62
|
+
}
|
63
|
+
|
64
|
+
message CommitBlockRequest {
|
65
|
+
// The ledger info with signatures from 2f+1 validators. It contains the id
|
66
|
+
// of the block consensus wants to commit. This will cause the given block
|
67
|
+
// and all the uncommitted ancestors to be committed to storage.
|
68
|
+
types.LedgerInfoWithSignatures ledger_info_with_sigs = 1;
|
69
|
+
}
|
70
|
+
|
71
|
+
message CommitBlockResponse { CommitBlockStatus status = 1; }
|
72
|
+
|
73
|
+
enum CommitBlockStatus {
|
74
|
+
// The block is persisted.
|
75
|
+
SUCCEEDED = 0;
|
76
|
+
|
77
|
+
// Something went wrong.
|
78
|
+
FAILED = 1;
|
79
|
+
}
|
80
|
+
|
81
|
+
// Ask Execution service to execute and commit a chunk of contiguous
|
82
|
+
// transactions. All the transactions in this chunk should belong to the same
|
83
|
+
// epoch E. If the caller has a list of transactions that span two epochs, it
|
84
|
+
// should split the transactions.
|
85
|
+
message ExecuteChunkRequest {
|
86
|
+
types.TransactionListWithProof txn_list_with_proof = 1;
|
87
|
+
types.LedgerInfoWithSignatures ledger_info_with_sigs = 2;
|
88
|
+
}
|
89
|
+
|
90
|
+
// Either all transactions are successfully executed and persisted, or nothing
|
91
|
+
// happens.
|
92
|
+
message ExecuteChunkResponse {}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// Copyright (c) The Libra Core Contributors
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
3
|
+
|
4
|
+
syntax = "proto3";
|
5
|
+
|
6
|
+
package network;
|
7
|
+
|
8
|
+
import "transaction.proto";
|
9
|
+
|
10
|
+
/* MempoolSyncMsg represents the messages exchanging between validators to keep
|
11
|
+
* transactions in sync. The proto definition provides the spec on the wire so
|
12
|
+
* that others can implement their mempool service in various languages.
|
13
|
+
* Mempool service is responsible for sending and receiving MempoolSyncMsg
|
14
|
+
* across validators. */
|
15
|
+
message MempoolSyncMsg {
|
16
|
+
bytes peer_id = 1;
|
17
|
+
repeated types.SignedTransaction transactions = 2;
|
18
|
+
}
|
data/protos/mempool_status.proto
CHANGED
@@ -5,7 +5,7 @@ syntax = "proto3";
|
|
5
5
|
|
6
6
|
package mempool;
|
7
7
|
|
8
|
-
enum
|
8
|
+
enum MempoolAddTransactionStatusCode {
|
9
9
|
// Transaction was sent to Mempool
|
10
10
|
Valid = 0;
|
11
11
|
// The sender does not have enough balance for the transaction.
|
@@ -19,3 +19,8 @@ enum MempoolAddTransactionStatus {
|
|
19
19
|
// Invalid update. Only gas price increase is allowed
|
20
20
|
InvalidUpdate = 5;
|
21
21
|
}
|
22
|
+
|
23
|
+
message MempoolAddTransactionStatus {
|
24
|
+
MempoolAddTransactionStatusCode code = 1;
|
25
|
+
string message = 2;
|
26
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
// Copyright (c) The Libra Core Contributors
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
3
|
+
|
4
|
+
syntax = "proto3";
|
5
|
+
|
6
|
+
package network;
|
7
|
+
|
8
|
+
// A `PeerInfo` represents the network address(es) of a Peer.
|
9
|
+
message PeerInfo {
|
10
|
+
// Monotonically increasing incarnation number used to allow peers to issue
|
11
|
+
// updates to their `PeerInfo` and prevent attackers from propagating old
|
12
|
+
// `PeerInfo`s. This is usually a timestamp.
|
13
|
+
uint64 epoch = 1;
|
14
|
+
// Network addresses this peer can be reached at. An address is a serialized
|
15
|
+
// [multiaddr](https://multiformats.io/multiaddr/).
|
16
|
+
repeated bytes addrs = 2;
|
17
|
+
}
|
18
|
+
|
19
|
+
// A `PeerInfo` authenticated by the peer's root `network_signing_key` stored
|
20
|
+
// on-chain.
|
21
|
+
message SignedPeerInfo {
|
22
|
+
// A serialized `PeerInfo`.
|
23
|
+
bytes peer_info = 1;
|
24
|
+
// A signature over the above serialzed `PeerInfo`, signed by the validator's
|
25
|
+
// `network_signing_key` referred to by the `peer_id` account address.
|
26
|
+
bytes signature = 2;
|
27
|
+
}
|
28
|
+
|
29
|
+
// Discovery information relevant to public full nodes and clients.
|
30
|
+
message FullNodePayload {
|
31
|
+
// Monotonically increasing incarnation number used to allow peers to issue
|
32
|
+
// updates to their `FullNodePayload` and prevent attackers from propagating
|
33
|
+
// old `FullNodePayload`s. This is usually a timestamp.
|
34
|
+
uint64 epoch = 1;
|
35
|
+
// The DNS domain name other public full nodes should query to get this
|
36
|
+
// validator's list of full nodes.
|
37
|
+
bytes dns_seed_addr = 2;
|
38
|
+
}
|
39
|
+
|
40
|
+
// A signed `FullNodePayload`.
|
41
|
+
message SignedFullNodePayload {
|
42
|
+
// A serialized `FullNodePayload`.
|
43
|
+
bytes payload = 1;
|
44
|
+
// A signature over `payload` signed by the validator's `network_signing_key`
|
45
|
+
// referred to by the `peer_id` account address.
|
46
|
+
bytes signature = 2;
|
47
|
+
}
|
48
|
+
|
49
|
+
// A `Note` contains a validator's signed `PeerInfo` as well as a signed
|
50
|
+
// `FullNodePayload`, which provides relevant discovery info for public full
|
51
|
+
// nodes and clients.
|
52
|
+
message Note {
|
53
|
+
// Id of the peer.
|
54
|
+
bytes peer_id = 1;
|
55
|
+
// The validator node's signed `PeerInfo`.
|
56
|
+
SignedPeerInfo signed_peer_info = 2;
|
57
|
+
// The validator node's signed `FullNodePayload`.
|
58
|
+
SignedFullNodePayload signed_full_node_payload = 3;
|
59
|
+
}
|
60
|
+
|
61
|
+
// Discovery message exchanged as part of the discovery protocol.
|
62
|
+
// The discovery message sent by a peer consists of notes for all the peers the
|
63
|
+
// sending peer knows about.
|
64
|
+
message DiscoveryMsg { repeated Note notes = 1; }
|
65
|
+
|
66
|
+
// Identity message exchanged as part of the Identity protocol.
|
67
|
+
message IdentityMsg {
|
68
|
+
enum Role {
|
69
|
+
VALIDATOR = 0;
|
70
|
+
FULL_NODE = 1;
|
71
|
+
}
|
72
|
+
bytes peer_id = 1;
|
73
|
+
repeated bytes supported_protocols = 2;
|
74
|
+
Role role = 3;
|
75
|
+
}
|
76
|
+
|
77
|
+
// Ping message sent as liveness probe.
|
78
|
+
message Ping {}
|
79
|
+
|
80
|
+
// Pong message sent as response to liveness probe.
|
81
|
+
message Pong {}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// Copyright (c) The Libra Core Contributors
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
3
|
+
|
4
|
+
// A Debugging interface to be used to query debug information from a Node
|
5
|
+
syntax = "proto3";
|
6
|
+
|
7
|
+
package debug;
|
8
|
+
|
9
|
+
message GetNodeDetailsRequest {}
|
10
|
+
|
11
|
+
message GetNodeDetailsResponse { map<string, string> stats = 1; }
|
12
|
+
|
13
|
+
message GetEventsRequest {}
|
14
|
+
|
15
|
+
message GetEventsResponse { repeated Event events = 1; }
|
16
|
+
|
17
|
+
message Event {
|
18
|
+
string name = 1;
|
19
|
+
int64 timestamp = 2;
|
20
|
+
string json = 3;
|
21
|
+
}
|
22
|
+
|
23
|
+
message DumpJemallocHeapProfileRequest {}
|
24
|
+
|
25
|
+
message DumpJemallocHeapProfileResponse {
|
26
|
+
// Status code from jemalloc mallctl call. 0 indicates success.
|
27
|
+
int32 status_code = 1;
|
28
|
+
}
|
29
|
+
|
30
|
+
service NodeDebugInterface {
|
31
|
+
// Returns debug information about node
|
32
|
+
rpc GetNodeDetails(GetNodeDetailsRequest) returns (GetNodeDetailsResponse) {}
|
33
|
+
|
34
|
+
// Returns recent events generated by event! macro
|
35
|
+
rpc GetEvents(GetEventsRequest) returns (GetEventsResponse) {}
|
36
|
+
|
37
|
+
// Triggers a dump of heap profile.
|
38
|
+
rpc DumpJemallocHeapProfile(DumpJemallocHeapProfileRequest)
|
39
|
+
returns (DumpJemallocHeapProfileResponse) {}
|
40
|
+
}
|