ava-labs / awm-relayer

Service for relaying Avalanche Warp Messages between Subnets
Other
24 stars 19 forks source link

Only write to listener's app relayers #449

Closed cam-schultz closed 2 months ago

cam-schultz commented 2 months ago

Why this should be merged

Currently, the message coordinator singleton dispatches to every block from every chain to every application relayer. If there are messages in the block, they will still be processed as expected by the appropriate application relayer, and the other application relayers are very likely to simply no-op. However, if there are no messages in the blocks, then all application relayers will instead stage the height to be committed to the database. The committed heights will be out of order since they don't pertain to the expected chain, so no heights will be written. This breaks block checkpointing, and can cause OOM as the queue of pending blocks grows unbounded.

How this works

The message coordinator only dispatches to application relayers whose source chain ID matches the block being processed.

How this was tested

CI. Created https://github.com/ava-labs/awm-relayer/issues/448 to add unit tests for the message coordinator

How is this documented

N/A