pub enum StartProtocol<I, T, C, G, K, D> {
StartSession(StartInitiation<T, C>),
SessionEstablished(StartEstablished<I>),
SsaCommit(SsaClientCommitmentMessage<I, G, K>),
SsaRequest(SsaServerCommitmentMessage<I, G, D>),
SessionError(StartErrorType<I>),
KeepAlive(KeepAliveMessage<I>),
}Expand description
Lists all messages of the Start protocol for a session establishment.
§Generic parameters
Iis the session identifier.Tis the session target.Care session capabilities.Gis the type of the commitment to the Session Stealth Address (SSA).Kis the wire form of the proof of knowledge going with a client SSA commitment.Dis the type of the deposit data carried in the Server’s SSA commitment.
§Diagram of the protocol
Variants§
StartSession(StartInitiation<T, C>)
Request to initiate a new session.
SessionEstablished(StartEstablished<I>)
Confirmation that a new session has been established by the counterparty.
SsaCommit(SsaClientCommitmentMessage<I, G, K>)
Client’s message to fill Client commitments to establish a Session Stealth Address (SSA).
SsaRequest(SsaServerCommitmentMessage<I, G, D>)
Server-side commitment to Session Stealth Address (SSA).
SessionError(StartErrorType<I>)
Counterparty could not establish a new session due to an error.
KeepAlive(KeepAliveMessage<I>)
A ping message to keep the session alive.
Implementations§
Source§impl<I, T, C, G, K, D> StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> StartProtocol<I, T, C, G, K, D>
Sourcepub const MAX_DEPOSIT_DATA_SIZE: usize
pub const MAX_DEPOSIT_DATA_SIZE: usize
Maximum size of the CBOR-serialized
deposit_data map an
SsaRequest message can carry.
Sourcepub const MAX_SSAS_PER_REQUEST: u16
pub const MAX_SSAS_PER_REQUEST: u16
Maximum number of SSAs that can be requested in a single SsaRequest message.
Sourcepub const MISSING_RUN_ENTRY_SIZE: usize
pub const MISSING_RUN_ENTRY_SIZE: usize
Wire size of one missing table entry: the SSA index
it belongs to, then the run’s inclusive first and last polynomial index.
Sourcepub const PIX_COEFF_COMMITMENT_REPR_SIZE: usize
pub const PIX_COEFF_COMMITMENT_REPR_SIZE: usize
Size of the PIX coefficient commitment representation in bytes.
Sourcepub const PIX_COMMITMENT_PROOF_SIZE: usize
pub const PIX_COMMITMENT_PROOF_SIZE: usize
Size of the serialized client SSA commitment proof of knowledge in bytes.
Carried only by constant-term SsaCommit messages, so it reduces the entry budget of those
and of no others.
Sourcepub const START_HEADER_SIZE: usize
pub const START_HEADER_SIZE: usize
Size of the Start protocol message header in bytes.
Sourcepub const START_PROTOCOL_MESSAGE_TAG: Tag
pub const START_PROTOCOL_MESSAGE_TAG: Tag
Fixed [Tag] of every protocol message.
Sourcepub const START_PROTOCOL_VERSION: u8 = 0x04
pub const START_PROTOCOL_VERSION: u8 = 0x04
Current version of the Start protocol.
Sourcepub fn ssa_commit_chunking(
session_id: &I,
) -> Result<SsaCommitChunking, StartProtocolError>where
I: Serialize,
pub fn ssa_commit_chunking(
session_id: &I,
) -> Result<SsaCommitChunking, StartProtocolError>where
I: Serialize,
How many commitment entries one SsaCommit message can carry,
for each of the two delivery phases.
This is the bound
SsaClientCommitmentMessage::new_multiple chunks by, exposed so that a caller predicting
the message count for a commitment does not have to restate the encode layout. Restating it
is error-prone in a way that hides: the copy this replaced used SsaIndex (4 B) where an
SsaCommit entry prefix is a PolynomialIndex (2 B), against a different fixed overhead,
and agreed with the encoder only because the two mistakes floored to the same divisor at the
dimensions it ran at.
Takes the session_id itself rather than a precomputed length: its CBOR encoding is part of
the layout, so leaving the caller to measure it is the same footgun one level up.
Sourcepub fn max_missing_runs(session_id: &I) -> Result<usize, StartProtocolError>where
I: Serialize,
pub fn max_missing_runs(session_id: &I) -> Result<usize, StartProtocolError>where
I: Serialize,
How many missing runs one retransmission request can
carry.
Exposed for the same reason as ssa_commit_chunking: the caller
choosing the scope must not restate the encode layout, because a copy that drifts either
overflows a packet or silently under-reports what is missing. It takes the session_id
itself rather than a length, since the id’s CBOR encoding is part of that layout.
Derived against a request built by SsaServerCommitmentMessage::recommit, which carries no
commitments and an empty deposit_data map:
header: version(1) + disc(1) + data_len(2) = 4
fixed: params(4) + empty CBOR map(1) + num_commitments(2) + num_missing_runs(2) = 9
per-entry: MISSING_RUN_ENTRY_SIZE
trailer: CBOR-encoded session_idAt least one, so a caller can always ask for something: a budget that rounded to zero would leave a repairable cycle with no way to be repaired.
Source§impl<I, T, C, G, K, D> StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> StartProtocol<I, T, C, G, K, D>
Source§impl<I, T, C, G, K, D> StartProtocol<I, T, C, G, K, D>where
I: for<'de> Deserialize<'de>,
T: for<'de> Deserialize<'de>,
C: TryFrom<u8>,
G: for<'a> TryFrom<&'a [u8]>,
K: for<'a> TryFrom<&'a [u8]>,
D: for<'de> Deserialize<'de>,
impl<I, T, C, G, K, D> StartProtocol<I, T, C, G, K, D>where
I: for<'de> Deserialize<'de>,
T: for<'de> Deserialize<'de>,
C: TryFrom<u8>,
G: for<'a> TryFrom<&'a [u8]>,
K: for<'a> TryFrom<&'a [u8]>,
D: for<'de> Deserialize<'de>,
Sourcepub fn decode(tag: Tag, data: &[u8]) -> Result<Self>
pub fn decode(tag: Tag, data: &[u8]) -> Result<Self>
Tries to decode the message from the binary representation and [Tag].
The tag must be currently START_PROTOCOL_MESSAGE_TAG
and version START_PROTOCOL_VERSION.
Trait Implementations§
Source§impl<I: Clone, T: Clone, C: Clone, G: Clone, K: Clone, D: Clone> Clone for StartProtocol<I, T, C, G, K, D>
impl<I: Clone, T: Clone, C: Clone, G: Clone, K: Clone, D: Clone> Clone for StartProtocol<I, T, C, G, K, D>
Source§fn clone(&self) -> StartProtocol<I, T, C, G, K, D>
fn clone(&self) -> StartProtocol<I, T, C, G, K, D>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<I: Debug, T: Debug, C: Debug, G: Debug, K: Debug, D: Debug> Debug for StartProtocol<I, T, C, G, K, D>
impl<I: Debug, T: Debug, C: Debug, G: Debug, K: Debug, D: Debug> Debug for StartProtocol<I, T, C, G, K, D>
impl<I: Eq, T: Eq, C: Eq, G: Eq, K: Eq, D: Eq> Eq for StartProtocol<I, T, C, G, K, D>
Source§impl<'_enum, I, T, C, G, K, D> From<&'_enum StartProtocol<I, T, C, G, K, D>> for StartProtocolDiscriminants
impl<'_enum, I, T, C, G, K, D> From<&'_enum StartProtocol<I, T, C, G, K, D>> for StartProtocolDiscriminants
Source§fn from(
val: &'_enum StartProtocol<I, T, C, G, K, D>,
) -> StartProtocolDiscriminants
fn from( val: &'_enum StartProtocol<I, T, C, G, K, D>, ) -> StartProtocolDiscriminants
Source§impl<I, T, C, G, K, D> From<StartProtocol<I, T, C, G, K, D>> for StartProtocolDiscriminants
impl<I, T, C, G, K, D> From<StartProtocol<I, T, C, G, K, D>> for StartProtocolDiscriminants
Source§fn from(val: StartProtocol<I, T, C, G, K, D>) -> StartProtocolDiscriminants
fn from(val: StartProtocol<I, T, C, G, K, D>) -> StartProtocolDiscriminants
Source§impl<I, T, C, G, K, D> IntoDiscriminant for StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> IntoDiscriminant for StartProtocol<I, T, C, G, K, D>
Source§type Discriminant = StartProtocolDiscriminants
type Discriminant = StartProtocolDiscriminants
fn discriminant(&self) -> Self::Discriminant
Source§impl<I: PartialEq, T: PartialEq, C: PartialEq, G: PartialEq, K: PartialEq, D: PartialEq> PartialEq for StartProtocol<I, T, C, G, K, D>
impl<I: PartialEq, T: PartialEq, C: PartialEq, G: PartialEq, K: PartialEq, D: PartialEq> PartialEq for StartProtocol<I, T, C, G, K, D>
impl<I: PartialEq, T: PartialEq, C: PartialEq, G: PartialEq, K: PartialEq, D: PartialEq> StructuralPartialEq for StartProtocol<I, T, C, G, K, D>
Source§impl<I, T, C, G, K, D> TryFrom<ApplicationData> for StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> TryFrom<ApplicationData> for StartProtocol<I, T, C, G, K, D>
Source§impl<I, T, C, G, K, D> TryFrom<StartProtocol<I, T, C, G, K, D>> for ApplicationData
impl<I, T, C, G, K, D> TryFrom<StartProtocol<I, T, C, G, K, D>> for ApplicationData
Source§type Error = StartProtocolError
type Error = StartProtocolError
Auto Trait Implementations§
impl<I, T, C, G, K, D> Freeze for StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> RefUnwindSafe for StartProtocol<I, T, C, G, K, D>where
T: RefUnwindSafe,
C: RefUnwindSafe,
I: RefUnwindSafe,
K: RefUnwindSafe,
G: RefUnwindSafe,
D: RefUnwindSafe,
impl<I, T, C, G, K, D> Send for StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> Sync for StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> Unpin for StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> UnsafeUnpin for StartProtocol<I, T, C, G, K, D>
impl<I, T, C, G, K, D> UnwindSafe for StartProtocol<I, T, C, G, K, D>where
T: UnwindSafe,
C: UnwindSafe,
I: UnwindSafe,
K: UnwindSafe,
G: UnwindSafe + RefUnwindSafe,
D: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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