Update Rust (#2765)

### Description

Regular rust version and package updates.

### Drive-by changes

None

### Related issues


### Backward compatibility

Yes

### Testing

Unit Tests
pull/2771/head
Mattie Conover 1 year ago committed by GitHub
parent 62ab488db9
commit 741c9bb553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      rust-toolchain
  2. 1665
      rust/Cargo.lock
  3. 10
      rust/Cargo.toml
  4. 2
      rust/Dockerfile
  5. 4
      rust/README.md
  6. 8
      rust/agents/relayer/src/msg/metadata/base.rs
  7. 23
      rust/agents/relayer/src/msg/pending_message.rs
  8. 47
      rust/agents/relayer/src/msg/pending_operation.rs
  9. 2
      rust/agents/relayer/src/msg/processor.rs
  10. 4
      rust/agents/relayer/src/settings/mod.rs
  11. 2
      rust/agents/scraper/migration/Cargo.toml
  12. 13
      rust/agents/scraper/migration/bin/generate_entities.rs
  13. 6
      rust/agents/scraper/src/chain_scraper/mod.rs
  14. 6
      rust/agents/scraper/src/db/generated/block.rs
  15. 2
      rust/agents/scraper/src/db/generated/cursor.rs
  16. 10
      rust/agents/scraper/src/db/generated/delivered_message.rs
  17. 2
      rust/agents/scraper/src/db/generated/domain.rs
  18. 4
      rust/agents/scraper/src/db/generated/gas_payment.rs
  19. 16
      rust/agents/scraper/src/db/generated/message.rs
  20. 2
      rust/agents/scraper/src/db/generated/mod.rs
  21. 15
      rust/agents/scraper/src/db/generated/prelude.rs
  22. 12
      rust/agents/scraper/src/db/generated/transaction.rs
  23. 10
      rust/agents/scraper/src/settings.rs
  24. 4
      rust/agents/validator/src/settings.rs
  25. 19
      rust/chains/hyperlane-ethereum/src/tx.rs
  26. 36
      rust/chains/hyperlane-ethereum/src/validator_announce.rs
  27. 18
      rust/hyperlane-base/src/contract_sync/cursor.rs
  28. 4
      rust/hyperlane-base/src/contract_sync/mod.rs
  29. 5
      rust/hyperlane-base/src/types/local_storage.rs
  30. 52
      rust/hyperlane-core/src/types/primitive_types.rs
  31. 36
      rust/sealevel/programs/mailbox-test/src/functional.rs

@ -1,3 +1,3 @@
[toolchain]
channel = "1.71.1"
channel = "1.72.1"
profile = "default"

1665
rust/Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -55,7 +55,7 @@ auto_impl = "1.0"
backtrace = "0.3"
base64 = "0.21.2"
bincode = "1.3"
borsh = "0.9"
borsh = "0.9" # 0.9 is needed for solana 1.14
bs58 = "0.5.0"
bytes = "1"
clap = "4"
@ -76,7 +76,7 @@ fuels = "0.38"
fuels-code-gen = "0.38"
futures = "0.3"
futures-util = "0.3"
generic-array = { version = "0.14", features = ["serde", "more_lengths"] }
generic-array = { version = "1.0", features = ["serde", "more_lengths"] }
getrandom = { version = "0.2", features = ["js"] } # Required for WASM support https://docs.rs/getrandom/latest/getrandom/#webassembly-support
hex = "0.4"
itertools = "0.11.0"
@ -85,7 +85,7 @@ log = "0.4"
macro_rules_attribute = "0.2"
maplit = "1.0"
mockall = "0.11"
nix = { version = "0.26", default-features = false }
nix = { version = "0.27", default-features = false }
num = "0.4"
num-bigint = "0.4"
num-derive = "0.4.0"
@ -99,8 +99,8 @@ regex = "1.5"
reqwest = "0.11"
rlp = "=0.5.2"
rocksdb = "0.21.0"
sea-orm = { version = "0.11.1", features = ["sqlx-postgres", "runtime-tokio-native-tls", "with-bigdecimal", "with-time", "macros"] }
sea-orm-migration = { version = "0.11.1", features = ["sqlx-postgres", "runtime-tokio-native-tls"] }
sea-orm = { version = "0.12.3", features = ["sqlx-postgres", "runtime-tokio-native-tls", "with-bigdecimal", "with-time", "macros"] }
sea-orm-migration = { version = "0.12.3", features = ["sqlx-postgres", "runtime-tokio-native-tls"] }
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_bytes = "0.11"

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:experimental
FROM rust:1.71.1 as builder
FROM rust:1.72.1 as builder
WORKDIR /usr/src
# 1a: Prepare for static linking

@ -5,14 +5,14 @@
- install `rustup`
- [link here](https://rustup.rs/)
Note: You should be running >= version `1.71.1` of the rustc compiler, you can see that version with this command and
Note: You should be running >= version `1.72.1` of the rustc compiler, you can see that version with this command and
should see similar output:
```
$ rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.71.1 (eb26296b5 2023-08-03)`
info: The currently active `rustc` version is `rustc 1.72.1 (d5c2e9c34 2023-09-13)`
```
### Running Locally

@ -184,8 +184,12 @@ impl BaseMetadataBuilder {
for (&validator, validator_storage_locations) in validators.iter().zip(storage_locations) {
for storage_location in validator_storage_locations.iter().rev() {
let Ok(config) = CheckpointSyncerConf::from_str(storage_location) else {
debug!(?validator, ?storage_location, "Could not parse checkpoint syncer config for validator");
continue
debug!(
?validator,
?storage_location,
"Could not parse checkpoint syncer config for validator"
);
continue;
};
// If this is a LocalStorage based checkpoint syncer and it's not

@ -1,17 +1,17 @@
use std::fmt::{Debug, Formatter};
use std::sync::Arc;
use std::time::{Duration, Instant};
use std::{
fmt::{Debug, Formatter},
sync::Arc,
time::{Duration, Instant},
};
use async_trait::async_trait;
use derive_new::new;
use eyre::{Context, Result};
use hyperlane_base::db::HyperlaneRocksDB;
use hyperlane_base::{db::HyperlaneRocksDB, CoreMetrics};
use hyperlane_core::{HyperlaneChain, HyperlaneDomain, HyperlaneMessage, Mailbox, U256};
use prometheus::{IntCounter, IntGauge};
use tracing::{debug, error, info, instrument, trace, warn};
use hyperlane_base::CoreMetrics;
use hyperlane_core::{HyperlaneChain, HyperlaneDomain, HyperlaneMessage, Mailbox, U256};
use super::{
gas_payment::GasPaymentEnforcer,
metadata::{BaseMetadataBuilder, MetadataBuilder},
@ -183,11 +183,10 @@ impl PendingOperation for PendingMessage {
.message_meets_gas_payment_requirement(&self.message, &tx_cost_estimate)
.await,
"checking if message meets gas payment requirement"
)
else {
info!(?tx_cost_estimate, "Gas payment requirement not met yet");
return self.on_reprepare();
};
) else {
info!(?tx_cost_estimate, "Gas payment requirement not met yet");
return self.on_reprepare();
};
// Go ahead and attempt processing of message to destination chain.
debug!(

@ -1,10 +1,8 @@
use std::cmp::Ordering;
use std::time::Instant;
use std::{cmp::Ordering, time::Instant};
use async_trait::async_trait;
use enum_dispatch::enum_dispatch;
use eyre::Report;
use hyperlane_core::HyperlaneDomain;
#[allow(unused_imports)] // required for enum_dispatch
@ -123,29 +121,30 @@ macro_rules! make_op_try {
/// Handle a result and either return early with retry or a critical failure on
/// error.
macro_rules! op_try {
(critical: $e:expr, $ctx:literal) => {
match $e {
Ok(v) => v,
Err(e) => {
error!(error=?e, concat!("Error when ", $ctx));
return PendingOperationResult::CriticalFailure(
Err::<(), _>(e)
.context(concat!("When ", $ctx))
.unwrap_err()
);
(critical: $e:expr, $ctx:literal) => {
match $e {
Ok(v) => v,
Err(e) => {
error!(error=?e, concat!("Error when ", $ctx));
return PendingOperationResult::CriticalFailure(
Err::<(), _>(e)
.context(concat!("When ", $ctx))
.unwrap_err()
);
}
}
}
};
($e:expr, $ctx:literal) => {
match $e {
Ok(v) => v,
Err(e) => {
warn!(error=?e, concat!("Error when ", $ctx));
return $on_retry();
};
($e:expr, $ctx:literal) => {
match $e {
Ok(v) => v,
Err(e) => {
warn!(error=?e, concat!("Error when ", $ctx));
#[allow(clippy::redundant_closure_call)]
return $on_retry();
}
}
}
};
}
};
}
};
}

@ -412,7 +412,7 @@ mod test {
.await;
// Set some retry counts. This should update HyperlaneDB entries too.
let msg_retries_to_set = vec![3, 0, 10];
let msg_retries_to_set = [3, 0, 10];
pending_messages
.into_iter()
.enumerate()

@ -544,7 +544,9 @@ impl FromRawConf<DeprecatedRawRelayerSettings> for RelayerSettings {
let (Some(origin_chain_names), Some(destination_chain_names)) =
(origin_chain_names, destination_chain_names)
else { return Err(err) };
else {
return Err(err);
};
let chain_filter = origin_chain_names
.iter()

@ -18,7 +18,7 @@ sea-orm.workspace = true
sea-orm-migration.workspace = true
serde.workspace = true
time.workspace = true
tokio = { workspace = true, features = ["rt", "macros", "parking_lot"] }
tokio = { workspace = true, features = ["rt", "process", "macros", "parking_lot"] }
# bin-only deps
tracing-subscriber.workspace = true

@ -1,18 +1,13 @@
use std::path::Path;
use std::process::Stdio;
use std::time::Duration;
use tokio::fs::remove_dir_all;
use tokio::process::Command;
use tokio::time::sleep;
use std::{path::Path, process::Stdio, time::Duration};
use common::*;
use tokio::{fs::remove_dir_all, process::Command, time::sleep};
mod common;
const RAW_DB_PATH: &str = "./agents/scraper/src/db/generated";
const DOCKER_NAME: &str = "scraper-entity-generator";
const CLI_VERSION: &str = "0.11.1";
const CLI_VERSION: &str = "0.12.3";
struct PostgresDockerContainer;
@ -58,7 +53,7 @@ impl Drop for PostgresDockerContainer {
}
}
#[tokio::main]
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), DbErr> {
assert_eq!(
std::env::current_dir().unwrap().file_name().unwrap(),

@ -384,9 +384,9 @@ impl HyperlaneMessageStore for HyperlaneSqlDb {
/// was dispatched.
async fn retrieve_dispatched_block_number(&self, nonce: u32) -> Result<Option<u64>> {
let Some(tx_id) = self
.db
.retrieve_dispatched_tx_id(self.domain().id(), &self.mailbox_address, nonce)
.await?
.db
.retrieve_dispatched_tx_id(self.domain().id(), &self.mailbox_address, nonce)
.await?
else {
return Ok(None);
};

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
use sea_orm::entity::prelude::*;
@ -56,9 +56,7 @@ impl ColumnTrait for Column {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::Domain => ColumnType::Integer.def(),
Self::Hash => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None))
.def()
.unique(),
Self::Hash => ColumnType::Binary(BlobSize::Blob(None)).def().unique(),
Self::Height => ColumnType::BigInteger.def(),
Self::Timestamp => ColumnType::DateTime.def(),
}

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
use sea_orm::entity::prelude::*;

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
use sea_orm::entity::prelude::*;
@ -55,13 +55,9 @@ impl ColumnTrait for Column {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::MsgId => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None))
.def()
.unique(),
Self::MsgId => ColumnType::Binary(BlobSize::Blob(None)).def().unique(),
Self::Domain => ColumnType::Integer.def(),
Self::DestinationMailbox => {
ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def()
}
Self::DestinationMailbox => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::DestinationTxId => ColumnType::BigInteger.def(),
}
}

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
use sea_orm::entity::prelude::*;

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
use sea_orm::entity::prelude::*;
@ -60,7 +60,7 @@ impl ColumnTrait for Column {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::Domain => ColumnType::Integer.def(),
Self::MsgId => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def(),
Self::MsgId => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::Payment => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::GasAmount => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::TxId => ColumnType::BigInteger.def(),

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
use sea_orm::entity::prelude::*;
@ -65,18 +65,14 @@ impl ColumnTrait for Column {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::MsgId => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def(),
Self::MsgId => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::Origin => ColumnType::Integer.def(),
Self::Destination => ColumnType::Integer.def(),
Self::Nonce => ColumnType::Integer.def(),
Self::Sender => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def(),
Self::Recipient => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def(),
Self::MsgBody => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None))
.def()
.null(),
Self::OriginMailbox => {
ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def()
}
Self::Sender => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::Recipient => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::MsgBody => ColumnType::Binary(BlobSize::Blob(None)).def().null(),
Self::OriginMailbox => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::OriginTxId => ColumnType::BigInteger.def(),
}
}

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
pub mod prelude;

@ -1,9 +1,8 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
pub use super::block::Entity as Block;
pub use super::cursor::Entity as Cursor;
pub use super::delivered_message::Entity as DeliveredMessage;
pub use super::domain::Entity as Domain;
pub use super::gas_payment::Entity as GasPayment;
pub use super::message::Entity as Message;
pub use super::transaction::Entity as Transaction;
pub use super::{
block::Entity as Block, cursor::Entity as Cursor,
delivered_message::Entity as DeliveredMessage, domain::Entity as Domain,
gas_payment::Entity as GasPayment, message::Entity as Message,
transaction::Entity as Transaction,
};

@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.1
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
use sea_orm::entity::prelude::*;
@ -73,9 +73,7 @@ impl ColumnTrait for Column {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::Hash => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None))
.def()
.unique(),
Self::Hash => ColumnType::Binary(BlobSize::Blob(None)).def().unique(),
Self::BlockId => ColumnType::BigInteger.def(),
Self::GasLimit => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::MaxPriorityFeePerGas => ColumnType::Decimal(Some((78u32, 0u32))).def().null(),
@ -83,10 +81,8 @@ impl ColumnTrait for Column {
Self::GasPrice => ColumnType::Decimal(Some((78u32, 0u32))).def().null(),
Self::EffectiveGasPrice => ColumnType::Decimal(Some((78u32, 0u32))).def().null(),
Self::Nonce => ColumnType::BigInteger.def(),
Self::Sender => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def(),
Self::Recipient => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None))
.def()
.null(),
Self::Sender => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::Recipient => ColumnType::Binary(BlobSize::Blob(None)).def().null(),
Self::GasUsed => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::CumulativeGasUsed => ColumnType::Decimal(Some((78u32, 0u32))).def(),
}

@ -125,8 +125,14 @@ impl FromRawConf<DeprecatedRawScraperSettings> for ScraperSettings {
.chainstoscrape
.ok_or_else(|| eyre!("Missing `chainstoscrape` list"))
.take_err(&mut err, || cwp + "chainstoscrape")
.map(|s| s.split(',').map(str::to_ascii_lowercase).collect::<Vec<_>>())
else { return Err(err) };
.map(|s| {
s.split(',')
.map(str::to_ascii_lowercase)
.collect::<Vec<_>>()
})
else {
return Err(err);
};
let base = raw
.base

@ -253,7 +253,9 @@ impl FromRawConf<DeprecatedRawValidatorSettings> for ValidatorSettings {
.ok_or_else(|| eyre!("Missing `originchainname`"))
.take_err(&mut err, || cwp + "originchainname")
.map(|s| s.to_ascii_lowercase())
else { return Err(err) };
else {
return Err(err);
};
let db = raw
.db

@ -1,15 +1,16 @@
use std::sync::Arc;
use std::time::Duration;
use std::{sync::Arc, time::Duration};
use ethers::abi::Detokenize;
use ethers::prelude::{NameOrAddress, TransactionReceipt};
use ethers::types::Eip1559TransactionRequest;
use ethers::{
abi::Detokenize,
prelude::{NameOrAddress, TransactionReceipt},
types::Eip1559TransactionRequest,
};
use ethers_contract::builders::ContractCall;
use hyperlane_core::{
utils::fmt_bytes, ChainCommunicationError, ChainResult, KnownHyperlaneDomain, H256, U256,
};
use tracing::{error, info};
use hyperlane_core::utils::fmt_bytes;
use hyperlane_core::{ChainCommunicationError, ChainResult, KnownHyperlaneDomain, H256, U256};
use crate::Middleware;
/// An amount of gas to add to the estimated gas
@ -85,7 +86,7 @@ where
};
let Ok((max_fee, max_priority_fee)) = provider.estimate_eip1559_fees(None).await else {
// Is not EIP 1559 chain
return Ok(tx.gas(gas_limit))
return Ok(tx.gas(gas_limit));
};
let max_priority_fee = if matches!(
KnownHyperlaneDomain::try_from(domain),

@ -1,26 +1,25 @@
#![allow(clippy::enum_variant_names)]
#![allow(missing_docs)]
use std::collections::HashMap;
use std::sync::Arc;
use std::{collections::HashMap, sync::Arc};
use async_trait::async_trait;
use ethers::providers::Middleware;
use ethers_contract::builders::ContractCall;
use hyperlane_core::{
Announcement, ChainResult, ContractLocator, HyperlaneAbi, HyperlaneChain, HyperlaneContract,
HyperlaneDomain, HyperlaneProvider, SignedType, TxOutcome, ValidatorAnnounce, H160, H256, U256,
};
use tracing::instrument;
use tracing::log::trace;
use crate::contracts::i_validator_announce::{
IValidatorAnnounce as EthereumValidatorAnnounceInternal, IVALIDATORANNOUNCE_ABI,
use tracing::{instrument, log::trace};
use crate::{
contracts::i_validator_announce::{
IValidatorAnnounce as EthereumValidatorAnnounceInternal, IVALIDATORANNOUNCE_ABI,
},
trait_builder::BuildableWithProvider,
tx::{fill_tx_gas_params, report_tx},
EthereumProvider,
};
use crate::trait_builder::BuildableWithProvider;
use crate::tx::{fill_tx_gas_params, report_tx};
use crate::EthereumProvider;
impl<M> std::fmt::Display for EthereumValidatorAnnounceInternal<M>
where
@ -140,22 +139,17 @@ where
let validator = announcement.value.validator;
let eth_h160: ethers::types::H160 = validator.into();
let Ok(contract_call) = self
.announce_contract_call(announcement, None)
.await
else {
trace!("Unable to get announce contract call");
return None;
let Ok(contract_call) = self.announce_contract_call(announcement, None).await else {
trace!("Unable to get announce contract call");
return None;
};
let Ok(balance) = self.provider.get_balance(eth_h160, None).await
else {
let Ok(balance) = self.provider.get_balance(eth_h160, None).await else {
trace!("Unable to query balance");
return None;
};
let Some(max_cost) = contract_call.tx.max_cost()
else {
let Some(max_cost) = contract_call.tx.max_cost() else {
trace!("Unable to get announce max cost");
return None;
};

@ -1,7 +1,7 @@
use std::cmp::Ordering;
use std::fmt::Debug;
use std::ops::RangeInclusive;
use std::{
cmp::Ordering,
fmt::Debug,
ops::RangeInclusive,
sync::Arc,
time::{Duration, Instant},
};
@ -9,14 +9,13 @@ use std::{
use async_trait::async_trait;
use derive_new::new;
use eyre::Result;
use tokio::time::sleep;
use tracing::{debug, warn};
use hyperlane_core::{
ChainCommunicationError, ChainResult, ContractSyncCursor, CursorAction, HyperlaneMessage,
HyperlaneMessageStore, HyperlaneWatermarkedLogStore, IndexMode, Indexer, LogMeta,
SequenceIndexer,
};
use tokio::time::sleep;
use tracing::{debug, warn};
use crate::contract_sync::eta_calculator::SyncerEtaCalculator;
@ -231,10 +230,9 @@ impl ForwardMessageSyncCursor {
self.cursor.sync_state.next_sequence += 1;
}
let (Some(mailbox_count), tip) = self.cursor.indexer.sequence_and_tip().await?
else {
return Ok(None);
};
let (Some(mailbox_count), tip) = self.cursor.indexer.sequence_and_tip().await? else {
return Ok(None);
};
let cursor_count = self.cursor.sync_state.next_sequence;
Ok(match cursor_count.cmp(&mailbox_count) {
Ordering::Equal => {

@ -59,7 +59,9 @@ where
loop {
indexed_height.set(cursor.latest_block() as i64);
let Ok((action, eta)) = cursor.next_action().await else { continue };
let Ok((action, eta)) = cursor.next_action().await else {
continue;
};
match action {
CursorAction::Query(range) => {
debug!(?range, "Looking for for events in index range");

@ -2,9 +2,8 @@ use std::path::PathBuf;
use async_trait::async_trait;
use eyre::{Context, Result};
use prometheus::IntGauge;
use hyperlane_core::{SignedAnnouncement, SignedCheckpoint, SignedCheckpointWithMessageId};
use prometheus::IntGauge;
use crate::traits::CheckpointSyncer;
@ -87,7 +86,7 @@ impl CheckpointSyncer for LocalStorage {
async fn fetch_checkpoint(&self, index: u32) -> Result<Option<SignedCheckpointWithMessageId>> {
let Ok(data) = tokio::fs::read(self.checkpoint_file_path(index)).await else {
return Ok(None)
return Ok(None);
};
let checkpoint = serde_json::from_slice(&data)?;
Ok(Some(checkpoint))

@ -3,11 +3,12 @@
#![allow(clippy::assign_op_pattern)]
#![allow(clippy::reversed_empty_ranges)]
use crate::types::serialize;
use borsh::{BorshDeserialize, BorshSerialize};
use fixed_hash::{construct_fixed_hash, impl_fixed_hash_conversions};
use fixed_hash::impl_fixed_hash_conversions;
use uint::construct_uint;
use crate::types::serialize;
/// Error type for conversion.
#[derive(Debug, PartialEq, Eq)]
pub enum Error {
@ -32,29 +33,38 @@ construct_uint! {
pub struct U512(8);
}
construct_fixed_hash! {
/// 128-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H128(16);
}
mod fixed_hashes {
// we can't change how they made the macro, so ignore the lint
#![allow(clippy::incorrect_clone_impl_on_copy_type)]
construct_fixed_hash! {
/// 160-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H160(20);
}
use borsh::{BorshDeserialize, BorshSerialize};
use fixed_hash::construct_fixed_hash;
construct_fixed_hash! {
/// 256-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H256(32);
}
construct_fixed_hash! {
/// 128-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H128(16);
}
construct_fixed_hash! {
/// 512-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H512(64);
construct_fixed_hash! {
/// 160-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H160(20);
}
construct_fixed_hash! {
/// 256-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H256(32);
}
construct_fixed_hash! {
/// 512-bit hash type.
#[derive(BorshSerialize, BorshDeserialize)]
pub struct H512(64);
}
}
pub use fixed_hashes::*;
#[cfg(feature = "ethers")]
type EthersH160 = ethers_core::types::H160;

@ -2,39 +2,35 @@ use borsh::BorshDeserialize;
use hyperlane_core::{
accumulator::incremental::IncrementalMerkle as MerkleTree, HyperlaneMessage, H256,
};
use solana_program::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
system_program,
};
use solana_program_test::*;
use solana_sdk::{
instruction::InstructionError,
message::Message,
signature::Signer,
signer::keypair::Keypair,
transaction::{Transaction, TransactionError},
};
use hyperlane_sealevel_mailbox::{
accounts::{Inbox, InboxAccount, Outbox},
error::Error as MailboxError,
instruction::{Instruction as MailboxInstruction, OutboxDispatch},
mailbox_dispatched_message_pda_seeds,
};
use hyperlane_sealevel_test_ism::{program::TestIsmError, test_client::TestIsmTestClient};
use hyperlane_sealevel_test_send_receiver::{
program::{HandleMode, IsmReturnDataMode, TestSendReceiverError},
test_client::TestSendReceiverTestClient,
};
use hyperlane_test_utils::{
assert_transaction_error, clone_keypair, get_process_account_metas, get_recipient_ism,
initialize_mailbox, mailbox_id, new_funded_keypair, process, process_instruction,
process_with_accounts,
};
use solana_program::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
system_program,
};
use solana_program_test::*;
use solana_sdk::{
instruction::InstructionError,
message::Message,
signature::Signer,
signer::keypair::Keypair,
transaction::{Transaction, TransactionError},
};
use crate::utils::{
assert_dispatched_message, assert_inbox, assert_message_not_processed, assert_outbox,
@ -463,10 +459,10 @@ async fn test_get_recipient_ism_when_specified() {
let recipient_id = test_send_receiver.id();
let ism = Some(Pubkey::new_unique());
let ism = Pubkey::new_unique();
test_send_receiver
.set_ism(ism, IsmReturnDataMode::EncodeOption)
.set_ism(Some(ism), IsmReturnDataMode::EncodeOption)
.await
.unwrap();
@ -474,7 +470,7 @@ async fn test_get_recipient_ism_when_specified() {
get_recipient_ism(&mut banks_client, &payer, &mailbox_accounts, recipient_id)
.await
.unwrap();
assert_eq!(recipient_ism, ism.unwrap());
assert_eq!(recipient_ism, ism);
}
#[tokio::test]

Loading…
Cancel
Save