1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct ExistenceProof {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "3")]
pub leaf: ::core::option::Option<LeafOp>,
#[prost(message, repeated, tag = "4")]
pub path: ::prost::alloc::vec::Vec<InnerOp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct NonExistenceProof {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "2")]
pub left: ::core::option::Option<ExistenceProof>,
#[prost(message, optional, tag = "3")]
pub right: ::core::option::Option<ExistenceProof>,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct CommitmentProof {
#[prost(oneof = "commitment_proof::Proof", tags = "1, 2, 3, 4")]
pub proof: ::core::option::Option<commitment_proof::Proof>,
}
pub mod commitment_proof {
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Oneof)]
pub enum Proof {
#[prost(message, tag = "1")]
Exist(super::ExistenceProof),
#[prost(message, tag = "2")]
Nonexist(super::NonExistenceProof),
#[prost(message, tag = "3")]
Batch(super::BatchProof),
#[prost(message, tag = "4")]
Compressed(super::CompressedBatchProof),
}
}
#[derive(::serde::Serialize, ::serde::Deserialize, Eq)]
#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeafOp {
#[prost(enumeration = "HashOp", tag = "1")]
pub hash: i32,
#[prost(enumeration = "HashOp", tag = "2")]
#[serde(default)]
pub prehash_key: i32,
#[prost(enumeration = "HashOp", tag = "3")]
pub prehash_value: i32,
#[prost(enumeration = "LengthOp", tag = "4")]
pub length: i32,
#[prost(bytes = "vec", tag = "5")]
#[serde(with = "crate::base64")]
#[cfg_attr(feature = "json-schema", schemars(with = "String"))]
pub prefix: ::prost::alloc::vec::Vec<u8>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))]
#[derive(Eq, Clone, PartialEq, ::prost::Message)]
pub struct InnerOp {
#[prost(enumeration = "HashOp", tag = "1")]
pub hash: i32,
#[prost(bytes = "vec", tag = "2")]
#[serde(with = "crate::base64")]
#[cfg_attr(feature = "json-schema", schemars(with = "String"))]
pub prefix: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
#[serde(with = "crate::base64")]
#[cfg_attr(feature = "json-schema", schemars(with = "String"))]
pub suffix: ::prost::alloc::vec::Vec<u8>,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Eq)]
#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProofSpec {
#[prost(message, optional, tag = "1")]
pub leaf_spec: ::core::option::Option<LeafOp>,
#[prost(message, optional, tag = "2")]
pub inner_spec: ::core::option::Option<InnerSpec>,
#[prost(int32, tag = "3")]
#[serde(default)]
pub max_depth: i32,
#[prost(int32, tag = "4")]
#[serde(default)]
pub min_depth: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Eq)]
#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InnerSpec {
#[prost(int32, repeated, tag = "1")]
pub child_order: ::prost::alloc::vec::Vec<i32>,
#[prost(int32, tag = "2")]
pub child_size: i32,
#[prost(int32, tag = "3")]
pub min_prefix_length: i32,
#[prost(int32, tag = "4")]
pub max_prefix_length: i32,
#[prost(bytes = "vec", tag = "5")]
#[serde(default)]
#[serde(with = "crate::base64")]
#[cfg_attr(feature = "json-schema", schemars(with = "String"))]
pub empty_child: ::prost::alloc::vec::Vec<u8>,
#[prost(enumeration = "HashOp", tag = "6")]
pub hash: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct BatchProof {
#[prost(message, repeated, tag = "1")]
pub entries: ::prost::alloc::vec::Vec<BatchEntry>,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct BatchEntry {
#[prost(oneof = "batch_entry::Proof", tags = "1, 2")]
pub proof: ::core::option::Option<batch_entry::Proof>,
}
pub mod batch_entry {
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Oneof)]
pub enum Proof {
#[prost(message, tag = "1")]
Exist(super::ExistenceProof),
#[prost(message, tag = "2")]
Nonexist(super::NonExistenceProof),
}
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct CompressedBatchProof {
#[prost(message, repeated, tag = "1")]
pub entries: ::prost::alloc::vec::Vec<CompressedBatchEntry>,
#[prost(message, repeated, tag = "2")]
pub lookup_inners: ::prost::alloc::vec::Vec<InnerOp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct CompressedBatchEntry {
#[prost(oneof = "compressed_batch_entry::Proof", tags = "1, 2")]
pub proof: ::core::option::Option<compressed_batch_entry::Proof>,
}
pub mod compressed_batch_entry {
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Oneof)]
pub enum Proof {
#[prost(message, tag = "1")]
Exist(super::CompressedExistenceProof),
#[prost(message, tag = "2")]
Nonexist(super::CompressedNonExistenceProof),
}
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct CompressedExistenceProof {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "3")]
pub leaf: ::core::option::Option<LeafOp>,
#[prost(int32, repeated, tag = "4")]
pub path: ::prost::alloc::vec::Vec<i32>,
}
#[derive(::serde::Serialize, ::serde::Deserialize, Clone, PartialEq, ::prost::Message)]
pub struct CompressedNonExistenceProof {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "2")]
pub left: ::core::option::Option<CompressedExistenceProof>,
#[prost(message, optional, tag = "3")]
pub right: ::core::option::Option<CompressedExistenceProof>,
}
#[derive(
::serde::Serialize,
::serde::Deserialize,
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum HashOp {
NoHash = 0,
Sha256 = 1,
Sha512 = 2,
Keccak = 3,
Ripemd160 = 4,
Bitcoin = 5,
}
#[derive(
::serde::Serialize,
::serde::Deserialize,
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration,
)]
#[repr(i32)]
pub enum LengthOp {
NoPrefix = 0,
VarProto = 1,
VarRlp = 2,
Fixed32Big = 3,
Fixed32Little = 4,
Fixed64Big = 5,
Fixed64Little = 6,
Require32Bytes = 7,
Require64Bytes = 8,
}