pub struct MessageGraph<'a, P> { /* private fields */ }Expand description
The MessageGraph represents a set of blocks at a given timestamp and the interop
dependencies between them.
This structure is used to determine whether or not any interop messages are invalid within the
set of blocks within the graph. An “invalid message” is one that was relayed from one chain to
another, but the original MessageIdentifier is not present within the graph or from a
dependency referenced via the InteropProvider (or otherwise is invalid, such as being older
than the message expiry window).
Message validity rules: https://specs.optimism.io/interop/messaging.html#invalid-messages
Implementations§
Source§impl<'a, P> MessageGraph<'a, P>where
P: InteropProvider,
impl<'a, P> MessageGraph<'a, P>where
P: InteropProvider,
Sourcepub async fn derive(
blocks: &HashMap<u64, Sealed<Header>>,
provider: &'a P,
rollup_configs: &'a HashMap<u64, RollupConfig>,
) -> MessageGraphResult<Self, P>
pub async fn derive( blocks: &HashMap<u64, Sealed<Header>>, provider: &'a P, rollup_configs: &'a HashMap<u64, RollupConfig>, ) -> MessageGraphResult<Self, P>
Derives the edges from the blocks within the graph by scanning all receipts within the
blocks and searching for ExecutingMessages.
Sourcepub async fn resolve(self) -> MessageGraphResult<(), P>
pub async fn resolve(self) -> MessageGraphResult<(), P>
Checks the validity of all messages within the graph.
Note: This function does not account for cascading dependency failures. When
MessageGraphError::InvalidMessages is returned by this function, the consumer must
re-execute the bad blocks with deposit transactions only per the interop derivation
rules. Once the bad blocks have been replaced, a new
MessageGraph should be constructed and resolution should be re-attempted.
This process should repeat recursively until no invalid dependencies remain, with the
terminal case being all blocks reduced to deposits-only.
Trait Implementations§
Auto Trait Implementations§
impl<'a, P> Freeze for MessageGraph<'a, P>
impl<'a, P> RefUnwindSafe for MessageGraph<'a, P>where
P: RefUnwindSafe,
impl<'a, P> Send for MessageGraph<'a, P>where
P: Sync,
impl<'a, P> Sync for MessageGraph<'a, P>where
P: Sync,
impl<'a, P> Unpin for MessageGraph<'a, P>
impl<'a, P> UnwindSafe for MessageGraph<'a, P>where
P: RefUnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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