Skip to content

Commit

Permalink
Merge branch 'main' into jeff/operation-status
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiyaa committed Jan 29, 2025
2 parents 1f189d6 + 84f886b commit 28808ff
Show file tree
Hide file tree
Showing 30 changed files with 200 additions and 77 deletions.
5 changes: 0 additions & 5 deletions .changeset/fast-comics-wave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/selfish-drinks-add.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use num_traits::cast::FromPrimitive;
use solana_sdk::{instruction::Instruction, pubkey::Pubkey, signature::Keypair};
use solana_sdk::{instruction::Instruction, pubkey::Pubkey};
use tracing::warn;

use hyperlane_core::{
Expand All @@ -10,19 +10,23 @@ use hyperlane_core::{
use hyperlane_sealevel_interchain_security_module_interface::InterchainSecurityModuleInstruction;
use serializable_account_meta::SimulationReturnData;

use crate::{ConnectionConf, SealevelProvider, SealevelRpcClient};
use crate::{ConnectionConf, SealevelKeypair, SealevelProvider, SealevelRpcClient};

/// A reference to an InterchainSecurityModule contract on some Sealevel chain
#[derive(Debug)]
pub struct SealevelInterchainSecurityModule {
payer: Option<Keypair>,
payer: Option<SealevelKeypair>,
program_id: Pubkey,
provider: SealevelProvider,
}

impl SealevelInterchainSecurityModule {
/// Create a new sealevel InterchainSecurityModule
pub fn new(conf: &ConnectionConf, locator: ContractLocator, payer: Option<Keypair>) -> Self {
pub fn new(
conf: &ConnectionConf,
locator: ContractLocator,
payer: Option<SealevelKeypair>,
) -> Self {
let provider = SealevelProvider::new(locator.domain.clone(), conf);
let program_id = Pubkey::from(<[u8; 32]>::from(locator.address));
Self {
Expand Down
52 changes: 52 additions & 0 deletions rust/main/chains/hyperlane-sealevel/src/keypair.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
use std::ops::Deref;

use solana_sdk::{signature::Keypair, signer::Signer};

/// Wrapper around solana_sdk's Keypair.
/// This implements a custom Debug so the private keys are
/// not exposed.
pub struct SealevelKeypair(pub Keypair);

impl SealevelKeypair {
/// create new SealevelKeypair
pub fn new(keypair: Keypair) -> Self {
Self(keypair)
}
/// Return the underlying keypair
pub fn keypair(&self) -> &Keypair {
&self.0
}
}

impl Deref for SealevelKeypair {
type Target = Keypair;

/// Return the underlying keypair
fn deref(&self) -> &Self::Target {
&self.0
}
}

impl std::fmt::Debug for SealevelKeypair {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.pubkey())
}
}

#[cfg(test)]
mod test {
use solana_sdk::signature::Keypair;

use super::SealevelKeypair;

#[test]
fn test_no_exposed_secret_key() {
let priv_key = "2ckDxzDFpZGeWd7VbHzd6dMgxYpqVDPA8XzeXFuuUJ1K8CjtyTBenD1TSPPovahXEFw3kBihoyAKktyro22MP4bN";
let pub_key = "6oKnHXD2LRzQ4iNsgvkGSNNx68vj5GCYYpR2icy5JZhE";

let keypair = SealevelKeypair(Keypair::from_base58_string(priv_key));

let actual = format!("{:?}", keypair);
assert_eq!(pub_key, actual);
}
}
2 changes: 2 additions & 0 deletions rust/main/chains/hyperlane-sealevel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
pub use crate::multisig_ism::*;
pub use interchain_gas::*;
pub use interchain_security_module::*;
pub use keypair::*;
pub use mailbox::*;
pub use merkle_tree_hook::*;
pub use provider::*;
Expand All @@ -19,6 +20,7 @@ mod account;
mod error;
mod interchain_gas;
mod interchain_security_module;
mod keypair;
mod log_meta_composer;
mod mailbox;
mod merkle_tree_hook;
Expand Down
17 changes: 10 additions & 7 deletions rust/main/chains/hyperlane-sealevel/src/mailbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use solana_sdk::{
commitment_config::CommitmentConfig,
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
signer::{keypair::Keypair, Signer as _},
signer::Signer as _,
};
use tracing::{debug, info, instrument, warn};

Expand All @@ -40,14 +40,17 @@ use hyperlane_core::{
ReorgPeriod, SequenceAwareIndexer, TxCostEstimate, TxOutcome, H256, H512, U256,
};

use crate::log_meta_composer::{
is_message_delivery_instruction, is_message_dispatch_instruction, LogMetaComposer,
};
use crate::tx_submitter::TransactionSubmitter;
use crate::{
account::{search_accounts_by_discriminator, search_and_validate_account},
priority_fee::PriorityFeeOracle,
};
use crate::{
log_meta_composer::{
is_message_delivery_instruction, is_message_dispatch_instruction, LogMetaComposer,
},
SealevelKeypair,
};
use crate::{ConnectionConf, SealevelProvider, SealevelRpcClient};

const SYSTEM_PROGRAM: &str = "11111111111111111111111111111111";
Expand Down Expand Up @@ -79,7 +82,7 @@ pub struct SealevelMailbox {
inbox: (Pubkey, u8),
pub(crate) outbox: (Pubkey, u8),
pub(crate) provider: SealevelProvider,
payer: Option<Keypair>,
payer: Option<SealevelKeypair>,
priority_fee_oracle: Box<dyn PriorityFeeOracle>,
tx_submitter: Box<dyn TransactionSubmitter>,
}
Expand All @@ -89,7 +92,7 @@ impl SealevelMailbox {
pub fn new(
conf: &ConnectionConf,
locator: ContractLocator,
payer: Option<Keypair>,
payer: Option<SealevelKeypair>,
) -> ChainResult<Self> {
let provider = SealevelProvider::new(locator.domain.clone(), conf);
let program_id = Pubkey::from(<[u8; 32]>::from(locator.address));
Expand Down Expand Up @@ -379,7 +382,7 @@ impl SealevelMailbox {
Ok(inbox)
}

fn get_payer(&self) -> ChainResult<&Keypair> {
fn get_payer(&self) -> ChainResult<&SealevelKeypair> {
self.payer
.as_ref()
.ok_or_else(|| ChainCommunicationError::SignerUnavailable)
Expand Down
11 changes: 7 additions & 4 deletions rust/main/chains/hyperlane-sealevel/src/multisig_ism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ use serializable_account_meta::SimulationReturnData;
use solana_sdk::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
signature::Keypair,
};

use crate::{ConnectionConf, SealevelProvider, SealevelRpcClient};
use crate::{ConnectionConf, SealevelKeypair, SealevelProvider, SealevelRpcClient};

use multisig_ism::interface::{
MultisigIsmInstruction, VALIDATORS_AND_THRESHOLD_ACCOUNT_METAS_PDA_SEEDS,
Expand All @@ -20,15 +19,19 @@ use multisig_ism::interface::{
/// A reference to a MultisigIsm contract on some Sealevel chain
#[derive(Debug)]
pub struct SealevelMultisigIsm {
payer: Option<Keypair>,
payer: Option<SealevelKeypair>,
program_id: Pubkey,
domain: HyperlaneDomain,
provider: SealevelProvider,
}

impl SealevelMultisigIsm {
/// Create a new Sealevel MultisigIsm.
pub fn new(conf: &ConnectionConf, locator: ContractLocator, payer: Option<Keypair>) -> Self {
pub fn new(
conf: &ConnectionConf,
locator: ContractLocator,
payer: Option<SealevelKeypair>,
) -> Self {
let provider = SealevelProvider::new(locator.domain.clone(), conf);
let program_id = Pubkey::from(<[u8; 32]>::from(locator.address));

Expand Down
16 changes: 8 additions & 8 deletions rust/main/chains/hyperlane-sealevel/src/rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use solana_sdk::{
instruction::{AccountMeta, Instruction},
message::Message,
pubkey::Pubkey,
signature::{Keypair, Signature, Signer},
signature::{Signature, Signer},
transaction::Transaction,
};
use solana_transaction_status::{
Expand All @@ -31,7 +31,7 @@ use hyperlane_core::{ChainCommunicationError, ChainResult, U256};

use crate::{
error::HyperlaneSealevelError, priority_fee::PriorityFeeOracle,
tx_submitter::TransactionSubmitter,
tx_submitter::TransactionSubmitter, SealevelKeypair,
};

const COMPUTE_UNIT_MULTIPLIER_NUMERATOR: u32 = 11;
Expand Down Expand Up @@ -74,7 +74,7 @@ impl SealevelRpcClient {
/// Simulates an Instruction that will return a list of AccountMetas.
pub async fn get_account_metas(
&self,
payer: &Keypair,
payer: &SealevelKeypair,
instruction: Instruction,
) -> ChainResult<Vec<AccountMeta>> {
// If there's no data at all, default to an empty vec.
Expand Down Expand Up @@ -302,7 +302,7 @@ impl SealevelRpcClient {
/// an Err is returned.
pub async fn simulate_instruction<T: BorshDeserialize + BorshSerialize>(
&self,
payer: &Keypair,
payer: &SealevelKeypair,
instruction: Instruction,
) -> ChainResult<Option<T>> {
let commitment = CommitmentConfig::finalized();
Expand Down Expand Up @@ -357,7 +357,7 @@ impl SealevelRpcClient {
pub async fn get_estimated_costs_for_instruction(
&self,
instruction: Instruction,
payer: &Keypair,
payer: &SealevelKeypair,
tx_submitter: &dyn TransactionSubmitter,
priority_fee_oracle: &dyn PriorityFeeOracle,
) -> ChainResult<SealevelTxCostEstimate> {
Expand Down Expand Up @@ -440,7 +440,7 @@ impl SealevelRpcClient {
pub async fn build_estimated_tx_for_instruction(
&self,
instruction: Instruction,
payer: &Keypair,
payer: &SealevelKeypair,
tx_submitter: &dyn TransactionSubmitter,
priority_fee_oracle: &dyn PriorityFeeOracle,
) -> ChainResult<Transaction> {
Expand Down Expand Up @@ -485,7 +485,7 @@ impl SealevelRpcClient {
compute_unit_limit: u32,
compute_unit_price_micro_lamports: u64,
instruction: Instruction,
payer: &Keypair,
payer: &SealevelKeypair,
tx_submitter: &dyn TransactionSubmitter,
sign: bool,
) -> ChainResult<Transaction> {
Expand Down Expand Up @@ -513,7 +513,7 @@ impl SealevelRpcClient {
Transaction::new_signed_with_payer(
&instructions,
Some(&payer.pubkey()),
&[payer],
&[payer.keypair()],
recent_blockhash,
)
} else {
Expand Down
20 changes: 15 additions & 5 deletions rust/main/hyperlane-base/src/settings/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,13 @@ impl ChainConf {
}
ChainConnectionConf::Sealevel(conf) => {
let keypair = self.sealevel_signer().await.context(ctx)?;
h_sealevel::SealevelMailbox::new(conf, locator, keypair)
.map(|m| Box::new(m) as Box<dyn Mailbox>)
.map_err(Into::into)
h_sealevel::SealevelMailbox::new(
conf,
locator,
keypair.map(h_sealevel::SealevelKeypair::new),
)
.map(|m| Box::new(m) as Box<dyn Mailbox>)
.map_err(Into::into)
}
ChainConnectionConf::Cosmos(conf) => {
let signer = self.cosmos_signer().await.context(ctx)?;
Expand Down Expand Up @@ -568,7 +572,9 @@ impl ChainConf {
ChainConnectionConf::Sealevel(conf) => {
let keypair = self.sealevel_signer().await.context(ctx)?;
let ism = Box::new(h_sealevel::SealevelInterchainSecurityModule::new(
conf, locator, keypair,
conf,
locator,
keypair.map(h_sealevel::SealevelKeypair::new),
));
Ok(ism as Box<dyn InterchainSecurityModule>)
}
Expand Down Expand Up @@ -601,7 +607,11 @@ impl ChainConf {
ChainConnectionConf::Fuel(_) => todo!(),
ChainConnectionConf::Sealevel(conf) => {
let keypair = self.sealevel_signer().await.context(ctx)?;
let ism = Box::new(h_sealevel::SealevelMultisigIsm::new(conf, locator, keypair));
let ism = Box::new(h_sealevel::SealevelMultisigIsm::new(
conf,
locator,
keypair.map(h_sealevel::SealevelKeypair::new),
));
Ok(ism as Box<dyn MultisigIsm>)
}
ChainConnectionConf::Cosmos(conf) => {
Expand Down
7 changes: 7 additions & 0 deletions solidity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @hyperlane-xyz/core

## 5.11.1

### Patch Changes

- 044665692: Make `initialize` function public virtual
- @hyperlane-xyz/utils@8.5.0

## 5.11.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/PackageVersioned.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pragma solidity >=0.6.11;
**/
abstract contract PackageVersioned {
// GENERATED CODE - DO NOT EDIT
string public constant PACKAGE_VERSION = "5.11.0";
string public constant PACKAGE_VERSION = "5.11.1";
}
4 changes: 2 additions & 2 deletions solidity/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@hyperlane-xyz/core",
"description": "Core solidity contracts for Hyperlane",
"version": "5.11.0",
"version": "5.11.1",
"dependencies": {
"@arbitrum/nitro-contracts": "^1.2.1",
"@eth-optimism/contracts": "^0.6.0",
"@hyperlane-xyz/utils": "8.4.0",
"@hyperlane-xyz/utils": "8.5.0",
"@layerzerolabs/lz-evm-oapp-v2": "2.0.2",
"@openzeppelin/contracts": "^4.9.3",
"@openzeppelin/contracts-upgradeable": "^4.9.3",
Expand Down
2 changes: 2 additions & 0 deletions typescript/ccip-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @hyperlane-xyz/ccip-server

## 8.5.0

## 8.4.0

## 8.3.0
Expand Down
2 changes: 1 addition & 1 deletion typescript/ccip-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperlane-xyz/ccip-server",
"version": "8.4.0",
"version": "8.5.0",
"description": "CCIP server",
"typings": "dist/index.d.ts",
"typedocMain": "src/index.ts",
Expand Down
8 changes: 8 additions & 0 deletions typescript/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @hyperlane-xyz/cli

## 8.5.0

### Patch Changes

- Updated dependencies [55b8ccdff]
- @hyperlane-xyz/sdk@8.5.0
- @hyperlane-xyz/utils@8.5.0

## 8.4.0

### Patch Changes
Expand Down
Loading

0 comments on commit 28808ff

Please sign in to comment.