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
use crate::prelude::*;
use flex_error::{define_error, TraceError};
use crate::core::ics24_host::error::ValidationError;
use crate::Height;
use tendermint::account::Id;
use tendermint::hash::Hash;
use tendermint::Error as TendermintError;
define_error! {
#[derive(Debug, PartialEq, Eq)]
Error {
InvalidTrustingPeriod
{ reason: String }
|e| { format_args!("invalid trusting period: {}", e.reason) },
InvalidUnbondingPeriod
{ reason: String }
|e| { format_args!("invalid unbonding period: {}", e.reason) },
InvalidAddress
|_| { "invalid address" },
InvalidHeader
{ reason: String }
[ TendermintError ]
|e| { format_args!("invalid header, failed basic validation: {}", e.reason) },
InvalidTrustThreshold
{ reason: String }
|e| { format_args!("invalid client state trust threshold: {}", e.reason) },
MissingSignedHeader
|_| { "missing signed header" },
Validation
{ reason: String }
|e| { format_args!("invalid header, failed basic validation: {}", e.reason) },
InvalidRawClientState
{ reason: String }
|e| { format_args!("invalid raw client state: {}", e.reason) },
MissingValidatorSet
|_| { "missing validator set" },
MissingTrustedValidatorSet
|_| { "missing trusted validator set" },
MissingTrustedHeight
|_| { "missing trusted height" },
MissingTrustingPeriod
|_| { "missing trusting period" },
MissingUnbondingPeriod
|_| { "missing unbonding period" },
InvalidChainIdentifier
[ ValidationError ]
|_| { "invalid chain identifier" },
NegativeTrustingPeriod
|_| { "negative trusting period" },
NegativeUnbondingPeriod
|_| { "negative unbonding period" },
MissingMaxClockDrift
|_| { "missing max clock drift" },
NegativeMaxClockDrift
|_| { "negative max clock drift" },
MissingLatestHeight
|_| { "missing latest height" },
MissingFrozenHeight
|_| { "missing frozen height" },
InvalidChainId
{ raw_value: String }
[ ValidationError ]
|e| { format_args!("invalid chain identifier: {}", e.raw_value) },
InvalidRawHeight
{ raw_height: u64 }
|e| { format_args!("invalid raw height: {}", e.raw_height) },
InvalidRawConsensusState
{ reason: String }
| e | { format_args!("invalid raw client consensus state: {}", e.reason) },
InvalidRawHeader
[ TendermintError ]
| _ | { "invalid raw header" },
InvalidRawMisbehaviour
{ reason: String }
| e | { format_args!("invalid raw misbehaviour: {}", e.reason) },
Decode
[ TraceError<prost::DecodeError> ]
| _ | { "decode error" },
InsufficientVotingPower
{ reason: String }
| e | {
format_args!("insufficient overlap: {}", e.reason)
},
LowUpdateTimestamp
{
low: String,
high: String
}
| e | {
format_args!("header timestamp {0} must be greater than current client consensus state timestamp {1}", e.low, e.high)
},
HeaderTimestampOutsideTrustingTime
{
low: String,
high: String
}
| e | {
format_args!("header timestamp {0} is outside the trusting period w.r.t. consensus state timestamp {1}", e.low, e.high)
},
HeaderTimestampTooHigh
{
actual: String,
max: String,
}
| e | {
format_args!("given other previous updates, header timestamp should be at most {0}, but was {1}", e.max, e.actual)
},
HeaderTimestampTooLow
{
actual: String,
min: String,
}
| e | {
format_args!("given other previous updates, header timestamp should be at least {0}, but was {1}", e.min, e.actual)
},
InvalidHeaderHeight
{ height: Height }
| e | {
format_args!("header height = {0} is invalid", e.height)
},
InvalidTrustedHeaderHeight
{
trusted_header_height: Height,
height_header: Height
}
| e | {
format_args!("header height is {0} and is lower than the trusted header height, which is {1} ", e.height_header, e.trusted_header_height)
},
LowUpdateHeight
{
low: Height,
high: Height
}
| e | {
format_args!("header height is {0} but it must be greater than the current client height which is {1}", e.low, e.high)
},
MismatchedRevisions
{
current_revision: u64,
update_revision: u64,
}
| e | {
format_args!("the header's current/trusted revision number ({0}) and the update's revision number ({1}) should be the same", e.current_revision, e.update_revision)
},
InvalidValidatorSet
{
hash1: Hash,
hash2: Hash,
}
| e | {
format_args!("invalid validator set: header_validators_hash={} and validators_hash={}", e.hash1, e.hash2)
},
NotEnoughTrustedValsSigned
{ reason: String }
| e | {
format_args!("not enough trust because insufficient validators overlap: {}", e.reason)
},
VerificationError
{ detail: tendermint_light_client::predicates::errors::VerificationErrorDetail }
| e | {
format_args!("verification failed: {}", e.detail)
}
}
}
define_error! {
#[derive(Debug, PartialEq, Eq)]
VerificationError {
InvalidSignature
| _ | { "couldn't verify validator signature" },
DuplicateValidator
{ id: Id }
| e | {
format_args!("duplicate validator in commit signatures with address {}", e.id)
},
InsufficientOverlap
{ q1: u64, q2: u64 }
| e | {
format_args!("insufficient signers overlap between {0} and {1}", e.q1, e.q2)
},
}
}