Skip to content

Commit

Permalink
feat: return # of messages prioritized in the queue when calling mess…
Browse files Browse the repository at this point in the history
…age retry endpoint (#5132)

### Description

Add a mpsc channel between relayer and message retry handler, so message
retry handler knows the retry results from the relayer.

`POST /message_retry` endpoint now returns a JSON with details on the
retry request:

```rust
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct MessageRetryResponse {
    /// ID of the retry request
    pub uuid: String,
    /// how many pending operations were processed
    pub processed: usize,
    /// how many of the pending operations matched the retry request pattern
    pub matched: u64,
}
```

#### New changes
 - use less memory by dropping uuid for some responses
 - changed channel size to 3 * number of destination chains
   - before it was just number of origin chains
- this should prevent `Sender`s from being blocked when calling `send()`
- added unittests to test `process_retry_requests` to ensure messages
are being matched properly against `MatchingList`
- use Arc for message retry requests so we don't need to clone the
entire struct
 - add constant `SUBMITTER_QUEUE_COUNT = 3`

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

Fixes #4059

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

Updated unit tests to return a response so the handler is not blocked

---------

Co-authored-by: Paul Balaji <[email protected]>
  • Loading branch information
kamiyaa and paulbalaji authored Jan 27, 2025
1 parent 55b8ccd commit 1774276
Show file tree
Hide file tree
Showing 13 changed files with 781 additions and 127 deletions.
32 changes: 24 additions & 8 deletions rust/main/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ typetag = "0.2"
uint = "0.9.5"
ureq = { version = "2.4", default-features = false }
url = "2.3"
uuid = { version = "1.12.0", features = ["v4"] }
walkdir = "2"
warp = "0.3"
which = "4.3"
Expand Down
2 changes: 2 additions & 0 deletions rust/main/agents/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ tokio-metrics.workspace = true
tracing-futures.workspace = true
tracing.workspace = true
typetag.workspace = true
uuid.workspace = true

hyperlane-core = { path = "../../hyperlane-core", features = [
"agent",
Expand All @@ -53,6 +54,7 @@ hyperlane-base = { path = "../../hyperlane-base", features = ["test-utils"] }
hyperlane-ethereum = { path = "../../chains/hyperlane-ethereum" }

[dev-dependencies]
axum = { workspace = true, features = ["macros"] }
once_cell.workspace = true
mockall.workspace = true
tokio-test.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion rust/main/agents/relayer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ mod msg;
mod processor;
mod prover;
mod relayer;
mod server;
mod settings;

pub mod server;

pub use msg::GAS_EXPENDITURE_LOG_MESSAGE;
pub use relayer::*;
Loading

0 comments on commit 1774276

Please sign in to comment.