Skip to content

Commit

Permalink
Merge branch 'main' into storage-snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes authored Nov 28, 2023
2 parents 3b5457e + 68d4f2f commit 5dac2ce
Show file tree
Hide file tree
Showing 65 changed files with 1,501 additions and 272 deletions.
6 changes: 6 additions & 0 deletions .changeset/tiny-teachers-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Add support for all ISM types in CLI interactive config creation
20 changes: 10 additions & 10 deletions rust/Cargo.lock

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

10 changes: 5 additions & 5 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,27 @@ cosmwasm-schema = "1.2.7"
[workspace.dependencies.ethers]
features = []
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2023-06-01"
tag = "2023-11-08"

[workspace.dependencies.ethers-contract]
features = ["legacy"]
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2023-06-01"
tag = "2023-11-08"

[workspace.dependencies.ethers-core]
features = []
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2023-06-01"
tag = "2023-11-08"

[workspace.dependencies.ethers-providers]
features = []
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2023-06-01"
tag = "2023-11-08"

[workspace.dependencies.ethers-signers]
features = ["aws"]
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2023-06-01"
tag = "2023-11-08"

[patch.crates-io.curve25519-dalek]
branch = "v3.2.2-relax-zeroize"
Expand Down
12 changes: 10 additions & 2 deletions rust/helm/hyperlane-agent/templates/external-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,25 @@ spec:
{{- range .Values.hyperlane.chains }}
{{- if not .disabled }}
HYP_CHAINS_{{ .name | upper }}_CUSTOMRPCURLS: {{ printf "'{{ .%s_rpcs | mustFromJson | join \",\" }}'" .name }}
{{- if eq .protocol "cosmos" }}
HYP_CHAINS_{{ .name | upper }}_GRPCURL: {{ printf "'{{ .%s_grpc }}'" .name }}
{{- end }}
{{- end }}
{{- end }}
data:
{{- /*
* For each network, load the secret in GCP secret manager with the form: environment-rpc-endpoint-network,
* and associate it with the secret key networkname_rpc.
* For each network, load the secret in GCP secret manager with the form: environment-rpc-endpoints-network,
* and associate it with the secret key networkname_rpcs.
*/}}
{{- range .Values.hyperlane.chains }}
{{- if not .disabled }}
- secretKey: {{ printf "%s_rpcs" .name }}
remoteRef:
key: {{ printf "%s-rpc-endpoints-%s" $.Values.hyperlane.runEnv .name }}
{{- if eq .protocol "cosmos" }}
- secretKey: {{ printf "%s_grpc" .name }}
remoteRef:
key: {{ printf "%s-grpc-endpoint-%s" $.Values.hyperlane.runEnv .name }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@ spec:
{{- include "agent-common.labels" . | nindent 10 }}
data:
{{- range .Values.hyperlane.relayerChains }}
{{- if eq .signer.type "hexKey" }}
{{- if or (eq .signer.type "hexKey") (eq .signer.type "cosmosKey") }}
HYP_CHAINS_{{ .name | upper }}_SIGNER_KEY: {{ printf "'{{ .%s_signer_key | toString }}'" .name }}
{{- include "agent-common.config-env-vars" (dict "config" .signer "format" "config_map" "key_name_prefix" (printf "CHAINS_%s_SIGNER_" (.name | upper))) | nindent 8 }}
{{- end }}
{{- if and (eq .signer.type "aws") $.Values.hyperlane.relayer.aws }}
HYP_CHAINS_{{ .name | upper }}_SIGNER_TYPE: aws
HYP_CHAINS_{{ .name | upper }}_SIGNER_ID: {{ .signer.id }}
HYP_CHAINS_{{ .name | upper }}_SIGNER_REGION: {{ .signer.region}}
{{- end }}
{{- end }}
{{- if .Values.hyperlane.relayer.aws }}
AWS_ACCESS_KEY_ID: {{ print "'{{ .aws_access_key_id | toString }}'" }}
AWS_SECRET_ACCESS_KEY: {{ print "'{{ .aws_secret_access_key | toString }}'" }}
{{- end }}
{{- end }}
data:
{{- range .Values.hyperlane.relayerChains }}
{{- if eq .signer.type "hexKey" }}
{{- if or (eq .signer.type "hexKey") (eq .signer.type "cosmosKey") }}
- secretKey: {{ printf "%s_signer_key" .name }}
remoteRef:
{{- if $.Values.hyperlane.relayer.usingDefaultSignerKey }}
Expand Down
3 changes: 2 additions & 1 deletion rust/helm/hyperlane-agent/templates/validator-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
data:
{{- range $index, $config := .Values.hyperlane.validator.configs }}
validator-{{ $index }}.env: |
{{- include "agent-common.config-env-vars" (dict "config" $config "format" "dot_env") | nindent 4 }}
{{- include "agent-common.config-env-vars" (dict "config" (get $config "chainSigner") "format" "dot_env" "key_name_prefix" (printf "CHAINS_%s_SIGNER_" ($config.originChainName | upper))) | nindent 4 }}
{{- include "agent-common.config-env-vars" (dict "config" (omit $config "chainSigner") "format" "dot_env") | nindent 4 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ spec:
validator-{{ $index }}.env: |
{{- if eq .validator.type "hexKey" }}
HYP_VALIDATOR_KEY={{ printf "'{{ .signer_key_%d | toString }}'" $index }}
HYP_CHAINS_{{ .originChainName | upper }}_SIGNER_KEY={{ printf "'{{ .signer_key_%d | toString }}'" $index }}
{{- end }}
{{- if or (eq .checkpointSyncer.type "s3") $.Values.hyperlane.aws }}
AWS_ACCESS_KEY_ID={{ printf "'{{ .aws_access_key_id_%d | toString }}'" $index }}
AWS_SECRET_ACCESS_KEY={{ printf "'{{ .aws_secret_access_key_%d | toString }}'" $index }}
{{- end }}
{{- if or (eq .chainSigner.type "hexKey") (eq .chainSigner.type "cosmosKey") }}
HYP_CHAINS_{{ .originChainName | upper }}_SIGNER_KEY={{ printf "'{{ .signer_key_%d | toString }}'" $index }}
{{- end }}
{{ $index = add1 $index }}
{{- end }}
data:
{{ $index = 0 }}
{{- range .Values.hyperlane.validator.configs }}
{{- if eq .validator.type "hexKey" }}
{{- if or (eq .validator.type "hexKey") (eq .chainSigner.type "hexKey") (eq .chainSigner.type "cosmosKey") }}
- secretKey: signer_key_{{ $index }}
remoteRef:
key: {{ printf "%s-%s-key-%s-validator-%d" $.Values.hyperlane.context $.Values.hyperlane.runEnv .originChainName $index }}
Expand Down
8 changes: 4 additions & 4 deletions rust/hyperlane-core/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ pub enum KnownHyperlaneDomain {
ScrollSepolia = 534351,

/// Cosmos local chains
CosmosTest26657 = 26657,
CosmosTest26658 = 26658,
CosmosTest99990 = 99990,
CosmosTest99991 = 99991,
}

#[derive(Clone)]
Expand Down Expand Up @@ -200,7 +200,7 @@ impl KnownHyperlaneDomain {
Goerli, Mumbai, Fuji, ArbitrumGoerli, OptimismGoerli, BinanceSmartChainTestnet,
Alfajores, MoonbaseAlpha, Sepolia, PolygonZkEvmTestnet, LineaGoerli, BaseGoerli, ScrollSepolia, Chiado
],
LocalTestChain: [Test1, Test2, Test3, FuelTest1, SealevelTest1, SealevelTest2, CosmosTest26657, CosmosTest26658],
LocalTestChain: [Test1, Test2, Test3, FuelTest1, SealevelTest1, SealevelTest2, CosmosTest99990, CosmosTest99991],
})
}

Expand All @@ -215,7 +215,7 @@ impl KnownHyperlaneDomain {
],
HyperlaneDomainProtocol::Fuel: [FuelTest1],
HyperlaneDomainProtocol::Sealevel: [SealevelTest1, SealevelTest2],
HyperlaneDomainProtocol::Cosmos: [CosmosTest26657, CosmosTest26658],
HyperlaneDomainProtocol::Cosmos: [CosmosTest99990, CosmosTest99991],
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions rust/utils/run-locally/src/cosmos/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ fn link_network(
) {
let validator_addr = validator.addr(hrp);

let dest_domain = if network.domain == 26657 {
26658
let dest_domain = if network.domain == 99990 {
99991
} else {
26657
99990
};

// hook routing
Expand Down
36 changes: 21 additions & 15 deletions rust/utils/run-locally/src/cosmos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ pub struct CosmosNetwork {
pub launch_resp: CosmosResp,
pub deployments: Deployments,
pub chain_id: String,
pub metrics_port: u32,
pub domain: u32,
}

Expand All @@ -182,17 +183,17 @@ impl Drop for CosmosNetwork {
}
}

impl From<(CosmosResp, Deployments, String, u32)> for CosmosNetwork {
fn from(v: (CosmosResp, Deployments, String, u32)) -> Self {
impl From<(CosmosResp, Deployments, String, u32, u32)> for CosmosNetwork {
fn from(v: (CosmosResp, Deployments, String, u32, u32)) -> Self {
Self {
launch_resp: v.0,
deployments: v.1,
chain_id: v.2,
domain: v.3,
metrics_port: v.3,
domain: v.4,
}
}
}

pub struct CosmosHyperlaneStack {
pub validators: Vec<AgentHandles>,
pub relayer: AgentHandles,
Expand Down Expand Up @@ -258,7 +259,7 @@ fn launch_cosmos_validator(
.hyp_env("ORIGINCHAINNAME", agent_config.name)
.hyp_env("REORGPERIOD", "100")
.hyp_env("DB", validator_base_db.to_str().unwrap())
.hyp_env("METRICSPORT", agent_config.domain_id.to_string())
.hyp_env("METRICSPORT", agent_config.metrics_port.to_string())
.hyp_env("VALIDATOR_SIGNER_TYPE", agent_config.signer.typ)
.hyp_env("VALIDATOR_KEY", agent_config.signer.key.clone())
.hyp_env("VALIDATOR_PREFIX", "osmo")
Expand All @@ -274,6 +275,7 @@ fn launch_cosmos_validator(
fn launch_cosmos_relayer(
agent_config_path: PathBuf,
relay_chains: Vec<String>,
metrics: u32,
debug: bool,
) -> AgentHandles {
let relayer_bin = concat_path(format!("../../{AGENT_BIN_PATH}"), "relayer");
Expand All @@ -290,7 +292,7 @@ fn launch_cosmos_relayer(
.hyp_env("ALLOWLOCALCHECKPOINTSYNCERS", "true")
.hyp_env("TRACING_LEVEL", if debug { "debug" } else { "info" })
.hyp_env("GASPAYMENTENFORCEMENT", "[{\"type\": \"none\"}]")
.hyp_env("METRICSPORT", 9093.to_string())
.hyp_env("METRICSPORT", metrics.to_string())
.spawn("RLY");

relayer
Expand Down Expand Up @@ -347,18 +349,20 @@ fn run_locally() {
};

let port_start = 26600u32;
let domain_start = 26657u32;
let metrics_port_start = 9090u32;
let domain_start = 99990u32;
let node_count = 2;

let nodes = (0..node_count)
.map(|i| {
(
launch_cosmos_node(CosmosConfig {
node_port_base: port_start + (i * 10),
chain_id: format!("cosmos-test-{}", i + 26657),
chain_id: format!("cosmos-test-{}", i + domain_start),
..default_config.clone()
}),
format!("cosmos-test-{}", i + 26657),
format!("cosmos-test-{}", i + domain_start),
metrics_port_start + i,
domain_start + i,
)
})
Expand All @@ -371,8 +375,8 @@ fn run_locally() {

let nodes = nodes
.into_iter()
.map(|v| (v.0.join(), v.1, v.2))
.map(|(launch_resp, chain_id, domain)| {
.map(|v| (v.0.join(), v.1, v.2, v.3))
.map(|(launch_resp, chain_id, metrics_port, domain)| {
let deployments = deploy_cw_hyperlane(
launch_resp.cli(&osmosisd),
launch_resp.endpoint.clone(),
Expand All @@ -381,14 +385,14 @@ fn run_locally() {
domain,
);

(launch_resp, deployments, chain_id, domain)
(launch_resp, deployments, chain_id, metrics_port, domain)
})
.collect::<Vec<_>>();

// nodes with base deployments
let nodes = nodes
.into_iter()
.map(|v| (v.0, v.1.join(), v.2, v.3))
.map(|v| (v.0, v.1.join(), v.2, v.3, v.4))
.map(|v| v.into())
.collect::<Vec<CosmosNetwork>>();

Expand Down Expand Up @@ -448,9 +452,11 @@ fn run_locally() {
.into_values()
.map(|agent_config| launch_cosmos_validator(agent_config, agent_config_path.clone(), debug))
.collect::<Vec<_>>();
let hpl_rly_metrics_port = metrics_port_start + node_count + 1u32;
let hpl_rly = launch_cosmos_relayer(
agent_config_path,
agent_config_out.chains.into_keys().collect::<Vec<_>>(),
hpl_rly_metrics_port,
debug,
);

Expand Down Expand Up @@ -516,7 +522,7 @@ fn run_locally() {
let mut failure_occurred = false;
loop {
// look for the end condition.
if termination_invariants_met(dispatched_messages).unwrap_or(false) {
if termination_invariants_met(hpl_rly_metrics_port, dispatched_messages).unwrap_or(false) {
// end condition reached successfully
break;
} else if (Instant::now() - loop_start).as_secs() > TIMEOUT_SECS {
Expand All @@ -536,7 +542,7 @@ fn run_locally() {
}
}

fn termination_invariants_met(_messages_expected: u32) -> eyre::Result<bool> {
fn termination_invariants_met(_metrics_port: u32, _messages_expected: u32) -> eyre::Result<bool> {
Ok(true)
// TODO: uncomment once CI passes consistently on Ubuntu
// let gas_payments_scraped = fetch_metric(
Expand Down
Loading

0 comments on commit 5dac2ce

Please sign in to comment.