Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit b437b74

Browse files
committed
Demotes Arc to Rc.
1 parent 68456fa commit b437b74

File tree

22 files changed

+115
-110
lines changed

22 files changed

+115
-110
lines changed

clap-utils/src/input_parsers.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use {
1414
pubkey::Pubkey,
1515
signature::{read_keypair_file, Keypair, Signature, Signer},
1616
},
17-
std::{str::FromStr, sync::Arc},
17+
std::{rc::Rc, str::FromStr},
1818
};
1919

2020
// Sentinel value used to indicate to write to screen instead of file
@@ -123,7 +123,7 @@ pub fn pubkeys_sigs_of(matches: &ArgMatches<'_>, name: &str) -> Option<Vec<(Pubk
123123
pub fn signer_of(
124124
matches: &ArgMatches<'_>,
125125
name: &str,
126-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
126+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
127127
) -> Result<(Option<Box<dyn Signer>>, Option<Pubkey>), Box<dyn std::error::Error>> {
128128
if let Some(location) = matches.value_of(name) {
129129
let signer = signer_from_path(matches, location, name, wallet_manager)?;
@@ -137,7 +137,7 @@ pub fn signer_of(
137137
pub fn pubkey_of_signer(
138138
matches: &ArgMatches<'_>,
139139
name: &str,
140-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
140+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
141141
) -> Result<Option<Pubkey>, Box<dyn std::error::Error>> {
142142
if let Some(location) = matches.value_of(name) {
143143
Ok(Some(pubkey_from_path(
@@ -154,7 +154,7 @@ pub fn pubkey_of_signer(
154154
pub fn pubkeys_of_multiple_signers(
155155
matches: &ArgMatches<'_>,
156156
name: &str,
157-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
157+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
158158
) -> Result<Option<Vec<Pubkey>>, Box<dyn std::error::Error>> {
159159
if let Some(pubkey_matches) = matches.values_of(name) {
160160
let mut pubkeys: Vec<Pubkey> = vec![];
@@ -170,7 +170,7 @@ pub fn pubkeys_of_multiple_signers(
170170
pub fn resolve_signer(
171171
matches: &ArgMatches<'_>,
172172
name: &str,
173-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
173+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
174174
) -> Result<Option<String>, Box<dyn std::error::Error>> {
175175
resolve_signer_from_path(
176176
matches,

clap-utils/src/keypair.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ use {
4141
io::{stdin, stdout, Write},
4242
ops::Deref,
4343
process::exit,
44+
rc::Rc,
4445
str::FromStr,
45-
sync::Arc,
4646
},
4747
thiserror::Error,
4848
};
@@ -242,7 +242,7 @@ impl DefaultSigner {
242242
&self,
243243
bulk_signers: Vec<Option<Box<dyn Signer>>>,
244244
matches: &ArgMatches<'_>,
245-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
245+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
246246
) -> Result<CliSignerInfo, Box<dyn error::Error>> {
247247
let mut unique_signers = vec![];
248248

@@ -304,7 +304,7 @@ impl DefaultSigner {
304304
pub fn signer_from_path(
305305
&self,
306306
matches: &ArgMatches,
307-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
307+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
308308
) -> Result<Box<dyn Signer>, Box<dyn std::error::Error>> {
309309
signer_from_path(matches, self.path()?, &self.arg_name, wallet_manager)
310310
}
@@ -357,7 +357,7 @@ impl DefaultSigner {
357357
pub fn signer_from_path_with_config(
358358
&self,
359359
matches: &ArgMatches,
360-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
360+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
361361
config: &SignerFromPathConfig,
362362
) -> Result<Box<dyn Signer>, Box<dyn std::error::Error>> {
363363
signer_from_path_with_config(
@@ -686,7 +686,7 @@ pub fn signer_from_path(
686686
matches: &ArgMatches,
687687
path: &str,
688688
keypair_name: &str,
689-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
689+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
690690
) -> Result<Box<dyn Signer>, Box<dyn error::Error>> {
691691
let config = SignerFromPathConfig::default();
692692
signer_from_path_with_config(matches, path, keypair_name, wallet_manager, &config)
@@ -753,7 +753,7 @@ pub fn signer_from_path_with_config(
753753
matches: &ArgMatches,
754754
path: &str,
755755
keypair_name: &str,
756-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
756+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
757757
config: &SignerFromPathConfig,
758758
) -> Result<Box<dyn Signer>, Box<dyn error::Error>> {
759759
let SignerSource {
@@ -860,7 +860,7 @@ pub fn pubkey_from_path(
860860
matches: &ArgMatches,
861861
path: &str,
862862
keypair_name: &str,
863-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
863+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
864864
) -> Result<Pubkey, Box<dyn error::Error>> {
865865
let SignerSource { kind, .. } = parse_signer_source(path)?;
866866
match kind {
@@ -873,7 +873,7 @@ pub fn resolve_signer_from_path(
873873
matches: &ArgMatches,
874874
path: &str,
875875
keypair_name: &str,
876-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
876+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
877877
) -> Result<Option<String>, Box<dyn error::Error>> {
878878
let SignerSource {
879879
kind,

clap-v3-utils/src/input_parsers.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use {
1414
pubkey::Pubkey,
1515
signature::{read_keypair_file, Keypair, Signature, Signer},
1616
},
17-
std::{str::FromStr, sync::Arc},
17+
std::{rc::Rc, str::FromStr},
1818
};
1919

2020
// Sentinel value used to indicate to write to screen instead of file
@@ -123,7 +123,7 @@ pub fn pubkeys_sigs_of(matches: &ArgMatches, name: &str) -> Option<Vec<(Pubkey,
123123
pub fn signer_of(
124124
matches: &ArgMatches,
125125
name: &str,
126-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
126+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
127127
) -> Result<(Option<Box<dyn Signer>>, Option<Pubkey>), Box<dyn std::error::Error>> {
128128
if let Some(location) = matches.value_of(name) {
129129
let signer = signer_from_path(matches, location, name, wallet_manager)?;
@@ -137,7 +137,7 @@ pub fn signer_of(
137137
pub fn pubkey_of_signer(
138138
matches: &ArgMatches,
139139
name: &str,
140-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
140+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
141141
) -> Result<Option<Pubkey>, Box<dyn std::error::Error>> {
142142
if let Some(location) = matches.value_of(name) {
143143
Ok(Some(pubkey_from_path(
@@ -154,7 +154,7 @@ pub fn pubkey_of_signer(
154154
pub fn pubkeys_of_multiple_signers(
155155
matches: &ArgMatches,
156156
name: &str,
157-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
157+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
158158
) -> Result<Option<Vec<Pubkey>>, Box<dyn std::error::Error>> {
159159
if let Some(pubkey_matches) = matches.values_of(name) {
160160
let mut pubkeys: Vec<Pubkey> = vec![];
@@ -170,7 +170,7 @@ pub fn pubkeys_of_multiple_signers(
170170
pub fn resolve_signer(
171171
matches: &ArgMatches,
172172
name: &str,
173-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
173+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
174174
) -> Result<Option<String>, Box<dyn std::error::Error>> {
175175
resolve_signer_from_path(
176176
matches,

clap-v3-utils/src/keypair.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ use {
4242
io::{stdin, stdout, Write},
4343
ops::Deref,
4444
process::exit,
45+
rc::Rc,
4546
str::FromStr,
46-
sync::Arc,
4747
},
4848
thiserror::Error,
4949
};
@@ -243,7 +243,7 @@ impl DefaultSigner {
243243
&self,
244244
bulk_signers: Vec<Option<Box<dyn Signer>>>,
245245
matches: &ArgMatches,
246-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
246+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
247247
) -> Result<CliSignerInfo, Box<dyn error::Error>> {
248248
let mut unique_signers = vec![];
249249

@@ -305,7 +305,7 @@ impl DefaultSigner {
305305
pub fn signer_from_path(
306306
&self,
307307
matches: &ArgMatches,
308-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
308+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
309309
) -> Result<Box<dyn Signer>, Box<dyn std::error::Error>> {
310310
signer_from_path(matches, self.path()?, &self.arg_name, wallet_manager)
311311
}
@@ -358,7 +358,7 @@ impl DefaultSigner {
358358
pub fn signer_from_path_with_config(
359359
&self,
360360
matches: &ArgMatches,
361-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
361+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
362362
config: &SignerFromPathConfig,
363363
) -> Result<Box<dyn Signer>, Box<dyn std::error::Error>> {
364364
signer_from_path_with_config(
@@ -687,7 +687,7 @@ pub fn signer_from_path(
687687
matches: &ArgMatches,
688688
path: &str,
689689
keypair_name: &str,
690-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
690+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
691691
) -> Result<Box<dyn Signer>, Box<dyn error::Error>> {
692692
let config = SignerFromPathConfig::default();
693693
signer_from_path_with_config(matches, path, keypair_name, wallet_manager, &config)
@@ -754,7 +754,7 @@ pub fn signer_from_path_with_config(
754754
matches: &ArgMatches,
755755
path: &str,
756756
keypair_name: &str,
757-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
757+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
758758
config: &SignerFromPathConfig,
759759
) -> Result<Box<dyn Signer>, Box<dyn error::Error>> {
760760
let SignerSource {
@@ -862,7 +862,7 @@ pub fn pubkey_from_path(
862862
matches: &ArgMatches,
863863
path: &str,
864864
keypair_name: &str,
865-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
865+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
866866
) -> Result<Pubkey, Box<dyn error::Error>> {
867867
let SignerSource { kind, .. } = parse_signer_source(path)?;
868868
match kind {
@@ -875,7 +875,7 @@ pub fn resolve_signer_from_path(
875875
matches: &ArgMatches,
876876
path: &str,
877877
keypair_name: &str,
878-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
878+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
879879
) -> Result<Option<String>, Box<dyn error::Error>> {
880880
let SignerSource {
881881
kind,

cli/src/address_lookup_table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use {
1717
account::from_account, clock::Clock, commitment_config::CommitmentConfig, message::Message,
1818
pubkey::Pubkey, signer::Signer, sysvar, transaction::Transaction,
1919
},
20-
std::sync::Arc,
20+
std::{rc::Rc, sync::Arc},
2121
};
2222

2323
#[derive(Debug, PartialEq, Eq)]
@@ -234,7 +234,7 @@ impl AddressLookupTableSubCommands for App<'_, '_> {
234234
pub fn parse_address_lookup_table_subcommand(
235235
matches: &ArgMatches<'_>,
236236
default_signer: &DefaultSigner,
237-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
237+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
238238
) -> Result<CliCommandInfo, CliError> {
239239
let (subcommand, sub_matches) = matches.subcommand();
240240

cli/src/cli.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ use {
3333
},
3434
solana_tpu_client::tpu_client::DEFAULT_TPU_ENABLE_UDP,
3535
solana_vote_program::vote_state::VoteAuthorize,
36-
std::{collections::HashMap, error, io::stdout, str::FromStr, sync::Arc, time::Duration},
36+
std::{
37+
collections::HashMap, error, io::stdout, rc::Rc, str::FromStr, sync::Arc, time::Duration,
38+
},
3739
thiserror::Error,
3840
};
3941

@@ -568,7 +570,7 @@ impl Default for CliConfig<'_> {
568570
pub fn parse_command(
569571
matches: &ArgMatches<'_>,
570572
default_signer: &DefaultSigner,
571-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
573+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
572574
) -> Result<CliCommandInfo, Box<dyn error::Error>> {
573575
let response = match matches.subcommand() {
574576
// Autocompletion Command

cli/src/cluster_query.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ use {
7070
std::{
7171
collections::{BTreeMap, HashMap, VecDeque},
7272
fmt,
73+
rc::Rc,
7374
str::FromStr,
7475
sync::{
7576
atomic::{AtomicBool, Ordering},
@@ -488,7 +489,7 @@ impl ClusterQuerySubCommands for App<'_, '_> {
488489

489490
pub fn parse_catchup(
490491
matches: &ArgMatches<'_>,
491-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
492+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
492493
) -> Result<CliCommandInfo, CliError> {
493494
let node_pubkey = pubkey_of_signer(matches, "node_pubkey", wallet_manager)?;
494495
let mut our_localhost_port = value_t!(matches, "our_localhost", u16).ok();
@@ -523,7 +524,7 @@ pub fn parse_catchup(
523524
pub fn parse_cluster_ping(
524525
matches: &ArgMatches<'_>,
525526
default_signer: &DefaultSigner,
526-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
527+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
527528
) -> Result<CliCommandInfo, CliError> {
528529
let interval = Duration::from_secs(value_t_or_exit!(matches, "interval", u64));
529530
let count = if matches.is_present("count") {
@@ -630,7 +631,7 @@ pub fn parse_get_transaction_count(_matches: &ArgMatches<'_>) -> Result<CliComma
630631

631632
pub fn parse_show_stakes(
632633
matches: &ArgMatches<'_>,
633-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
634+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
634635
) -> Result<CliCommandInfo, CliError> {
635636
let use_lamports_unit = matches.is_present("lamports");
636637
let vote_account_pubkeys =
@@ -682,7 +683,7 @@ pub fn parse_show_validators(matches: &ArgMatches<'_>) -> Result<CliCommandInfo,
682683

683684
pub fn parse_transaction_history(
684685
matches: &ArgMatches<'_>,
685-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
686+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
686687
) -> Result<CliCommandInfo, CliError> {
687688
let address = pubkey_of_signer(matches, "address", wallet_manager)?.unwrap();
688689

@@ -1581,7 +1582,7 @@ pub fn process_ping(
15811582

15821583
pub fn parse_logs(
15831584
matches: &ArgMatches<'_>,
1584-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
1585+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
15851586
) -> Result<CliCommandInfo, CliError> {
15861587
let address = pubkey_of_signer(matches, "address", wallet_manager)?;
15871588
let include_votes = matches.is_present("include_votes");

cli/src/feature.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use {
2525
stake_history::Epoch,
2626
transaction::Transaction,
2727
},
28-
std::{cmp::Ordering, collections::HashMap, fmt, str::FromStr, sync::Arc},
28+
std::{cmp::Ordering, collections::HashMap, fmt, rc::Rc, str::FromStr},
2929
};
3030

3131
const DEFAULT_MAX_ACTIVE_DISPLAY_AGE_SLOTS: Slot = 15_000_000; // ~90days
@@ -478,7 +478,7 @@ fn known_feature(feature: &Pubkey) -> Result<(), CliError> {
478478
pub fn parse_feature_subcommand(
479479
matches: &ArgMatches<'_>,
480480
default_signer: &DefaultSigner,
481-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
481+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
482482
) -> Result<CliCommandInfo, CliError> {
483483
let response = match matches.subcommand() {
484484
("activate", Some(matches)) => {

cli/src/inflation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use {
1212
solana_remote_wallet::remote_wallet::RemoteWalletManager,
1313
solana_rpc_client::rpc_client::RpcClient,
1414
solana_sdk::{clock::Epoch, pubkey::Pubkey},
15-
std::sync::Arc,
15+
std::rc::Rc,
1616
};
1717

1818
#[derive(Debug, PartialEq, Eq)]
@@ -56,7 +56,7 @@ impl InflationSubCommands for App<'_, '_> {
5656
pub fn parse_inflation_subcommand(
5757
matches: &ArgMatches<'_>,
5858
_default_signer: &DefaultSigner,
59-
_wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
59+
_wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
6060
) -> Result<CliCommandInfo, CliError> {
6161
let command = match matches.subcommand() {
6262
("rewards", Some(matches)) => {

cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use {
1818
solana_remote_wallet::remote_wallet::RemoteWalletManager,
1919
solana_rpc_client_api::config::RpcSendTransactionConfig,
2020
solana_tpu_client::tpu_client::DEFAULT_TPU_ENABLE_UDP,
21-
std::{collections::HashMap, error, path::PathBuf, sync::Arc, time::Duration},
21+
std::{collections::HashMap, error, path::PathBuf, rc::Rc, time::Duration},
2222
};
2323

2424
fn parse_settings(matches: &ArgMatches<'_>) -> Result<bool, Box<dyn error::Error>> {
@@ -142,7 +142,7 @@ fn parse_settings(matches: &ArgMatches<'_>) -> Result<bool, Box<dyn error::Error
142142

143143
pub fn parse_args<'a>(
144144
matches: &ArgMatches<'_>,
145-
wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
145+
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
146146
) -> Result<(CliConfig<'a>, CliSigners), Box<dyn error::Error>> {
147147
let config = if let Some(config_file) = matches.value_of("config_file") {
148148
Config::load(config_file).unwrap_or_default()

0 commit comments

Comments
 (0)