Skip to content

Commit

Permalink
Merge branch 'audit-q1-2025' into kunal/value-router
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk authored Dec 20, 2024
2 parents 13e79af + a51b50c commit 4f52a51
Show file tree
Hide file tree
Showing 78 changed files with 4,804 additions and 614 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-bats-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': patch
---

fix: balance check skip confirmation
6 changes: 6 additions & 0 deletions .changeset/lovely-planes-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Allow self-relaying of all messages if there are multiple in a given dispatch transaction.
5 changes: 5 additions & 0 deletions .changeset/many-clouds-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Call google storage API directly and remove @google-cloud/storage dependency from the SDK.
5 changes: 5 additions & 0 deletions .changeset/neat-apples-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/infra': minor
---

added ubtc route extension config + usdc from appchain to base
5 changes: 5 additions & 0 deletions .changeset/new-seas-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Deploy to new chains: arthera, aurora, conflux, conwai, corn, evmos, form, ink, rivalz, soneium, sonic, telos.
5 changes: 5 additions & 0 deletions .changeset/pink-sloths-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/widgets': patch
---

Hide outline in button and text input components
5 changes: 5 additions & 0 deletions .changeset/polite-bulldogs-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperlane-xyz/cli": patch
---

Fix strategy flag propagation
5 changes: 5 additions & 0 deletions .changeset/ten-spiders-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': patch
---

Added ZKSync signer support using zksync-ethers package
2 changes: 1 addition & 1 deletion .registryrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bde63f7c32e8d169d7e3163b14b5bb25bd3d5042
32b4ab3b3df2bedd0d905c6745bcf1c673a60a01
20 changes: 10 additions & 10 deletions rust/main/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/main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -198,27 +198,27 @@ overflow-checks = true
[workspace.dependencies.ethers]
features = []
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2024-12-10"
tag = "2024-12-16"

[workspace.dependencies.ethers-contract]
features = ["legacy"]
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2024-12-10"
tag = "2024-12-16"

[workspace.dependencies.ethers-core]
features = []
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2024-12-10"
tag = "2024-12-16"

[workspace.dependencies.ethers-providers]
features = []
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2024-12-10"
tag = "2024-12-16"

[workspace.dependencies.ethers-signers]
features = ["aws"]
git = "https://github.com/hyperlane-xyz/ethers-rs"
tag = "2024-12-10"
tag = "2024-12-16"

[patch.crates-io.curve25519-dalek]
branch = "v3.2.2-relax-zeroize"
Expand Down
15 changes: 9 additions & 6 deletions rust/main/agents/relayer/src/msg/op_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ impl OpQueue {
/// it's very likely that its status has just changed, so this forces the caller to consider the new status
#[instrument(skip(self), ret, fields(queue_label=%self.queue_metrics_label), level = "trace")]
pub async fn push(&self, mut op: QueueOperation, new_status: Option<PendingOperationStatus>) {
op.set_status_and_update_metrics(
new_status,
Arc::new(self.get_operation_metric(op.as_ref())),
);
let new_metric = Arc::new(self.get_new_operation_metric(op.as_ref(), new_status.clone()));
op.set_status_and_update_metrics(new_status, new_metric);

self.queue.lock().await.push(Reverse(op));
}
Expand Down Expand Up @@ -99,12 +97,17 @@ impl OpQueue {
}

/// Get the metric associated with this operation
fn get_operation_metric(&self, operation: &dyn PendingOperation) -> IntGauge {
fn get_new_operation_metric(
&self,
operation: &dyn PendingOperation,
new_status: Option<PendingOperationStatus>,
) -> IntGauge {
let (destination, app_context) = operation.get_operation_labels();
let new_metric_status = new_status.unwrap_or(operation.status());
self.metrics.with_label_values(&[
&destination,
&self.queue_metrics_label,
&operation.status().to_string(),
&new_metric_status.to_string(),
&app_context,
])
}
Expand Down
31 changes: 27 additions & 4 deletions rust/main/chains/hyperlane-cosmos/src/merkle_tree_hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use async_trait::async_trait;
use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
use once_cell::sync::Lazy;
use tendermint::abci::EventAttribute;
use tracing::instrument;
use tracing::{debug, info, instrument};

use hyperlane_core::accumulator::incremental::IncrementalMerkle;
use hyperlane_core::{
Expand Down Expand Up @@ -223,6 +223,11 @@ impl CosmosMerkleTreeHookIndexer {
fn merkle_tree_insertion_parser(
attrs: &Vec<EventAttribute>,
) -> ChainResult<ParsedEvent<MerkleTreeInsertion>> {
debug!(
?attrs,
"parsing merkle tree insertion from event attributes",
);

let mut contract_address: Option<String> = None;
let mut insertion = IncompleteMerkleTreeInsertion::default();

Expand All @@ -233,17 +238,20 @@ impl CosmosMerkleTreeHookIndexer {
match key {
CONTRACT_ADDRESS_ATTRIBUTE_KEY => {
contract_address = Some(value.to_string());
debug!(?contract_address, "parsed contract address from plain text");
}
v if *CONTRACT_ADDRESS_ATTRIBUTE_KEY_BASE64 == v => {
contract_address = Some(String::from_utf8(
BASE64
.decode(value)
.map_err(Into::<HyperlaneCosmosError>::into)?,
)?);
debug!(?contract_address, "parsed contract address from base64");
}

MESSAGE_ID_ATTRIBUTE_KEY => {
insertion.message_id = Some(H256::from_slice(hex::decode(value)?.as_slice()));
debug!(message_id = ?insertion.message_id, "parsed message_id from plain text");
}
v if *MESSAGE_ID_ATTRIBUTE_KEY_BASE64 == v => {
insertion.message_id = Some(H256::from_slice(
Expand All @@ -254,10 +262,12 @@ impl CosmosMerkleTreeHookIndexer {
)?)?
.as_slice(),
));
debug!(message_id = ?insertion.message_id, "parsed message_id from base64");
}

INDEX_ATTRIBUTE_KEY => {
insertion.leaf_index = Some(value.parse::<u32>()?);
debug!(leaf_index = ?insertion.leaf_index, "parsed leaf_index from plain text");
}
v if *INDEX_ATTRIBUTE_KEY_BASE64 == v => {
insertion.leaf_index = Some(
Expand All @@ -268,16 +278,29 @@ impl CosmosMerkleTreeHookIndexer {
)?
.parse()?,
);
debug!(leaf_index = ?insertion.leaf_index, "parsed leaf_index from base64");
}

_ => {}
unknown => {
debug!(?unknown, "unknown attribute");
}
}
}

let contract_address = contract_address
.ok_or_else(|| ChainCommunicationError::from_other_str("missing contract_address"))?;

Ok(ParsedEvent::new(contract_address, insertion.try_into()?))
debug!(
?contract_address,
?insertion,
"parsed contract address and insertion",
);

let event = ParsedEvent::new(contract_address, insertion.try_into()?);

info!(?event, "parsed event");

Ok(event)
}
}

Expand Down Expand Up @@ -331,7 +354,7 @@ impl SequenceAwareIndexer<MerkleTreeInsertion> for CosmosMerkleTreeHookIndexer {
}
}

#[derive(Default)]
#[derive(Default, Debug)]
struct IncompleteMerkleTreeInsertion {
leaf_index: Option<u32>,
message_id: Option<H256>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use hyperlane_core::{
Announcement, ChainResult, ContractLocator, HyperlaneAbi, HyperlaneChain, HyperlaneContract,
HyperlaneDomain, HyperlaneProvider, SignedType, TxOutcome, ValidatorAnnounce, H160, H256, U256,
};
use tracing::{instrument, log::trace};
use tracing::{instrument, trace};

use crate::{
interfaces::i_validator_announce::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ where
// (These are the default values from ethers doc comments)
const COEFFICIENT: f64 = 1.125;
const EVERY_SECS: u64 = 90u64;
// 550 gwei is the limit we also use for polygon, so we reuse for consistency
const MAX_GAS_PRICE: u128 = 550 * 10u128.pow(9);
// a 3k gwei limit is chosen to account for `treasure` chain, where the highest gas price observed is 1.2k gwei
const MAX_GAS_PRICE: u128 = 3_000 * 10u128.pow(9);
let escalator = GeometricGasPrice::new(COEFFICIENT, EVERY_SECS, MAX_GAS_PRICE.into());
// Check the status of sent txs every eth block or so. The alternative is to subscribe to new blocks and check then,
// which adds unnecessary load on the provider.
Expand Down
Loading

0 comments on commit 4f52a51

Please sign in to comment.