Skip to content

Commit 61ddbf2

Browse files
committed
💚 Fixing pipeline checks
1 parent a1343d6 commit 61ddbf2

File tree

7 files changed

+71
-74
lines changed

7 files changed

+71
-74
lines changed

crates/client/src/client.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
use crate::{constants::*, Config, Reader, TempClone};
22

3-
use anchor_client;
43
use anchor_client::ClientError as Error;
54
// TODO maybe can deleted
6-
use borsh;
5+
// use borsh;
76
use fehler::{throw, throws};
87
use solana_sdk::program_pack::Pack;
98
use solana_sdk::signer::Signer;
109
// TODO maybe can deleted
1110
use futures::{self, StreamExt};
12-
use log;
1311
// TODO maybe can deleted
14-
use serde;
12+
// use serde;
1513
// TODO maybe can deleted
16-
use solana_account_decoder;
14+
// use solana_account_decoder;
1715
// TODO maybe can deleted
18-
use solana_cli_output;
19-
use solana_transaction_status;
20-
use spl_associated_token_account;
16+
// use solana_cli_output;
2117

2218
// @TODO: Make compatible with the latest Anchor deps.
2319
// https://github.com/project-serum/anchor/pull/1307#issuecomment-1022592683
@@ -187,7 +183,7 @@ impl Client {
187183
.program(solana_sdk::system_program::ID)?
188184
.async_rpc();
189185
rpc_client
190-
.get_account_with_commitment(&account, rpc_client.commitment())
186+
.get_account_with_commitment(account, rpc_client.commitment())
191187
.await
192188
.unwrap()
193189
.value
@@ -326,10 +322,7 @@ impl Client {
326322
.unwrap()
327323
.async_rpc();
328324

329-
let signature = rpc_client
330-
.request_airdrop(&address, lamports)
331-
.await
332-
.unwrap();
325+
let signature = rpc_client.request_airdrop(address, lamports).await.unwrap();
333326

334327
let (airdrop_result, error) = loop {
335328
match rpc_client.get_signature_status(&signature).await.unwrap() {
@@ -708,14 +701,14 @@ impl Client {
708701
spl_associated_token_account::instruction::create_associated_token_account(
709702
&self.payer().pubkey(),
710703
&owner.pubkey(),
711-
&mint,
704+
mint,
712705
&spl_token::ID,
713706
),
714707
],
715708
&[],
716709
)
717710
.await?;
718-
spl_associated_token_account::get_associated_token_address(&owner.pubkey(), &mint)
711+
spl_associated_token_account::get_associated_token_address(&owner.pubkey(), mint)
719712
}
720713

721714
/// Executes a transaction creating and filling the given account with the given data.

crates/client/src/commander.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use crate::Client;
55
use crate::Config;
66
use crate::{Idl, IdlError};
77
use fehler::{throw, throws};
8-
use log;
8+
// use log;
99
use thiserror::Error;
1010
// TODO maybe unused
11-
use tokio;
11+
// use tokio;
1212

1313
// -----
1414
use crate::constants::*;
15-
use indicatif;
15+
// use indicatif;
1616
#[derive(Error, Debug)]
1717
pub enum Error {
1818
#[error("{0:?}")]

crates/client/src/config.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub struct Config {
244244
pub fuzz: Fuzz,
245245
}
246246

247-
#[derive(Default, Debug, Deserialize, Clone)]
247+
#[derive(Debug, Deserialize, Clone)]
248248
struct _Config {
249249
#[serde(default)]
250250
pub test: Option<_Test>,
@@ -261,6 +261,12 @@ impl From<_Config> for Config {
261261
}
262262
}
263263

264+
impl Default for Config {
265+
fn default() -> Self {
266+
Config::new()
267+
}
268+
}
269+
264270
impl Config {
265271
pub fn new() -> Self {
266272
let root = Config::discover_root().expect("failed to find the root folder");

crates/client/src/idl.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ impl Idl {
163163

164164
let static_program_id =
165165
static_program_id.ok_or(IdlError::MissingOrInvalidProgramItems("missing static ID"))?;
166-
let mod_private =
167-
mod_private.ok_or(IdlError::MissingOrInvalidProgramItems("missing mod private"))?;
166+
let mod_private = mod_private.ok_or(IdlError::MissingOrInvalidProgramItems(
167+
"missing mod private",
168+
))?;
168169
let mod_instruction = mod_instruction.ok_or(IdlError::MissingOrInvalidProgramItems(
169170
"missing mod instruction",
170171
))?;

crates/client/src/program_client_generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn generate_source_code(idl: &Idl, use_modules: &[syn::ItemUse]) -> String {
5555
let last_type =
5656
&tp.path.segments.last().unwrap().ident.to_string();
5757
if last_type == "Pubkey" {
58-
let reference = format!("&solana_sdk::pubkey::Pubkey");
58+
let reference = "&solana_sdk::pubkey::Pubkey".to_string();
5959
let t: syn::Type = parse_str(&reference).unwrap();
6060
t
6161
} else {

crates/client/src/workspace_builder.rs

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::commander::{Commander, Error as CommanderError};
22
use cargo_metadata::Package;
33
use fehler::{throw, throws};
4-
use pathdiff;
4+
// use pathdiff;
55
use std::{
66
env,
77
fs::OpenOptions,
@@ -12,10 +12,7 @@ use std::{fs::File, io::prelude::*};
1212
use syn::ItemUse;
1313
use thiserror::Error;
1414
use tokio::fs;
15-
use toml::{
16-
value::{Map, Table},
17-
Value,
18-
};
15+
use toml::{value::Table, Value};
1916

2017
use crate::constants::*;
2118
use crate::generate_source_code;
@@ -533,52 +530,52 @@ impl WorkspaceBuilder {
533530
};
534531
}
535532

536-
#[throws]
537-
async fn add_feature_to_dep(&self, dependency: &str, feature: &str, cargo_dir: &Path) {
538-
let cargo_toml_path = cargo_dir.join(CARGO);
539-
let rel_path = &cargo_toml_path
540-
.strip_prefix(&self.root)
541-
.unwrap()
542-
.to_str()
543-
.unwrap();
544-
let mut content: Value = fs::read_to_string(&cargo_toml_path).await?.parse()?;
545-
let deps = content
546-
.get_mut("dependencies")
547-
.and_then(Value::as_table_mut)
548-
.ok_or(Error::CannotParseCargoToml)?;
549-
550-
let values = deps
551-
.get_mut(dependency)
552-
.and_then(|f| {
553-
if f.is_table() {
554-
f.as_table_mut()
555-
} else if f.is_str() {
556-
// if the value is only a string with version such as dependency = 0.0, create a new table with that version
557-
let version = f.as_str().unwrap();
558-
let mut map = Map::new();
559-
let _ = map.insert("version".to_string(), Value::String(version.to_string()));
560-
let t = Value::Table(map);
561-
*f = t.to_owned();
562-
f.as_table_mut()
563-
} else {
564-
None
565-
}
566-
})
567-
.ok_or(Error::CannotParseCargoToml)?;
568-
569-
let fuzzing = Value::String(feature.to_string());
570-
let value = Value::Array(vec![]);
571-
let features = values.entry("features").or_insert(value);
572-
if let Some(features) = features.as_array_mut() {
573-
if !features.iter().any(|f| *f == fuzzing) {
574-
features.push(fuzzing);
575-
fs::write(&cargo_toml_path, content.to_string()).await?;
576-
println!("\x1b[92mSuccesfully\x1b[0m updated: \x1b[93m{rel_path}\x1b[0m {feature} feature added.");
577-
} else {
578-
println!("\x1b[93m--> Skipping <--\x1b[0m \x1b[93m{rel_path}\x1b[0m, already contains {feature} feature.")
579-
}
580-
}
581-
}
533+
// #[throws]
534+
// async fn add_feature_to_dep(&self, dependency: &str, feature: &str, cargo_dir: &Path) {
535+
// let cargo_toml_path = cargo_dir.join(CARGO);
536+
// let rel_path = &cargo_toml_path
537+
// .strip_prefix(&self.root)
538+
// .unwrap()
539+
// .to_str()
540+
// .unwrap();
541+
// let mut content: Value = fs::read_to_string(&cargo_toml_path).await?.parse()?;
542+
// let deps = content
543+
// .get_mut("dependencies")
544+
// .and_then(Value::as_table_mut)
545+
// .ok_or(Error::CannotParseCargoToml)?;
546+
547+
// let values = deps
548+
// .get_mut(dependency)
549+
// .and_then(|f| {
550+
// if f.is_table() {
551+
// f.as_table_mut()
552+
// } else if f.is_str() {
553+
// // if the value is only a string with version such as dependency = 0.0, create a new table with that version
554+
// let version = f.as_str().unwrap();
555+
// let mut map = Map::new();
556+
// let _ = map.insert("version".to_string(), Value::String(version.to_string()));
557+
// let t = Value::Table(map);
558+
// *f = t.to_owned();
559+
// f.as_table_mut()
560+
// } else {
561+
// None
562+
// }
563+
// })
564+
// .ok_or(Error::CannotParseCargoToml)?;
565+
566+
// let fuzzing = Value::String(feature.to_string());
567+
// let value = Value::Array(vec![]);
568+
// let features = values.entry("features").or_insert(value);
569+
// if let Some(features) = features.as_array_mut() {
570+
// if !features.iter().any(|f| *f == fuzzing) {
571+
// features.push(fuzzing);
572+
// fs::write(&cargo_toml_path, content.to_string()).await?;
573+
// println!("\x1b[92mSuccesfully\x1b[0m updated: \x1b[93m{rel_path}\x1b[0m {feature} feature added.");
574+
// } else {
575+
// println!("\x1b[93m--> Skipping <--\x1b[0m \x1b[93m{rel_path}\x1b[0m, already contains {feature} feature.")
576+
// }
577+
// }
578+
// }
582579

583580
/// - adds program dependency to specified Cargo.toml
584581
/// for example, we need to use program entry within the fuzzer

crates/explorer/src/parse/associated_token_account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ mod test {
7474
&convert_pubkey(funder),
7575
&convert_pubkey(wallet_address),
7676
&convert_pubkey(mint),
77-
&&spl_token::id(),
77+
&spl_token::id(),
7878
);
7979
let message = Message::new(&[create_ix], None);
8080
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);

0 commit comments

Comments
 (0)