refactor(omni-relayer): error handling#37
Open
frolvanya wants to merge 11 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors relayer worker error handling across multiple chain-specific flows, aiming to standardize retry vs remove behavior and improve NEAR transaction outcome resolution using JSON-RPC.
Changes:
- Replace many
bail!()paths withwarn!()+EventAction::Removefor routing mismatches / invalid inputs. - Route successful NEAR tx submissions through
utils::near::resolve_tx_action(...)to decide whether to retry based on receipt outcomes. - Refactor NATS ack/nak/term decision logic into a shared helper with unit tests, and bump
omni-relayerversion to0.6.23.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| omni-relayer/src/workers/mod.rs | Centralizes JetStream ack decision logic and adjusts fee-mapping cleanup behavior; adds tests. |
| omni-relayer/src/workers/near.rs | Refines fast-transfer initiation and “non-retryable” handling in NEAR-side worker logic. |
| omni-relayer/src/workers/utxo.rs | Updates UTXO-related flows to remove on routing/parse mismatches and to resolve tx outcomes via JSON-RPC. |
| omni-relayer/src/workers/evm.rs | Aligns EVM flow behavior with new “remove vs retry” approach and NEAR receipt resolution. |
| omni-relayer/src/workers/solana.rs | Aligns Solana flow behavior with new “remove vs retry” approach and NEAR receipt resolution. |
| omni-relayer/src/workers/starknet.rs | Aligns Starknet flow behavior with new “remove vs retry” approach and NEAR receipt resolution. |
| omni-relayer/Cargo.toml | Bumps relayer crate version. |
| Cargo.lock | Updates lockfile for the version bump. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes Near-One/omni-bridge#443
This pull request introduces significant improvements to error handling and message processing in the
omni-relayerservice, focusing on making event handling more robust and predictable. The main changes involve standardizing how unprocessable or malformed events are handled (favoring removal over retries), simplifying error branches, and refining the NATS message acknowledgment logic for better reliability and maintainability.Error Handling and Event Removal Improvements:
process_init_transfer_event,process_evm_transfer_event,process_deploy_token_event) to log a warning and returnEventAction::Removefor routing mismatches or parsing errors, instead of failing with an error. This ensures that malformed or unexpected events are cleanly removed from the queue. [1] [2] [3] [4] [5] [6]NATS Message Acknowledgment Logic:
NatsAckDecisionenum andcompute_ack_decisionfunction to centralize and clarify how NATS message acknowledgments are decided based on event processing results, message age, and delivery attempts. This makes the retry/backoff/termination logic more maintainable and predictable. [1] [2]handle_nats_ackto use the new acknowledgment decision logic, ensuring that only removable events are acknowledged and others are retried or terminated as appropriate.General Code Consistency and Robustness:
process_messageto only occur whenEventAction::Removeis returned, preventing unnecessary removals on generic errors. [1] [2] [3] [4]jsonrpc_client,signer) to various event handler calls for consistency and future extensibility. [1] [2] [3]Other:
omni-relayercrate version from0.6.22to0.6.23.evm.rs.These changes collectively make the relayer more resilient to malformed events and external errors, and improve the maintainability of the event processing and message acknowledgment code.