OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / tendermint / abci / types / types.proto
1 syntax = "proto3";
2 package types;
3
4 // This file is copied from http://github.com/tendermint/abci
5
6 //----------------------------------------
7 // Code types
8
9 enum CodeType {
10         OK                    = 0;
11
12         // General response codes, 0 ~ 99
13         InternalError         = 1;
14         EncodingError         = 2;
15         BadNonce              = 3;
16         Unauthorized          = 4;
17         InsufficientFunds     = 5;
18         UnknownRequest        = 6;
19
20         // Reserved for basecoin, 100 ~ 199
21         BaseDuplicateAddress  = 101;
22         BaseEncodingError     = 102;
23         BaseInsufficientFees  = 103;
24         BaseInsufficientFunds = 104;
25         BaseInsufficientGasPrice = 105;
26         BaseInvalidInput      = 106;
27         BaseInvalidOutput     = 107;
28         BaseInvalidPubKey     = 108;
29         BaseInvalidSequence   = 109;
30         BaseInvalidSignature  = 110;
31         BaseUnknownAddress    = 111;
32         BaseUnknownPubKey     = 112;
33         BaseUnknownPlugin     = 113;
34
35         // Reserved for governance, 200 ~ 299
36         GovUnknownEntity      = 201;
37         GovUnknownGroup       = 202;
38         GovUnknownProposal    = 203;
39         GovDuplicateGroup     = 204;
40         GovDuplicateMember    = 205;
41         GovDuplicateProposal  = 206;
42         GovDuplicateVote      = 207;
43         GovInvalidMember      = 208;
44         GovInvalidVote        = 209;
45         GovInvalidVotingPower = 210;
46
47 }
48
49 //----------------------------------------
50 // Request types
51
52 message Request {
53         oneof value{
54                 RequestEcho echo = 1;
55                 RequestFlush flush = 2;
56                 RequestInfo info = 3;
57                 RequestSetOption set_option = 4;
58                 RequestDeliverTx deliver_tx = 5;
59                 RequestCheckTx check_tx = 6;
60                 RequestCommit commit = 7;
61                 RequestQuery query = 8;
62                 RequestInitChain init_chain = 9;
63                 RequestBeginBlock begin_block = 10;
64                 RequestEndBlock end_block = 11;
65         }
66 }
67
68 message RequestEcho {
69         string message = 1;
70 }
71
72 message RequestFlush {
73 }
74
75 message RequestInfo {
76     string version = 1;
77 }
78
79 message RequestSetOption{
80         string key = 1;
81         string value = 2;
82 }
83
84 message RequestDeliverTx{
85         bytes tx = 1;
86 }
87
88 message RequestCheckTx{
89         bytes tx = 1;
90 }
91
92 message RequestQuery{
93         bytes data = 1;
94         string path = 2;
95         uint64 height = 3;
96         bool prove = 4;
97 }
98
99 message RequestCommit{
100 }
101
102 message RequestInitChain{
103         repeated Validator validators = 1;
104 }
105
106 message RequestBeginBlock{
107         bytes hash = 1;
108         Header header = 2;
109 }
110
111 message RequestEndBlock{
112         uint64 height = 1;
113 }
114
115 //----------------------------------------
116 // Response types
117
118
119 message Response {
120         oneof value{
121                 ResponseException exception = 1;
122                 ResponseEcho echo = 2;
123                 ResponseFlush flush = 3;
124                 ResponseInfo info = 4;
125                 ResponseSetOption set_option = 5;
126                 ResponseDeliverTx deliver_tx = 6;
127                 ResponseCheckTx check_tx = 7;
128                 ResponseCommit commit = 8;
129                 ResponseQuery query = 9;
130                 ResponseInitChain init_chain = 10;
131                 ResponseBeginBlock begin_block = 11;
132                 ResponseEndBlock end_block = 12;
133         }
134 }
135
136 message ResponseException{
137         string error = 1;
138 }
139
140 message ResponseEcho {
141         string message = 1;
142 }
143
144 message ResponseFlush{
145 }
146
147 message ResponseInfo {
148         string data = 1;
149         string version = 2;
150         uint64 last_block_height = 3;
151         bytes last_block_app_hash = 4;
152 }
153
154 message ResponseSetOption{
155         string log = 1;
156 }
157
158 message ResponseDeliverTx{
159         CodeType          code        = 1;
160         bytes             data        = 2;
161         string            log         = 3;
162 }
163
164 message ResponseCheckTx{
165         CodeType          code        = 1;
166         bytes             data        = 2;
167         string            log         = 3;
168 }
169
170 message ResponseQuery{
171         CodeType          code        = 1;
172         int64             index       = 2;
173         bytes             key         = 3;
174         bytes             value       = 4;
175         bytes             proof       = 5;
176         uint64            height      = 6;
177         string            log         = 7;
178 }
179
180 message ResponseCommit{
181         CodeType          code        = 1;
182         bytes             data        = 2;
183         string            log         = 3;
184 }
185
186
187 message ResponseInitChain{
188 }
189
190 message ResponseBeginBlock{
191 }
192
193 message ResponseEndBlock{
194         repeated Validator diffs = 1;
195 }
196
197 //----------------------------------------
198 // Blockchain Types
199
200 message Header {
201         string chain_id = 1;
202         uint64 height = 2;
203         uint64 time = 3;
204         uint64 num_txs = 4;
205         BlockID last_block_id = 5;
206         bytes last_commit_hash = 6;
207         bytes data_hash = 7;
208         bytes validators_hash = 8;
209         bytes app_hash = 9;
210 }
211
212 message BlockID {
213         bytes hash = 1;
214         PartSetHeader parts = 2;
215 }
216
217 message PartSetHeader {
218         uint64 total = 1;
219         bytes hash = 2;
220 }
221
222 message Validator {
223         bytes pubKey = 1;
224         uint64 power = 2;
225 }
226
227 //----------------------------------------
228 // Service Definition
229
230 service ABCIApplication {
231         rpc Echo(RequestEcho) returns (ResponseEcho) ;
232         rpc Flush(RequestFlush) returns (ResponseFlush);
233         rpc Info(RequestInfo) returns (ResponseInfo);
234         rpc SetOption(RequestSetOption) returns (ResponseSetOption);
235         rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
236         rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
237         rpc Query(RequestQuery) returns (ResponseQuery);
238         rpc Commit(RequestCommit) returns (ResponseCommit);
239         rpc InitChain(RequestInitChain) returns (ResponseInitChain);
240         rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
241         rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
242 }