Skip to content

Commit 92e5c5b

Browse files
committed
chore: transition crates to stable rust, unify version
1 parent 28aff03 commit 92e5c5b

File tree

25 files changed

+231
-253
lines changed

25 files changed

+231
-253
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
- id: cargo-clippy-remote-executor
3131
name: Cargo clippy for remote executor
3232
language: "rust"
33-
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
33+
entry: cargo clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
3434
pass_filenames: false
3535
files: governance/remote_executor
3636
# Hooks for cosmwasm contract
@@ -43,7 +43,7 @@ repos:
4343
- id: cargo-clippy-cosmwasm
4444
name: Cargo clippy for cosmwasm contract
4545
language: "rust"
46-
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
46+
entry: cargo clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
4747
pass_filenames: false
4848
files: target_chains/cosmwasm
4949
# Hooks for Hermes
@@ -56,7 +56,7 @@ repos:
5656
- id: cargo-clippy-hermes
5757
name: Cargo clippy for Hermes
5858
language: "rust"
59-
entry: cargo +nightly-2024-03-26 clippy --manifest-path ./apps/hermes/server/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
59+
entry: cargo clippy --manifest-path ./apps/hermes/server/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
6060
pass_filenames: false
6161
files: apps/hermes
6262
# Hooks for Fortuna
@@ -76,7 +76,7 @@ repos:
7676
- id: cargo-clippy-message-buffer
7777
name: Cargo clippy for message buffer contract
7878
language: "rust"
79-
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./pythnet/message_buffer/Cargo.toml --tests --fix --allow-dirty --allow-staged --features test-bpf -- -D warnings
79+
entry: cargo clippy --manifest-path ./pythnet/message_buffer/Cargo.toml --tests --fix --allow-dirty --allow-staged --features test-bpf -- -D warnings
8080
pass_filenames: false
8181
files: pythnet/message_buffer
8282
# Hooks for pythnet_sdk
@@ -89,7 +89,7 @@ repos:
8989
- id: cargo-clippy-pythnet-sdk
9090
name: Cargo clippy for pythnet SDK
9191
language: "rust"
92-
entry: cargo +nightly-2024-08-04 clippy --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
92+
entry: cargo clippy --manifest-path ./pythnet/pythnet_sdk/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
9393
pass_filenames: false
9494
files: pythnet/pythnet_sdk
9595
# Hooks for solana receiver contract
@@ -102,7 +102,7 @@ repos:
102102
- id: cargo-clippy-pyth-solana-receiver
103103
name: Cargo clippy for solana target chain contract
104104
language: "rust"
105-
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./target_chains/solana/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
105+
entry: cargo clippy --manifest-path ./target_chains/solana/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
106106
pass_filenames: false
107107
files: target_chains/solana
108108
# For express relay python files

apps/fortuna/rust-toolchain

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/hermes/server/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/hermes/server/rust-toolchain

Lines changed: 0 additions & 2 deletions
This file was deleted.

apps/hermes/server/src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#![feature(never_type)]
2-
#![feature(btree_cursors)]
3-
41
use {
52
anyhow::Result,
63
clap::{

apps/hermes/server/src/network/pythnet.rs

Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,30 @@
44
55
use {
66
crate::{
7-
api::types::{
8-
PriceFeedMetadata,
9-
RpcPriceIdentifier,
10-
},
7+
api::types::{PriceFeedMetadata, RpcPriceIdentifier},
118
config::RunOptions,
12-
network::wormhole::{
13-
BridgeData,
14-
GuardianSet,
15-
GuardianSetData,
16-
},
9+
network::wormhole::{BridgeData, GuardianSet, GuardianSetData},
1710
state::{
18-
aggregate::{
19-
AccumulatorMessages,
20-
Aggregates,
21-
Update,
22-
},
23-
price_feeds_metadata::{
24-
PriceFeedMeta,
25-
DEFAULT_PRICE_FEEDS_CACHE_UPDATE_INTERVAL,
26-
},
11+
aggregate::{AccumulatorMessages, Aggregates, Update},
12+
price_feeds_metadata::{PriceFeedMeta, DEFAULT_PRICE_FEEDS_CACHE_UPDATE_INTERVAL},
2713
wormhole::Wormhole,
2814
},
2915
},
30-
anyhow::{
31-
anyhow,
32-
Result,
33-
},
16+
anyhow::{anyhow, Result},
3417
borsh::BorshDeserialize,
3518
futures::stream::StreamExt,
3619
pyth_sdk::PriceIdentifier,
37-
pyth_sdk_solana::state::{
38-
load_mapping_account,
39-
load_product_account,
40-
},
20+
pyth_sdk_solana::state::{load_mapping_account, load_product_account},
4121
solana_account_decoder::UiAccountEncoding,
4222
solana_client::{
43-
nonblocking::{
44-
pubsub_client::PubsubClient,
45-
rpc_client::RpcClient,
46-
},
47-
rpc_config::{
48-
RpcAccountInfoConfig,
49-
RpcProgramAccountsConfig,
50-
},
51-
rpc_filter::{
52-
Memcmp,
53-
MemcmpEncodedBytes,
54-
RpcFilterType,
55-
},
23+
nonblocking::{pubsub_client::PubsubClient, rpc_client::RpcClient},
24+
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig},
25+
rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType},
5626
},
5727
solana_sdk::{
58-
account::Account,
59-
bs58,
60-
commitment_config::CommitmentConfig,
61-
pubkey::Pubkey,
62-
system_program,
63-
},
64-
std::{
65-
collections::BTreeMap,
66-
sync::Arc,
67-
time::Duration,
28+
account::Account, bs58, commitment_config::CommitmentConfig, pubkey::Pubkey, system_program,
6829
},
30+
std::{collections::BTreeMap, sync::Arc, time::Duration},
6931
tokio::time::Instant,
7032
};
7133

@@ -141,7 +103,7 @@ async fn fetch_bridge_data(
141103
}
142104
}
143105

144-
pub async fn run<S>(store: Arc<S>, pythnet_ws_endpoint: String) -> Result<!>
106+
pub async fn run<S>(store: Arc<S>, pythnet_ws_endpoint: String) -> Result<()>
145107
where
146108
S: Aggregates,
147109
S: Wormhole,
@@ -155,11 +117,11 @@ where
155117
encoding: Some(UiAccountEncoding::Base64Zstd),
156118
..Default::default()
157119
},
158-
filters: Some(vec![RpcFilterType::Memcmp(Memcmp::new(
120+
filters: Some(vec![RpcFilterType::Memcmp(Memcmp::new(
159121
0, // offset
160122
MemcmpEncodedBytes::Bytes(b"PAS1".to_vec()), // bytes
161123
))]),
162-
with_context: Some(true),
124+
with_context: Some(true),
163125
};
164126

165127
// Listen for all PythNet accounts, we will filter down to the Accumulator related accounts.

apps/hermes/server/src/network/wormhole.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ where
140140
}
141141

142142
#[tracing::instrument(skip(opts, state))]
143-
async fn run<S>(opts: RunOptions, state: Arc<S>) -> Result<!>
143+
async fn run<S>(opts: RunOptions, state: Arc<S>) -> Result<()>
144144
where
145145
S: Wormhole,
146146
S: Send + Sync + 'static,

apps/hermes/server/src/state/cache.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use {
2525
HashMap,
2626
HashSet,
2727
},
28-
ops::Bound,
2928
sync::Arc,
3029
},
3130
strum::IntoEnumIterator,
@@ -300,8 +299,8 @@ async fn retrieve_message_state(
300299

301300
// Get the first element that is greater than or equal to the lookup time.
302301
key_cache
303-
.lower_bound(Bound::Included(&lookup_time))
304-
.peek_next()
302+
.range(lookup_time..)
303+
.next()
305304
.map(|(_, v)| v)
306305
.cloned()
307306
}
@@ -594,7 +593,6 @@ mod test {
594593
);
595594
}
596595

597-
598596
#[tokio::test]
599597
pub async fn test_store_and_retrieve_first_after_message_state_fails_for_past_time() {
600598
// Initialize state with a cache size of 2 per key.

governance/remote_executor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[workspace]
2+
resolver = "2"
23
members = [
34
"programs/*",
45
"cli/"

governance/remote_executor/programs/remote-executor/src/tests/executor_simulator.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,9 @@ impl From<ExecutorError> for TransactionError {
389389
fn from(val: ExecutorError) -> Self {
390390
TransactionError::InstructionError(
391391
0,
392-
InstructionError::try_from(u64::from(ProgramError::from(
392+
InstructionError::from(u64::from(ProgramError::from(
393393
anchor_lang::prelude::Error::from(val),
394-
)))
395-
.unwrap(),
394+
))),
396395
)
397396
}
398397
}

governance/remote_executor/programs/remote-executor/src/tests/test_adversarial.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,9 @@ impl IntoTransactionError for ErrorCode {
192192
fn into_transation_error(self) -> TransactionError {
193193
TransactionError::InstructionError(
194194
0,
195-
InstructionError::try_from(u64::from(ProgramError::from(
195+
InstructionError::from(u64::from(ProgramError::from(
196196
anchor_lang::prelude::Error::from(self),
197-
)))
198-
.unwrap(),
197+
))),
199198
)
200199
}
201200
}

governance/remote_executor/rust-toolchain.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)