Skip to content

Commit d9dec53

Browse files
authored
feat: deploy relay api on testnet (#8685)
1 parent d851a31 commit d9dec53

9 files changed

Lines changed: 94 additions & 10 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperlane-xyz/sdk": minor
3+
---
4+
5+
Relay API configuration fields were added to RelayerAgentConfigSchema (relayApiEnabled, relayApiPort, relayApiRateLimitMaxRequests, relayApiRateLimitWindowSecs, relayApiCorsOrigins). All fields are optional for backward compatibility.

rust/main/agents/relayer/src/settings/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub struct RelayerSettings {
9595
pub relay_api_rate_limit_max_requests: Option<usize>,
9696
/// Relay API rate limit: time window in seconds (default: 60)
9797
pub relay_api_rate_limit_window_secs: Option<u64>,
98-
/// Relay API allowed CORS origins (comma-separated). Defaults to localhost:3000 and nexus.hyperlane.xyz.
98+
/// Relay API allowed CORS origins (comma-separated). Defaults to https://nexus.hyperlane.xyz.
9999
pub relay_api_cors_origins: Vec<String>,
100100
}
101101

@@ -449,12 +449,7 @@ impl FromRawConf<RawRelayerSettings> for RelayerSettings {
449449
.filter(|s| !s.is_empty())
450450
.collect()
451451
})
452-
.unwrap_or_else(|| {
453-
vec![
454-
"https://nexus.hyperlane.xyz".to_string(),
455-
"http://localhost:3000".to_string(),
456-
]
457-
});
452+
.unwrap_or_else(|| vec!["https://nexus.hyperlane.xyz".to_string()]);
458453

459454
err.into_result(RelayerSettings {
460455
base,

rust/main/helm/hyperlane-agent/templates/relayer-statefulset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ spec:
122122
ports:
123123
- name: metrics
124124
containerPort: {{ .Values.hyperlane.metrics.port }}
125+
{{- if .Values.hyperlane.relayer.relayApi.enabled }}
126+
- name: relay-api
127+
containerPort: {{ .Values.hyperlane.relayer.relayApi.port }}
128+
{{- end }}
125129
volumes:
126130
- name: relayer-configmap
127131
configMap:

rust/main/helm/hyperlane-agent/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ hyperlane:
101101
relayer:
102102
enabled: false
103103
aws: # true | false
104+
# relayApi controls only the containerPort declaration so Kubernetes knows
105+
# about the port. The actual HYP_RELAYAPIENABLED / HYP_RELAYAPIPORT env vars
106+
# flow through envConfig (set by the infra TS helpers). Direct Helm users
107+
# must also populate envConfig with relay API fields to enable the feature.
108+
relayApi:
109+
enabled: false
110+
port: 8900
104111
podAnnotations:
105112
prometheus.io/port: '9090'
106113
prometheus.io/scrape: 'true'

typescript/infra/config/docker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export const mainnetDockerTags: MainnetDockerTags = {
5757

5858
export const testnetDockerTags: BaseDockerTags = {
5959
// rust agents
60-
relayer: '7eb690c-20260406-142107',
61-
relayerRC: '7eb690c-20260406-142107',
62-
relayerFastPath: '7eb690c-20260406-142107',
60+
relayer: 'd851a31-20260429-121400',
61+
relayerRC: 'd851a31-20260429-121400',
62+
relayerFastPath: 'd851a31-20260429-121400',
6363
validator: '7eb690c-20260406-142107',
6464
validatorRC: '7eb690c-20260406-142107',
6565
scraper: 'caa8162-20260409-132508',

typescript/infra/config/environments/testnet4/agent.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,13 @@ const hyperlane: RootAgentConfig = {
324324
cache: {
325325
enabled: true,
326326
},
327+
relayApi: {
328+
enabled: true,
329+
port: 8900,
330+
rateLimitMaxRequests: 100,
331+
rateLimitWindowSecs: 60,
332+
corsOrigins: 'https://nexus.hyperlane.xyz',
333+
},
327334
resources: relayerResources,
328335
},
329336
validators: {

typescript/infra/src/agents/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export class RelayerHelmManager extends OmniscientAgentHelmManager {
244244
this.config.relayerConfig.environmentVariableEndpointEnabled ?? true,
245245
cacheDefaultExpirationSeconds:
246246
this.config.relayerConfig.cache?.defaultExpirationSeconds,
247+
relayApi: this.config.relayerConfig.relayApi ?? { enabled: false },
247248
};
248249

249250
const signers = await this.config.signers();

typescript/infra/src/config/agent/relayer.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ export interface BaseRelayerConfig {
8686
txIdIndexingEnabled?: boolean;
8787
igpIndexingEnabled?: boolean;
8888
reorgPeriodOverrides?: ChainMap<number>;
89+
relayApi?: RelayApiConfig;
90+
}
91+
92+
export interface RelayApiConfig {
93+
enabled: boolean;
94+
port?: number;
95+
rateLimitMaxRequests?: number;
96+
rateLimitWindowSecs?: number;
97+
corsOrigins?: string;
8998
}
9099

91100
// Full relayer-specific agent config for a single chain
@@ -121,6 +130,8 @@ export interface HelmRelayerValues extends HelmStatefulSetValues {
121130
environmentVariableEndpointEnabled?: boolean;
122131
// Config for the cache
123132
cacheDefaultExpirationSeconds?: number;
133+
// Config for the relay API
134+
relayApi?: RelayApiConfig;
124135
}
125136

126137
export interface RelayerDbBootstrapConfig {
@@ -185,6 +196,23 @@ export class RelayerConfigHelper extends AgentConfigHelper<RelayerConfig> {
185196
relayerConfig.allowContractCallCaching = baseConfig.cache?.enabled ?? false;
186197
relayerConfig.txIdIndexingEnabled = baseConfig.txIdIndexingEnabled ?? true;
187198
relayerConfig.igpIndexingEnabled = baseConfig.igpIndexingEnabled ?? true;
199+
if (baseConfig.relayApi !== undefined) {
200+
relayerConfig.relayApiEnabled = baseConfig.relayApi.enabled;
201+
if (baseConfig.relayApi.port !== undefined) {
202+
relayerConfig.relayApiPort = baseConfig.relayApi.port;
203+
}
204+
if (baseConfig.relayApi.rateLimitMaxRequests !== undefined) {
205+
relayerConfig.relayApiRateLimitMaxRequests =
206+
baseConfig.relayApi.rateLimitMaxRequests;
207+
}
208+
if (baseConfig.relayApi.rateLimitWindowSecs !== undefined) {
209+
relayerConfig.relayApiRateLimitWindowSecs =
210+
baseConfig.relayApi.rateLimitWindowSecs;
211+
}
212+
if (baseConfig.relayApi.corsOrigins !== undefined) {
213+
relayerConfig.relayApiCorsOrigins = baseConfig.relayApi.corsOrigins;
214+
}
215+
}
188216

189217
return relayerConfig;
190218
}

typescript/sdk/src/metadata/agentConfig.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,43 @@ export const RelayerAgentConfigSchema = AgentConfigSchema.extend({
483483
.boolean()
484484
.optional()
485485
.describe('Whether to enable IGP indexing'),
486+
relayApiEnabled: z
487+
.boolean()
488+
.optional()
489+
.describe(
490+
'Whether to enable the relay API HTTP server. Defaults to false.',
491+
),
492+
relayApiPort: z
493+
.number()
494+
.int()
495+
.positive()
496+
.lte(65535)
497+
.optional()
498+
.describe(
499+
'Port for the relay API HTTP server. When set, the relay API is served on this dedicated port instead of the shared metrics port.',
500+
),
501+
relayApiRateLimitMaxRequests: z
502+
.number()
503+
.int()
504+
.positive()
505+
.optional()
506+
.describe(
507+
'Relay API rate limit: max requests allowed per window. Defaults to 100.',
508+
),
509+
relayApiRateLimitWindowSecs: z
510+
.number()
511+
.int()
512+
.positive()
513+
.optional()
514+
.describe(
515+
'Relay API rate limit: window duration in seconds. Defaults to 60.',
516+
),
517+
relayApiCorsOrigins: z
518+
.string()
519+
.optional()
520+
.describe(
521+
'Relay API allowed CORS origins, comma-separated. Defaults to https://nexus.hyperlane.xyz.',
522+
),
486523
});
487524

488525
export type RelayerConfig = z.infer<typeof RelayerAgentConfigSchema>;

0 commit comments

Comments
 (0)