#[non_exhaustive]pub enum LightClientError {
Show 16 variants
Rpc(Status),
Proto(TryFromProtoError),
Bcs(Error),
InvalidSignature(SignatureError),
InvalidProof(ProofError),
InvalidEpochAdvance {
current: u64,
provided: u64,
},
MissingEndOfEpochData {
checkpoint: u64,
},
CheckpointMismatch {
requested: u64,
returned: u64,
},
NoCommitteeForEpoch {
epoch: u64,
},
RatchetGapTooLarge {
current: u64,
target: u64,
max: u64,
},
EpochNotFound {
epoch: u64,
},
ObjectIdMismatch {
requested: Address,
returned: Address,
},
ObjectDataMismatch(Box<ObjectDataMismatch>),
MmrMismatch(Box<MmrMismatch>),
InvalidEventBatch(ApplyStreamError),
UnexpectedObjectShape {
reason: &'static str,
},
}unstable only.Expand description
Errors returned by the crate::light_client APIs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Rpc(Status)
A gRPC call returned a non-success status.
Proto(TryFromProtoError)
A protobuf message returned by the server was malformed.
Bcs(Error)
BCS decoding of a wire-format payload (e.g. the response’s
checkpoint_summary bytes) failed.
InvalidSignature(SignatureError)
The BLS aggregate signature on a checkpoint summary failed to verify against the cached validator committee.
InvalidProof(ProofError)
The OCS proof failed to verify against the trusted checkpoint summary.
InvalidEpochAdvance
The cache was asked to apply a ratchet update with a new committee
whose epoch was not exactly one greater than the current epoch.
Fields
MissingEndOfEpochData
A checkpoint summary advertised as the last of an epoch had no
end_of_epoch_data payload — the next epoch’s committee cannot
be extracted.
CheckpointMismatch
The server returned a proof anchored at a different checkpoint than the one the caller requested.
Fields
NoCommitteeForEpoch
After ratcheting forward, the cache still did not have a committee on file for the relevant epoch. This should not happen in practice and indicates either a bug or a malicious server response.
RatchetGapTooLarge
The ratchet driver tried to advance through more epochs than
the configured cap (see
crate::light_client::RatchetConfig::max_ratchet_gap) allows
in a single call. This guard exists to bound the work the
client will do in response to a server that keeps reporting
last_checkpoint < target_seq for every epoch, never letting
the discovery walk terminate.
Fields
EpochNotFound
The fullnode reported NotFound for an epoch the ratchet
needed to advance through. Distinguished from a generic
Rpc(Status) so callers can differentiate “the network does
not know about this epoch” (likely a bug or a request for an
epoch past the chain’s tip) from a transport-level failure.
ObjectIdMismatch
The server returned an inclusion proof for a different object id than the caller asked about.
Fields
ObjectDataMismatch(Box<ObjectDataMismatch>)
The object_data bytes the server returned did not BCS-decode to
an Object whose (id, version, digest) match the
authenticated ObjectReference. Without this check, a server
could pass the proof verification step while still returning
arbitrary bytes for the object’s contents.
Boxed because ObjectReference carries a 32-byte digest and a
32-byte address; keeping two of them inline would inflate every
Result<_, LightClientError> slot by ~144 bytes for a case
that’s exceedingly rare in practice.
MmrMismatch(Box<MmrMismatch>)
The locally-replayed EventStreamHead disagreed with the
authenticated head fetched from chain at the given checkpoint.
This is the streaming client’s terminal failure mode — once the
MMRs diverge, every subsequent event would compound the
divergence, so the stream is aborted with this error.
Boxed because EventStreamHead carries a Vec<U256> (each
U256 is 32 bytes) and grows unbounded with checkpoint count;
keeping two of them inline would inflate every
Result<_, LightClientError> slot returned from the streaming
task.
InvalidEventBatch(ApplyStreamError)
Folding a batch of received events into the local MMR violated
the apply_stream_updates contract — empty batch, mismatched
checkpoint_seq within a batch, or non-monotonic batch
ordering. Surfaces a malformed server response that slipped
past the per-event decode.
UnexpectedObjectShape
An object returned by the OCS inclusion proof flow did not
match the shape the caller expected — for example, an
EventStreamHead fetch returned a package instead of a Move
struct, or the dynamic-field contents were too short to
contain the expected value.
Trait Implementations§
Source§impl Debug for LightClientError
impl Debug for LightClientError
Source§impl Display for LightClientError
impl Display for LightClientError
Source§impl Error for LightClientError
impl Error for LightClientError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<ApplyStreamError> for LightClientError
impl From<ApplyStreamError> for LightClientError
Source§fn from(value: ApplyStreamError) -> Self
fn from(value: ApplyStreamError) -> Self
Source§impl From<Error> for LightClientError
impl From<Error> for LightClientError
Source§impl From<ProofError> for LightClientError
impl From<ProofError> for LightClientError
Source§fn from(value: ProofError) -> Self
fn from(value: ProofError) -> Self
Source§impl From<Error> for LightClientError
impl From<Error> for LightClientError
Source§impl From<Status> for LightClientError
impl From<Status> for LightClientError
Source§impl From<TryFromProtoError> for LightClientError
impl From<TryFromProtoError> for LightClientError
Source§fn from(value: TryFromProtoError) -> Self
fn from(value: TryFromProtoError) -> Self
Auto Trait Implementations§
impl Freeze for LightClientError
impl !RefUnwindSafe for LightClientError
impl Send for LightClientError
impl Sync for LightClientError
impl Unpin for LightClientError
impl UnsafeUnpin for LightClientError
impl !UnwindSafe for LightClientError
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.