pub struct TestQuorum {
pub verified: Mutex<Vec<(u32, [u8; 32], u32)>>,
/* private fields */
}Expand description
A provider that knows the test quorum QUORUM_HASH and records the Core heights
reported to it as verified.
Fields§
§verified: Mutex<Vec<(u32, [u8; 32], u32)>>The quorum type, quorum hash and Core height of each verified signature.
Implementations§
Source§impl TestQuorum
impl TestQuorum
Sourcepub fn with_another_key() -> Self
pub fn with_another_key() -> Self
Knows the quorum by another key than the one it signs with.
Trait Implementations§
Source§impl ContextProvider for TestQuorum
impl ContextProvider for TestQuorum
Source§fn get_data_contract(
&self,
_: &Identifier,
_: &PlatformVersion,
) -> Result<Option<Arc<DataContract>>, ContextProviderError>
fn get_data_contract( &self, _: &Identifier, _: &PlatformVersion, ) -> Result<Option<Arc<DataContract>>, ContextProviderError>
Source§fn get_token_configuration(
&self,
_: &Identifier,
) -> Result<Option<TokenConfiguration>, ContextProviderError>
fn get_token_configuration( &self, _: &Identifier, ) -> Result<Option<TokenConfiguration>, ContextProviderError>
Source§fn get_quorum_public_key(
&self,
quorum_type: u32,
quorum_hash: [u8; 32],
_: u32,
) -> Result<[u8; 48], ContextProviderError>
fn get_quorum_public_key( &self, quorum_type: u32, quorum_hash: [u8; 32], _: u32, ) -> Result<[u8; 48], ContextProviderError>
Fetches the public key for a specified quorum. Read more
Source§fn get_platform_activation_height(
&self,
) -> Result<CoreBlockHeight, ContextProviderError>
fn get_platform_activation_height( &self, ) -> Result<CoreBlockHeight, ContextProviderError>
Gets the platform activation height from core. Once this has happened this can be hardcoded. Read more
Source§fn core_height_verified(
&self,
quorum_type: u32,
quorum_hash: [u8; 32],
core_chain_locked_height: u32,
)
fn core_height_verified( &self, quorum_type: u32, quorum_hash: [u8; 32], core_chain_locked_height: u32, )
Called by the proof verifier once the Tenderdash signature of a
response verified with a key from this provider, with the quorum that
signed it and the Core ChainLocked height in that response’s metadata:
the same arguments, in the same order, as the
get_quorum_public_key call that
returned the key. Read more
§fn register_data_contract(&self, _contract: Arc<DataContract>)
fn register_data_contract(&self, _contract: Arc<DataContract>)
Register a data contract into the provider’s cache so that a
subsequent proof verification (e.g. the returned-proof check after a
document or token state-transition broadcast) can resolve it without
a network fetch. Read more
§fn fetch_quorum_public_key(
&self,
_quorum_type: u32,
_quorum_hash: [u8; 32],
_core_chain_locked_height: u32,
) -> Option<Pin<Box<dyn Future<Output = Result<Option<[u8; 48]>, ContextProviderError>> + Send>>>
fn fetch_quorum_public_key( &self, _quorum_type: u32, _quorum_hash: [u8; 32], _core_chain_locked_height: u32, ) -> Option<Pin<Box<dyn Future<Output = Result<Option<[u8; 48]>, ContextProviderError>> + Send>>>
Fetches the public key of a quorum this provider does not hold yet. Read more
§fn network(&self) -> Option<Network>
fn network(&self) -> Option<Network>
The network whose quorum keys this provider serves, if it serves only
one. The SDK refuses a provider for another network than its own. Read more
§fn requires_proofs(&self) -> bool
fn requires_proofs(&self) -> bool
Whether the provider is only sound on an SDK that requests and
verifies proofs, for example because its keys are proven for the
heights in verified responses. The SDK refuses such a provider with
proofs turned off. Read more
§fn quorum_source(&self) -> Option<QuorumKeySource>
fn quorum_source(&self) -> Option<QuorumKeySource>
The source this provider asks first for quorum keys right now, for
diagnostics: its only source, or, for a provider that switches between
sources, the one it would ask first now. A provider that falls back to
another source for a key the first cannot serve still reports the
first. For one that chooses by whether a published SPV client is
ready, a client that cannot say counts as not ready, so this reports
the trusted source then. Read more
§fn set_quorum_mode(
&self,
mode: ContextProviderMode,
) -> Result<(), ContextProviderError>
fn set_quorum_mode( &self, mode: ContextProviderMode, ) -> Result<(), ContextProviderError>
Change which source later quorum lookups use, on a provider that
switches between sources at run time. Read more
§fn spv_source_slot(&self) -> Option<Arc<SpvSourceSlot>>
fn spv_source_slot(&self) -> Option<Arc<SpvSourceSlot>>
The slot an SPV client publishes this provider’s quorum keys into, if
it takes them from one. The default,
None, takes none.Auto Trait Implementations§
impl !Freeze for TestQuorum
impl RefUnwindSafe for TestQuorum
impl Send for TestQuorum
impl Sync for TestQuorum
impl Unpin for TestQuorum
impl UnsafeUnpin for TestQuorum
impl UnwindSafe for TestQuorum
Blanket Implementations§
Source§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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> CostsExt for T
impl<T> CostsExt for T
§fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
Wraps any value into a
CostContext object with provided costs.§fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
Wraps any value into
CostContext object with costs computed using the
value getting wrapped.§impl<C> DataContractProvider for Cwhere
C: ContextProvider + ?Sized,
impl<C> DataContractProvider for Cwhere
C: ContextProvider + ?Sized,
§fn as_contract_lookup_fn<'a>(
&'a self,
platform_version: &'a PlatformVersion,
) -> Box<dyn Fn(&Identifier) -> Result<Option<Arc<DataContract>>, Error> + 'a>
fn as_contract_lookup_fn<'a>( &'a self, platform_version: &'a PlatformVersion, ) -> Box<dyn Fn(&Identifier) -> Result<Option<Arc<DataContract>>, Error> + 'a>
Returns function that uses ContextProvider to provide a [DataContract] to Drive proof verification functions
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
§fn into_on_network(self, network: Network) -> U
fn into_on_network(self, network: Network) -> U
Calls U::from_on_network(self).
§impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
§fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
Performs the conversion.
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
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>,
Applies the layer to a service and wraps it in [
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,
Pipes by value. This is generally the method you want to use. Read more
§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,
Borrows
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,
Mutably borrows
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
Borrows
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
Mutably borrows
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
Borrows
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> 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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.tap_deref() only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T, U> TryIntoPlatformVersioned<U> for Twhere
U: TryFromPlatformVersioned<T>,
impl<T, U> TryIntoPlatformVersioned<U> for Twhere
U: TryFromPlatformVersioned<T>,
§type Error = <U as TryFromPlatformVersioned<T>>::Error
type Error = <U as TryFromPlatformVersioned<T>>::Error
The type returned in the event of a conversion error.
§fn try_into_platform_versioned(
self,
platform_version: &PlatformVersion,
) -> Result<U, <U as TryFromPlatformVersioned<T>>::Error>
fn try_into_platform_versioned( self, platform_version: &PlatformVersion, ) -> Result<U, <U as TryFromPlatformVersioned<T>>::Error>
Performs the conversion.
§impl<T, U> TryIntoVersioned<U> for Twhere
U: TryFromVersioned<T>,
impl<T, U> TryIntoVersioned<U> for Twhere
U: TryFromVersioned<T>,
§type Error = <U as TryFromVersioned<T>>::Error
type Error = <U as TryFromVersioned<T>>::Error
The type returned in the event of a conversion error.
§fn try_into_versioned(
self,
grove_version: &GroveVersion,
) -> Result<U, <U as TryFromVersioned<T>>::Error>
fn try_into_versioned( self, grove_version: &GroveVersion, ) -> Result<U, <U as TryFromVersioned<T>>::Error>
Performs the conversion.