Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin-root/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mortezashojaei committed Oct 22, 2024
2 parents dedaa34 + 72c23c0 commit 4f541e3
Show file tree
Hide file tree
Showing 110 changed files with 3,403 additions and 1,140 deletions.
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.
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
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/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
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
10 changes: 4 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,12 +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_and_update_metrics(
new_status,
Arc::new(self.get_operation_metric(op.as_ref())),
);
}
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 Down
7 changes: 4 additions & 3 deletions 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 @@ -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,9 +459,7 @@ async fn confirm_operation(
PendingOperationResult::Success => {
debug!(?op, "Operation confirmed");
metrics.ops_confirmed.inc();
if let Some(metric) = op.get_metric() {
metric.dec()
}
op.decrement_metric_if_exists();
}
PendingOperationResult::NotReady => {
confirm_queue.push(op, None).await;
Expand All @@ -478,6 +478,7 @@ async fn confirm_operation(
}
PendingOperationResult::Drop => {
metrics.ops_dropped.inc();
op.decrement_metric_if_exists();
}
}
operation_result
Expand Down
12 changes: 10 additions & 2 deletions rust/main/chains/hyperlane-cosmos/src/providers/rpc/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tendermint_rpc::endpoint::block_results::Response as BlockResultsResponse;
use tendermint_rpc::endpoint::tx;
use tendermint_rpc::HttpClient;
use time::OffsetDateTime;
use tracing::{debug, instrument, trace};
use tracing::{debug, info, instrument, trace};

use hyperlane_core::{
ChainCommunicationError, ChainResult, ContractLocator, HyperlaneDomain, LogMeta, H256, U256,
Expand Down Expand Up @@ -249,6 +249,9 @@ impl WasmRpcProvider for CosmosWasmRpcProvider {
// The two calls below could be made in parallel, but on cosmos rate limiting is a bigger problem
// than indexing latency, so we do them sequentially.
let block = self.rpc_client.get_block(block_number).await?;

debug!(?block_number, block_hash = ?block.block_id.hash, cursor_label, domain=?self.domain, "Getting logs in block with hash");

let block_results = self.rpc_client.get_block_results(block_number).await?;

Ok(self.handle_txs(block, block_results, parser, cursor_label))
Expand All @@ -268,7 +271,12 @@ impl WasmRpcProvider for CosmosWasmRpcProvider {
debug!(?hash, cursor_label, domain=?self.domain, "Getting logs in transaction");

let tx = self.rpc_client.get_tx_by_hash(hash).await?;
let block = self.rpc_client.get_block(tx.height.value() as u32).await?;

let block_number = tx.height.value() as u32;
let block = self.rpc_client.get_block(block_number).await?;

debug!(?block_number, block_hash = ?block.block_id.hash, cursor_label, domain=?self.domain, "Getting logs in transaction: block info");

let block_hash = H256::from_slice(block.block_id.hash.as_bytes());

Ok(self.handle_tx(tx, block_hash, parser).collect())
Expand Down
29 changes: 0 additions & 29 deletions rust/main/chains/hyperlane-sealevel/src/client.rs

This file was deleted.

52 changes: 15 additions & 37 deletions rust/main/chains/hyperlane-sealevel/src/interchain_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use solana_client::{
use std::ops::RangeInclusive;
use tracing::{info, instrument};

use crate::{
client::RpcClientWithDebug, utils::get_finalized_block_number, ConnectionConf, SealevelProvider,
};
use crate::{ConnectionConf, SealevelProvider, SealevelRpcClient};
use solana_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey};

use derive_new::new;
Expand Down Expand Up @@ -60,20 +58,14 @@ impl SealevelInterchainGasPaymaster {
}

async fn determine_igp_program_id(
rpc_client: &RpcClientWithDebug,
rpc_client: &SealevelRpcClient,
igp_account_pubkey: &H256,
) -> ChainResult<Pubkey> {
let account = rpc_client
.get_account_with_commitment(
&Pubkey::from(<[u8; 32]>::from(*igp_account_pubkey)),
CommitmentConfig::finalized(),
)
.await
.map_err(ChainCommunicationError::from_other)?
.value
.ok_or_else(|| {
ChainCommunicationError::from_other_str("Could not find IGP account for pubkey")
})?;
.get_account_with_finalized_commitment(&Pubkey::from(<[u8; 32]>::from(
*igp_account_pubkey,
)))
.await?;
Ok(account.owner)
}
}
Expand All @@ -99,7 +91,7 @@ impl InterchainGasPaymaster for SealevelInterchainGasPaymaster {}
/// Struct that retrieves event data for a Sealevel IGP contract
#[derive(Debug)]
pub struct SealevelInterchainGasPaymasterIndexer {
rpc_client: RpcClientWithDebug,
rpc_client: SealevelRpcClient,
igp: SealevelInterchainGasPaymaster,
}

Expand All @@ -118,10 +110,7 @@ impl SealevelInterchainGasPaymasterIndexer {
igp_account_locator: ContractLocator<'_>,
) -> ChainResult<Self> {
// Set the `processed` commitment at rpc level
let rpc_client = RpcClientWithDebug::new_with_commitment(
conf.url.to_string(),
CommitmentConfig::processed(),
);
let rpc_client = SealevelRpcClient::new(conf.url.to_string());

let igp = SealevelInterchainGasPaymaster::new(conf, &igp_account_locator).await?;
Ok(Self { rpc_client, igp })
Expand Down Expand Up @@ -169,8 +158,7 @@ impl SealevelInterchainGasPaymasterIndexer {
let accounts = self
.rpc_client
.get_program_accounts_with_config(&self.igp.program_id, config)
.await
.map_err(ChainCommunicationError::from_other)?;
.await?;

tracing::debug!(accounts=?accounts, "Fetched program accounts");

Expand Down Expand Up @@ -202,13 +190,8 @@ impl SealevelInterchainGasPaymasterIndexer {
// Now that we have the valid gas payment PDA pubkey, we can get the full account data.
let account = self
.rpc_client
.get_account_with_commitment(&valid_payment_pda_pubkey, CommitmentConfig::finalized())
.await
.map_err(ChainCommunicationError::from_other)?
.value
.ok_or_else(|| {
ChainCommunicationError::from_other_str("Could not find account data")
})?;
.get_account_with_finalized_commitment(&valid_payment_pda_pubkey)
.await?;
let gas_payment_account = GasPaymentAccount::fetch(&mut account.data.as_ref())
.map_err(ChainCommunicationError::from_other)?
.into_inner();
Expand Down Expand Up @@ -274,7 +257,7 @@ impl Indexer<InterchainGasPayment> for SealevelInterchainGasPaymasterIndexer {
#[instrument(level = "debug", err, ret, skip(self))]
#[allow(clippy::blocks_in_conditions)] // TODO: `rustc` 1.80.1 clippy issue
async fn get_finalized_block_number(&self) -> ChainResult<u32> {
get_finalized_block_number(&self.rpc_client).await
self.rpc_client.get_block_height().await
}
}

Expand All @@ -285,21 +268,16 @@ impl SequenceAwareIndexer<InterchainGasPayment> for SealevelInterchainGasPaymast
async fn latest_sequence_count_and_tip(&self) -> ChainResult<(Option<u32>, u32)> {
let program_data_account = self
.rpc_client
.get_account_with_commitment(&self.igp.data_pda_pubkey, CommitmentConfig::finalized())
.await
.map_err(ChainCommunicationError::from_other)?
.value
.ok_or_else(|| {
ChainCommunicationError::from_other_str("Could not find account data")
})?;
.get_account_with_finalized_commitment(&self.igp.data_pda_pubkey)
.await?;
let program_data = ProgramDataAccount::fetch(&mut program_data_account.data.as_ref())
.map_err(ChainCommunicationError::from_other)?
.into_inner();
let payment_count = program_data
.payment_count
.try_into()
.map_err(StrOrIntParseError::from)?;
let tip = get_finalized_block_number(&self.rpc_client).await?;
let tip = self.rpc_client.get_block_height().await?;
Ok((Some(payment_count), tip))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use hyperlane_core::{
use hyperlane_sealevel_interchain_security_module_interface::InterchainSecurityModuleInstruction;
use serializable_account_meta::SimulationReturnData;

use crate::{utils::simulate_instruction, ConnectionConf, RpcClientWithDebug, SealevelProvider};
use crate::{ConnectionConf, SealevelProvider, SealevelRpcClient};

/// A reference to an InterchainSecurityModule contract on some Sealevel chain
#[derive(Debug)]
Expand All @@ -32,7 +32,7 @@ impl SealevelInterchainSecurityModule {
}
}

fn rpc(&self) -> &RpcClientWithDebug {
fn rpc(&self) -> &SealevelRpcClient {
self.provider.rpc()
}
}
Expand Down Expand Up @@ -64,18 +64,19 @@ impl InterchainSecurityModule for SealevelInterchainSecurityModule {
vec![],
);

let module = simulate_instruction::<SimulationReturnData<u32>>(
self.rpc(),
self.payer
.as_ref()
.ok_or_else(|| ChainCommunicationError::SignerUnavailable)?,
instruction,
)
.await?
.ok_or_else(|| {
ChainCommunicationError::from_other_str("No return data was returned from the ISM")
})?
.return_data;
let module = self
.rpc()
.simulate_instruction::<SimulationReturnData<u32>>(
self.payer
.as_ref()
.ok_or_else(|| ChainCommunicationError::SignerUnavailable)?,
instruction,
)
.await?
.ok_or_else(|| {
ChainCommunicationError::from_other_str("No return data was returned from the ISM")
})?
.return_data;

if let Some(module_type) = ModuleType::from_u32(module) {
Ok(module_type)
Expand Down
Loading

0 comments on commit 4f541e3

Please sign in to comment.