pub struct Tributary<D: Db, T: Transaction, MN: MempoolNetwork<T>, Tendermint = (), Loop = ()> { /* private fields */ }Expand description
An instanced Tributary.
This is a collection of futures which MUST be polled in order for the Tributary to make
progress. It may be directly polled, acting as a single-threaded sequential executor for each
of the contained futures, or unrolled via its IntoIterator implementation, allowing the
futures to be individually spawned on an executor.
Implementations§
Source§impl<D: Send + Sync + for<'db> Db<Transaction<'db>: Send>, T: Send + Sync + Transaction, MN: MempoolNetwork<T>> Tributary<D, T, MN>
impl<D: Send + Sync + for<'db> Db<Transaction<'db>: Send>, T: Send + Sync + Transaction, MN: MempoolNetwork<T>> Tributary<D, T, MN>
Sourcepub async fn new<N: Send + Sync + Network<[u8; 32], [u8; 64], AggregateSignature, ReadWriteAsBorsh<Block<T>>, Sleep: Send>>(
db: D,
genesis: [u8; 16],
genesis_time: Option<u64>,
validators: HashMap<[u8; 32], NonZero<u16>>,
tendermint_network: N,
mempool_network: MN,
key: Zeroizing<<Ristretto as Ciphersuite>::F>,
mempool_rate_limit: usize,
) -> Result<(Tributary<D, T, MN, impl Send + Future<Output = ()>, impl Send + Future<Output = ()>>, TributaryHandle<D, T>), TributaryError>
pub async fn new<N: Send + Sync + Network<[u8; 32], [u8; 64], AggregateSignature, ReadWriteAsBorsh<Block<T>>, Sleep: Send>>( db: D, genesis: [u8; 16], genesis_time: Option<u64>, validators: HashMap<[u8; 32], NonZero<u16>>, tendermint_network: N, mempool_network: MN, key: Zeroizing<<Ristretto as Ciphersuite>::F>, mempool_rate_limit: usize, ) -> Result<(Tributary<D, T, MN, impl Send + Future<Output = ()>, impl Send + Future<Output = ()>>, TributaryHandle<D, T>), TributaryError>
Instance a Tributary.
This MUST be the only Tributary instanced with this genesis value. It will be reloaded from
the database if prior instanced. For further context on the limitations of this, please refer
to the limitations placed upon ::tendermint::Tendermint.
The genesis argument will be expanded to a 32-byte genesis by prefixing 16 0s.
genesis_time is expressed in milliseconds since the epoch and used to limit the minimum
time blocks may be published with. This prevents a malicious supermajority from backdating
blocks, allowing flooding the honest minority with valid blocks which still respect the
minimum spacing between blocks. It is optional as it is not strictly required, but it is
practically required for resilience against a dishonest supermajority (who can compromise the
integrity of the Tributary in general). Whatever value is set, it MUST be consistent across
participants AND reboots.
validators represents the validators present in the Tributary (keyed by their Ristretto
public keys, valued by their weight in the consensus process). It MUST be a valid value for
the ::tendermint::ValidatorSet trait.
key is the validator’s Ristretto private key. It MUST be consistent across reboots.
mempool_rate_limit is the maximum amount of transactions each validator may have pending
within the mempool. It MAY be locally configured independently of other validators. It does
not apply to provided nor unsigned transactions which are privileged within the Tributary.
Trait Implementations§
Source§impl<D: Db, T: Transaction, MN: MempoolNetwork<T>, Tendermint: Future<Output = ()>, Loop: Future<Output = ()>> Future for Tributary<D, T, MN, Tendermint, Loop>
impl<D: Db, T: Transaction, MN: MempoolNetwork<T>, Tendermint: Future<Output = ()>, Loop: Future<Output = ()>> Future for Tributary<D, T, MN, Tendermint, Loop>
Source§impl<D: 'static + Send + for<'db> Db<Transaction<'db>: Send>, T: 'static + Send + Transaction, MN: 'static + Send + MempoolNetwork<T>, Tendermint: 'static + Send + Future<Output = ()>, Loop: 'static + Send + Future<Output = ()>> IntoIterator for Tributary<D, T, MN, Tendermint, Loop>
impl<D: 'static + Send + for<'db> Db<Transaction<'db>: Send>, T: 'static + Send + Transaction, MN: 'static + Send + MempoolNetwork<T>, Tendermint: 'static + Send + Future<Output = ()>, Loop: 'static + Send + Future<Output = ()>> IntoIterator for Tributary<D, T, MN, Tendermint, Loop>
impl<'__pin, D: Db, T: Transaction, MN: MempoolNetwork<T>, Tendermint, Loop> Unpin for Tributary<D, T, MN, Tendermint, Loop>where
PinnedFieldsOf<__Origin<'__pin, D, T, MN, Tendermint, Loop>>: Unpin,
Auto Trait Implementations§
impl<D, T, MN, Tendermint = (), Loop = ()> !UnsafeUnpin for Tributary<D, T, MN, Tendermint, Loop>
impl<D, T, MN, Tendermint, Loop> Freeze for Tributary<D, T, MN, Tendermint, Loop>
impl<D, T, MN, Tendermint, Loop> RefUnwindSafe for Tributary<D, T, MN, Tendermint, Loop>
impl<D, T, MN, Tendermint, Loop> Send for Tributary<D, T, MN, Tendermint, Loop>
impl<D, T, MN, Tendermint, Loop> Sync for Tributary<D, T, MN, Tendermint, Loop>
impl<D, T, MN, Tendermint, Loop> UnwindSafe for Tributary<D, T, MN, Tendermint, Loop>
Blanket Implementations§
Source§impl<I> BidiIterator for I
impl<I> BidiIterator for I
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§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 moreSource§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 moreSource§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
Source§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
Source§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.Source§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.Source§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> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.