Flush command and PathProcessor periodic flush #1103
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Consolidates
rly tx relay-packets
andrly tx relay-acknowledgements
into a singlerly tx flush
command.Main reason for this: simplify the operator experience of flushing old messages. The
tx relay-packets
andtx relay-acknowledgements
commands require both the specificpathName
and thechannelID
as arguments. This means if you don't have them memorized, you have to reference the config and do channel queries to determine the args.The new
flush
command still allows passingpathName
andchannelID
arguments to isolate the scope of the flush, but it also allows passing the following number of args:pathName
. It will flush all channels allowed by the filter rule for the specific path.This means the most simple operator experience is now
rly tx flush
without any arguments, and all paths in the config will be flushed. This was the main use case I wanted to cover.This new command utilizes the
PathProcessor
by queueing up pending messages that may have occurred before the start query height of theChainProcessor
s, then allowing thePathProcessor
correlation framework to handle anything that needs to be relayed and then shut down.This means that if a packet not yet been relayed, both the
MsgRecvPacket
to the destination chain andMsgAcknowledgement
back to the source chain will be relayed in the flush. For packets that have been relayed to the destination chain withMsgRecvPacket
but not yet acked back to the source chain, theMsgAcknowledgement
will be relayed to the source chain during the flush.The
PathProcessor
will terminate once all IBC message caches are clear. Messages are cleared from the caches when they are either successful, or given up on (after 5 retries). Additionally, the command is bounded by a 10 minute timeout.Logs are printed for each channel that is flushed.
Since optimized flush capabilities were added to the
PathProcessor
for this, I added a periodic flush. A flush will happen when the relayer first starts up after both chains are in sync, and again on the flush interval (default of5m
, configurable with the--flush-interval
/-i
flag. This reduces the need for the--block-history
flag for the chain processors, and may be worth removing in a follow up PR.