浏览代码

chore: update to latest nightly (#1398)

Reisen 1 年之前
父节点
当前提交
d66c00f84a
共有 4 个文件被更改,包括 201 次插入212 次删除
  1. 192 206
      hermes/Cargo.lock
  2. 1 1
      hermes/rust-toolchain
  3. 6 4
      hermes/src/network/wormhole.rs
  4. 2 1
      hermes/src/state/cache.rs

文件差异内容过多而无法显示
+ 192 - 206
hermes/Cargo.lock


+ 1 - 1
hermes/rust-toolchain

@@ -1,2 +1,2 @@
 [toolchain]
-channel = "nightly-2023-07-23"
+channel = "nightly-2024-03-26"

+ 6 - 4
hermes/src/network/wormhole.rs

@@ -14,7 +14,7 @@ use {
         ensure,
         Result,
     },
-    chrono::NaiveDateTime,
+    chrono::DateTime,
     futures::StreamExt,
     proto::spy::v1::{
         filter_entry::Filter,
@@ -200,9 +200,11 @@ pub async fn process_message(state: Arc<State>, vaa_bytes: Vec<u8>) -> Result<()
     let vaa = serde_wormhole::from_slice::<Vaa<&RawMessage>>(&vaa_bytes)?;
 
     // Log VAA Processing.
-    let vaa_timestamp = NaiveDateTime::from_timestamp_opt(vaa.timestamp as i64, 0);
-    let vaa_timestamp = vaa_timestamp.unwrap();
-    let vaa_timestamp = vaa_timestamp.format("%Y-%m-%dT%H:%M:%S.%fZ").to_string();
+    let vaa_timestamp = DateTime::from_timestamp(vaa.timestamp as i64, 0)
+        .ok_or(anyhow!("Failed to parse VAA Tiestamp"))?
+        .format("%Y-%m-%dT%H:%M:%S.%fZ")
+        .to_string();
+
     let slot = match WormholeMessage::try_from_bytes(vaa.payload)?.payload {
         WormholePayload::Merkle(proof) => proof.slot,
     };

+ 2 - 1
hermes/src/state/cache.rs

@@ -137,7 +137,8 @@ async fn retrieve_message_state(
                     // Get the first element that is greater than or equal to the lookup time.
                     key_cache
                         .lower_bound(Bound::Included(&lookup_time))
-                        .value()
+                        .peek_next()
+                        .map(|(_, v)| v)
                         .cloned()
                 }
                 RequestTime::AtSlot(slot) => {

部分文件因为文件数量过多而无法显示