hopr_chain_actions

Module action_state

Source
Expand description

This module adds functionality of tracking the action results via expectations.

It contains implementation of types necessary to perform tracking the on-chain state of Actions. Once an Action is submitted to the chain, an IndexerExpectation can be created and registered in an object implementing the ActionState trait. The expectation typically consists of a required transaction hash and a predicate of ChainEventType that must match on any chain event log in a block containing the given transaction hash.

§Example

Once the RegisterSafe(0x0123..ef) action that has been submitted via ActionQueue in a transaction with hash 0xabcd...00. The IndexerExpectation is such that whatever block that will contain the TX hash 0xabcd..00 must also contain a log that matches NodeSafeRegistered(0x0123..ef) event type. If such event is never encountered by the Indexer, the safe registration action naturally times out.

Structs§

IndexerActionTracker
Implements action state tracking using a non-persistent in-memory hash table of assumed IndexerExpectations.
IndexerExpectation
Expectation on a chain event within a TX indexed by the Indexer.

Traits§

ActionState
Allows tracking state of an Action via registering IndexerExpectations on SignificantChainEvents coming from the Indexer and resolving them as they are matched. Once expectations are matched, they are automatically unregistered.

Type Aliases§

ExpectationResolver
Future that resolves once an expectation is matched by some SignificantChainEvent. Also allows mocking in tests.