Skip to content

Commit 3a1b2a3

Browse files
ali-behjatiReisen
authored andcommitted
Address comments
1 parent 468817c commit 3a1b2a3

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

hermes/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hermes/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ serde_qs = { version = "0.12.0", features = ["axum"] }
6464

6565
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1"}
6666
wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" }
67-
# pyth-oracle = { git = "https://github.com/pyth-network/pyth-client", rev = "7d593d87e07a1e2486e7ca21597d664ee72be1ec", features = ["library"] }
68-
pyth-oracle = { git = "https://github.com/pyth-network/pyth-client", rev = "319cdc1baade5c4780b830eaf927f9bfef89ee39" , features = ["library"] }
67+
pyth-oracle = { git = "https://github.com/pyth-network/pyth-client", rev = "1bdac0d2ee39a5a9f27eb86e4fd01229bd68aa5a" , features = ["library", "strum", "serde"] }
6968

7069

7170
strum = { version = "0.24", features = ["derive"] }

hermes/src/store/storage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ impl MessageState {
106106
}
107107

108108
#[derive(Clone, Copy)]
109+
#[allow(dead_code)]
109110
pub enum MessageStateFilter {
110111
All,
111112
Only(MessageType),

hermes/src/store/storage/local_storage.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use {
44
MessageState,
55
MessageStateFilter,
66
MessageStateKey,
7+
MessageStateTime,
78
RequestTime,
89
Storage,
910
StorageInstance,
@@ -36,10 +37,7 @@ impl LocalStorage {
3637
pub fn new_instance(cache_size: u64) -> StorageInstance {
3738
Box::new(Self {
3839
message_cache: Arc::new(DashMap::new()),
39-
accumulator_cache: Cache::builder()
40-
.max_capacity(cache_size)
41-
.time_to_live(std::time::Duration::from_secs(60 * 60 * 24))
42-
.build(),
40+
accumulator_cache: Cache::builder().max_capacity(cache_size).build(),
4341
cache_size,
4442
})
4543
}
@@ -62,12 +60,17 @@ impl LocalStorage {
6260
}
6361
}
6462

63+
let lookup_time = MessageStateTime {
64+
publish_time: time,
65+
slot: 0,
66+
};
67+
6568
// Binary search returns Ok(idx) if the element is found at index idx or Err(idx) if it's not
6669
// found which idx is the index where the element should be inserted to keep the vector sorted.
6770
// Getting idx within any of the match arms will give us the index of the element that is
6871
// closest after or equal to the requested time.
6972
let idx = match key_cache
70-
.binary_search_by_key(&time, |record| record.time().publish_time)
73+
.binary_search_by_key(&lookup_time, |record| record.time())
7174
{
7275
Ok(idx) => idx,
7376
Err(idx) => idx,

hermes/src/store/types.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@ use {
22
super::proof::wormhole_merkle::WormholeMerkleMessageProof,
33
pyth_oracle::{
44
Message,
5-
MessageType,
65
PriceFeedMessage,
76
},
87
};
98

10-
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
11-
pub struct MessageIdentifier {
12-
pub price_id: [u8; 32],
13-
pub type_: MessageType,
14-
}
15-
169
#[derive(Clone, PartialEq, Debug)]
1710
pub struct ProofSet {
1811
pub wormhole_merkle_proof: WormholeMerkleMessageProof,

hermes/src/store/wormhole.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use {
2727
},
2828
};
2929

30-
/// Parses and verifies a VAA to ensure it is signed by the Wormhole guardian set.
30+
/// Verifies a VAA to ensure it is signed by the Wormhole guardian set.
3131
pub async fn verify_vaa<'a>(
3232
store: &Store,
3333
vaa: Vaa<&'a RawMessage>,

0 commit comments

Comments
 (0)