Skip to content

Commit

Permalink
Merge branch 'audit-q3-2024' into kunal/agg-hook-check-msgValue
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk authored Oct 29, 2024
2 parents 7132f05 + 3e2f9e3 commit b42b871
Show file tree
Hide file tree
Showing 161 changed files with 5,695 additions and 1,756 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-clocks-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/utils': patch
---

Fix objMerge implementation
6 changes: 6 additions & 0 deletions .changeset/dry-foxes-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
---

Add strategyUrl detect and validation in the beginning of `warp apply`
Remove yaml transactions print from `warp apply`
5 changes: 5 additions & 0 deletions .changeset/few-goats-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Enroll new validators. Add tx overrides when deploying ICA accounts. Core checker now surfaces owner violations for defaultHook and requiredHook. App checker temporarily ignores bytecode mismatch violations.
7 changes: 7 additions & 0 deletions .changeset/flat-swans-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperlane-xyz/utils': minor
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Adds new `core check` command to compare local configuration and on chain deployments. Adds memoization to the EvmHookReader to avoid repeating configuration derivation
6 changes: 6 additions & 0 deletions .changeset/fresh-donkeys-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Enable concurrency for IsmModule
5 changes: 5 additions & 0 deletions .changeset/green-kangaroos-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/core': patch
---

Refactor TokenRouter internal amount accounting for use in scaling Warp Routes
6 changes: 6 additions & 0 deletions .changeset/grumpy-ears-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Adds the warp check command to compare warp routes config files with on chain warp route deployments
5 changes: 5 additions & 0 deletions .changeset/itchy-singers-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/core': patch
---

Patched OPL2ToL1Ism to check for correct messageId for external call in verify
5 changes: 5 additions & 0 deletions .changeset/long-swans-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Add prompt in `warp init` command to choose if a trusted relayer should be used instead of making the choice by default for the user and enable the `--yes` flag to default to a trusted ISM
6 changes: 6 additions & 0 deletions .changeset/plenty-chicken-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Add rebasing yield route support into CLI/SDK
5 changes: 5 additions & 0 deletions .changeset/red-actors-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/core': patch
---

Added nonce to HypERC4626
5 changes: 5 additions & 0 deletions .changeset/silver-dancers-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/infra': minor
---

Updates the warpIds for Renzo's latest deployment to Sei and Taiko to be used by the Checker
5 changes: 5 additions & 0 deletions .changeset/sweet-humans-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/core': minor
---

Added PRECISION and rateUpdateNonce to ensure compatibility of HypERC4626
5 changes: 5 additions & 0 deletions .changeset/tender-spiders-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Update `warp apply` such that it updates in place AND extends in a single call
5 changes: 5 additions & 0 deletions .changeset/tidy-hornets-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Add deployments for mainnets: flow, metall2, polynomial
5 changes: 5 additions & 0 deletions .changeset/tricky-mangos-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

updates the multi chain selection prompt by adding search functionality and an optional confirmation prompt for the current selection
5 changes: 5 additions & 0 deletions .changeset/wise-camels-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': patch
---

Set transaction overrides and add 10% gas limit buffer when sending message through HyperlaneCore.
12 changes: 5 additions & 7 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@v4

- name: pip cache
uses: buildjet/cache@v4
- name: Setup python
uses: actions/setup-python@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
python-version: '3.x'

- name: Install prerequisites
run: sudo pip install -r ./.codespell/requirements.txt
- name: Install codespell requirements
run: pip install -r ./.codespell/requirements.txt

- name: Spell check
run: codespell --config=./.codespell/.codespellrc
34 changes: 0 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,40 +234,6 @@ jobs:
RUST_BACKTRACE: 'full'
SEALEVEL_ENABLED: ${{ steps.check-rust-changes.outputs.rust_changes }}

cli-advanced-e2e:
runs-on: ubuntu-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main' || github.base_ref == 'cli-2.0') || github.event_name == 'merge_group'
needs: [yarn-install]
strategy:
matrix:
include:
- test-type: preset_hook_enabled
- test-type: configure_hook_enabled
- test-type: pi_with_core_chain
steps:
- uses: actions/setup-node@v4
with:
node-version: 18

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive

- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1

- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Checkout registry
uses: ./.github/actions/checkout-registry

- name: cli e2e tests
run: ./typescript/cli/ci-advanced-test.sh ${{ matrix.test-type }}

env-test:
runs-on: ubuntu-latest
env:
Expand Down
2 changes: 1 addition & 1 deletion .registryrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3b9f67add3338f151154bc5db76bf4e296f018dd
8583d0841615313c8c880e765eba760378e061cd
1 change: 1 addition & 0 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/agents/relayer/src/msg/gas_payment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl GasPaymentEnforcer {
for (policy, whitelist) in &self.policies {
if !whitelist.msg_matches(message, true) {
trace!(
msg=%message,
hyp_message=%message,
?policy,
?whitelist,
"Message did not match whitelist for policy"
Expand All @@ -114,13 +114,13 @@ impl GasPaymentEnforcer {
}

trace!(
msg=%message,
hyp_message=%message,
?policy,
?whitelist,
"Message matched whitelist for policy"
);
debug!(
msg=%message,
hyp_message=%message,
?policy,
?current_payment,
?current_expenditure,
Expand Down Expand Up @@ -149,7 +149,7 @@ impl GasPaymentEnforcer {
}

error!(
msg=%message,
hyp_message=%message,
policies=?self.policies,
"No gas payment policy matched for message; consider adding a default policy to the end of the policies array which uses a wildcard whitelist."
);
Expand All @@ -159,7 +159,7 @@ impl GasPaymentEnforcer {
pub fn record_tx_outcome(&self, message: &HyperlaneMessage, outcome: TxOutcome) -> Result<()> {
// This log is required in E2E, hence the use of a `const`
debug!(
msg=%message,
hyp_message=%message,
?outcome,
"{}",
GAS_EXPENDITURE_LOG_MESSAGE,
Expand Down
4 changes: 2 additions & 2 deletions rust/main/agents/relayer/src/msg/metadata/multisig/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ impl<T: MultisigIsmMetadataBuilder> MetadataBuilder for T {
.await
.context(CTX)?
{
debug!(?message, ?metadata.checkpoint, "Found checkpoint with quorum");
debug!(hyp_message=?message, ?metadata.checkpoint, "Found checkpoint with quorum");
Ok(Some(self.format_metadata(metadata)?))
} else {
info!(
?message, ?validators, threshold, ism=%multisig_ism.address(),
hyp_message=?message, ?validators, threshold, ism=%multisig_ism.address(),
"Could not fetch metadata: Unable to reach quorum"
);
Ok(None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl MultisigIsmMetadataBuilder for MerkleRootMultisigMetadataBuilder {
.await
.context(CTX)?,
debug!(
?message,
hyp_message=?message,
"No merkle leaf found for message id, must have not been enqueued in the tree"
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl MultisigIsmMetadataBuilder for MessageIdMultisigMetadataBuilder {
.await
.context(CTX)?,
debug!(
?message,
hyp_message=?message,
"No merkle leaf found for message id, must have not been enqueued in the tree"
)
);
Expand Down
18 changes: 10 additions & 8 deletions rust/main/agents/relayer/src/msg/op_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ 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>) {
if let Some(new_status) = new_status {
op.set_status(new_status);
}
// increment the metric before pushing onto the queue, because we lose ownership afterwards
self.get_operation_metric(op.as_ref()).inc();
op.set_status_and_update_metrics(
new_status,
Arc::new(self.get_operation_metric(op.as_ref())),
);

self.queue.lock().await.push(Reverse(op));
}
Expand All @@ -52,9 +51,6 @@ impl OpQueue {
let mut queue = self.queue.lock().await;
let mut popped = vec![];
while let Some(Reverse(op)) = queue.pop() {
// even if the metric is decremented here, the operation may fail to process and be re-added to the queue.
// in those cases, the queue length will look like it has spikes whose sizes are at most `limit`
self.get_operation_metric(op.as_ref()).dec();
popped.push(op);
if popped.len() >= limit {
break;
Expand Down Expand Up @@ -242,6 +238,12 @@ pub mod test {
fn set_retries(&mut self, _retries: u32) {
todo!()
}

fn get_metric(&self) -> Option<Arc<IntGauge>> {
None
}

fn set_metric(&mut self, _metric: Arc<IntGauge>) {}
}

pub fn dummy_metrics_and_label() -> (IntGaugeVec, String) {
Expand Down
6 changes: 5 additions & 1 deletion rust/main/agents/relayer/src/msg/op_submitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ async fn prepare_task(
}
PendingOperationResult::Drop => {
metrics.ops_dropped.inc();
op.decrement_metric_if_exists();
}
PendingOperationResult::Confirm(reason) => {
debug!(?op, "Pushing operation to confirm queue");
Expand Down Expand Up @@ -341,7 +342,7 @@ async fn submit_task(
}
}

#[instrument(skip(confirm_queue, metrics), ret, level = "debug")]
#[instrument(skip(prepare_queue, confirm_queue, metrics), ret, level = "debug")]
async fn submit_single_operation(
mut op: QueueOperation,
prepare_queue: &mut OpQueue,
Expand Down Expand Up @@ -369,6 +370,7 @@ async fn submit_single_operation(
}
PendingOperationResult::Drop => {
// Not expected to hit this case in `submit`, but it's here for completeness
op.decrement_metric_if_exists();
}
PendingOperationResult::Success | PendingOperationResult::Confirm(_) => {
confirm_op(op, confirm_queue, metrics).await
Expand Down Expand Up @@ -457,6 +459,7 @@ async fn confirm_operation(
PendingOperationResult::Success => {
debug!(?op, "Operation confirmed");
metrics.ops_confirmed.inc();
op.decrement_metric_if_exists();
}
PendingOperationResult::NotReady => {
confirm_queue.push(op, None).await;
Expand All @@ -475,6 +478,7 @@ async fn confirm_operation(
}
PendingOperationResult::Drop => {
metrics.ops_dropped.inc();
op.decrement_metric_if_exists();
}
}
operation_result
Expand Down
11 changes: 11 additions & 0 deletions rust/main/agents/relayer/src/msg/pending_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ pub struct PendingMessage {
#[new(default)]
#[serde(skip_serializing)]
metadata: Option<Vec<u8>>,
#[new(default)]
#[serde(skip_serializing)]
metric: Option<Arc<IntGauge>>,
}

impl Debug for PendingMessage {
Expand Down Expand Up @@ -481,6 +484,14 @@ impl PendingOperation for PendingMessage {
fn try_get_mailbox(&self) -> Option<Arc<dyn Mailbox>> {
Some(self.ctx.destination_mailbox.clone())
}

fn get_metric(&self) -> Option<Arc<IntGauge>> {
self.metric.clone()
}

fn set_metric(&mut self, metric: Arc<IntGauge>) {
self.metric = Some(metric);
}
}

impl PendingMessage {
Expand Down
2 changes: 1 addition & 1 deletion rust/main/agents/relayer/src/msg/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl DirectionalNonceIterator {
if let Some(message) = self.indexed_message_with_nonce()? {
Self::update_max_nonce_gauge(&message, metrics);
if !self.is_message_processed()? {
debug!(?message, iterator=?self, "Found processable message");
debug!(hyp_message=?message, iterator=?self, "Found processable message");
return Ok(MessageStatus::Processable(message));
} else {
return Ok(MessageStatus::Processed);
Expand Down
15 changes: 15 additions & 0 deletions rust/main/chains/hyperlane-cosmos/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,24 @@ pub enum HyperlaneCosmosError {
/// Public key error
#[error("{0}")]
PublicKeyError(String),
/// Address error
#[error("{0}")]
AddressError(String),
/// Signer info error
#[error("{0}")]
SignerInfoError(String),
/// Serde error
#[error("{0}")]
SerdeError(#[from] serde_json::Error),
/// Empty error
#[error("{0}")]
UnparsableEmptyField(String),
/// Parsing error
#[error("{0}")]
ParsingFailed(String),
/// Parsing attempt failed
#[error("Parsing attempt failed. (Errors: {0:?})")]
ParsingAttemptsFailed(Vec<HyperlaneCosmosError>),
}

impl From<HyperlaneCosmosError> for ChainCommunicationError {
Expand Down
Loading

0 comments on commit b42b871

Please sign in to comment.