Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Rust version to 1.57.0 #2628

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/rust-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
if [[ -n $RUST_STABLE_VERSION ]]; then
stable_version="$RUST_STABLE_VERSION"
else
stable_version=1.54.0
stable_version=1.57.0
fi

if [[ -n $RUST_NIGHTLY_VERSION ]]; then
nightly_version="$RUST_NIGHTLY_VERSION"
else
nightly_version=2021-08-02
nightly_version=2021-11-30
fi


Expand Down
1 change: 1 addition & 0 deletions governance/program/src/state/proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ mod test {

#[derive(Clone, Debug)]
pub struct VoteCastTestCase {
#[allow(dead_code)]
name: &'static str,
governing_token_supply: u64,
vote_threshold_percentage: u8,
Expand Down
4 changes: 2 additions & 2 deletions stake-pool/program/src/big_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ impl<'data> BigVec<'data> {
if self.data.len() < end_index {
return Err(ProgramError::AccountDataTooSmall);
}
let mut element_ref = &mut self.data[start_index..start_index + T::LEN];
element.pack_into_slice(&mut element_ref);
let element_ref = &mut self.data[start_index..start_index + T::LEN];
element.pack_into_slice(element_ref);
Ok(())
}

Expand Down
52 changes: 26 additions & 26 deletions token-swap/program/fuzz/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ fn run_fuzz(fuzz_data: FuzzData) {
// First, transfer all pool tokens to the fee account to avoid withdrawal
// fees and a potential crash when withdrawing just 1 pool token.
let mut fee_account = token_swap.pool_fee_account.clone();
for mut pool_account in pool_accounts.values_mut() {
for pool_account in pool_accounts.values_mut() {
let pool_token_amount = get_token_balance(pool_account);
if pool_token_amount > 0 {
transfer(&mut pool_account, &mut fee_account, pool_token_amount);
transfer(pool_account, &mut fee_account, pool_token_amount);
}
}
let mut pool_account = token_swap.pool_token_account.clone();
Expand Down Expand Up @@ -296,14 +296,14 @@ fn run_fuzz_instruction(
trade_direction,
instruction,
} => {
let mut token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
let mut token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
let token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
let token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
match trade_direction {
TradeDirection::AtoB => {
token_swap.swap_a_to_b(&mut token_a_account, &mut token_b_account, instruction)
token_swap.swap_a_to_b(token_a_account, token_b_account, instruction)
}
TradeDirection::BtoA => {
token_swap.swap_b_to_a(&mut token_b_account, &mut token_a_account, instruction)
token_swap.swap_b_to_a(token_b_account, token_a_account, instruction)
}
}
}
Expand All @@ -313,13 +313,13 @@ fn run_fuzz_instruction(
pool_token_id,
instruction,
} => {
let mut token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
let mut token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
let token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
let token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
token_swap.deposit_all_token_types(
&mut token_a_account,
&mut token_b_account,
&mut pool_account,
token_a_account,
token_b_account,
pool_account,
instruction,
)
}
Expand All @@ -329,13 +329,13 @@ fn run_fuzz_instruction(
pool_token_id,
instruction,
} => {
let mut token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
let mut token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
let token_a_account = token_a_accounts.get_mut(&token_a_id).unwrap();
let token_b_account = token_b_accounts.get_mut(&token_b_id).unwrap();
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
token_swap.withdraw_all_token_types(
&mut pool_account,
&mut token_a_account,
&mut token_b_account,
pool_account,
token_a_account,
token_b_account,
instruction,
)
}
Expand All @@ -345,14 +345,14 @@ fn run_fuzz_instruction(
pool_token_id,
instruction,
} => {
let mut source_token_account = match trade_direction {
let source_token_account = match trade_direction {
TradeDirection::AtoB => token_a_accounts.get_mut(&token_account_id).unwrap(),
TradeDirection::BtoA => token_b_accounts.get_mut(&token_account_id).unwrap(),
};
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
token_swap.deposit_single_token_type_exact_amount_in(
&mut source_token_account,
&mut pool_account,
source_token_account,
pool_account,
instruction,
)
}
Expand All @@ -362,14 +362,14 @@ fn run_fuzz_instruction(
pool_token_id,
instruction,
} => {
let mut destination_token_account = match trade_direction {
let destination_token_account = match trade_direction {
TradeDirection::AtoB => token_a_accounts.get_mut(&token_account_id).unwrap(),
TradeDirection::BtoA => token_b_accounts.get_mut(&token_account_id).unwrap(),
};
let mut pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
let pool_account = pool_accounts.get_mut(&pool_token_id).unwrap();
token_swap.withdraw_single_token_type_exact_amount_out(
&mut pool_account,
&mut destination_token_account,
pool_account,
destination_token_account,
instruction,
)
}
Expand Down
12 changes: 6 additions & 6 deletions token-swap/program/fuzz/src/native_token_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,9 @@ impl NativeTokenSwap {

pub fn withdraw_all(
&mut self,
mut pool_account: &mut NativeAccountData,
mut token_a_account: &mut NativeAccountData,
mut token_b_account: &mut NativeAccountData,
pool_account: &mut NativeAccountData,
token_a_account: &mut NativeAccountData,
token_b_account: &mut NativeAccountData,
) -> ProgramResult {
let pool_token_amount = native_token::get_token_balance(pool_account);
if pool_token_amount > 0 {
Expand All @@ -559,9 +559,9 @@ impl NativeTokenSwap {
minimum_token_b_amount: 0,
};
self.withdraw_all_token_types(
&mut pool_account,
&mut token_a_account,
&mut token_b_account,
pool_account,
token_a_account,
token_b_account,
instruction,
)
} else {
Expand Down
66 changes: 33 additions & 33 deletions token-swap/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1417,11 +1417,11 @@ mod tests {
&mut self,
user_key: &Pubkey,
user_source_key: &Pubkey,
mut user_source_account: &mut Account,
user_source_account: &mut Account,
swap_source_key: &Pubkey,
swap_destination_key: &Pubkey,
user_destination_key: &Pubkey,
mut user_destination_account: &mut Account,
user_destination_account: &mut Account,
amount_in: u64,
minimum_amount_out: u64,
) -> ProgramResult {
Expand All @@ -1438,7 +1438,7 @@ mod tests {
)
.unwrap(),
vec![
&mut user_source_account,
user_source_account,
&mut Account::default(),
&mut Account::default(),
],
Expand Down Expand Up @@ -1473,10 +1473,10 @@ mod tests {
&mut self.swap_account,
&mut Account::default(),
&mut Account::default(),
&mut user_source_account,
user_source_account,
&mut swap_source_account,
&mut swap_destination_account,
&mut user_destination_account,
user_destination_account,
&mut self.pool_mint_account,
&mut self.pool_fee_account,
&mut Account::default(),
Expand All @@ -1494,11 +1494,11 @@ mod tests {
&mut self,
depositor_key: &Pubkey,
depositor_token_a_key: &Pubkey,
mut depositor_token_a_account: &mut Account,
depositor_token_a_account: &mut Account,
depositor_token_b_key: &Pubkey,
mut depositor_token_b_account: &mut Account,
depositor_token_b_account: &mut Account,
depositor_pool_key: &Pubkey,
mut depositor_pool_account: &mut Account,
depositor_pool_account: &mut Account,
pool_token_amount: u64,
maximum_token_a_amount: u64,
maximum_token_b_amount: u64,
Expand All @@ -1515,7 +1515,7 @@ mod tests {
)
.unwrap(),
vec![
&mut depositor_token_a_account,
depositor_token_a_account,
&mut Account::default(),
&mut Account::default(),
],
Expand All @@ -1533,7 +1533,7 @@ mod tests {
)
.unwrap(),
vec![
&mut depositor_token_b_account,
depositor_token_b_account,
&mut Account::default(),
&mut Account::default(),
],
Expand Down Expand Up @@ -1564,12 +1564,12 @@ mod tests {
&mut self.swap_account,
&mut Account::default(),
&mut Account::default(),
&mut depositor_token_a_account,
&mut depositor_token_b_account,
depositor_token_a_account,
depositor_token_b_account,
&mut self.token_a_account,
&mut self.token_b_account,
&mut self.pool_mint_account,
&mut depositor_pool_account,
depositor_pool_account,
&mut Account::default(),
],
)
Expand All @@ -1580,11 +1580,11 @@ mod tests {
&mut self,
user_key: &Pubkey,
pool_key: &Pubkey,
mut pool_account: &mut Account,
pool_account: &mut Account,
token_a_key: &Pubkey,
mut token_a_account: &mut Account,
token_a_account: &mut Account,
token_b_key: &Pubkey,
mut token_b_account: &mut Account,
token_b_account: &mut Account,
pool_token_amount: u64,
minimum_token_a_amount: u64,
minimum_token_b_amount: u64,
Expand All @@ -1602,7 +1602,7 @@ mod tests {
)
.unwrap(),
vec![
&mut pool_account,
pool_account,
&mut Account::default(),
&mut Account::default(),
],
Expand Down Expand Up @@ -1636,11 +1636,11 @@ mod tests {
&mut Account::default(),
&mut Account::default(),
&mut self.pool_mint_account,
&mut pool_account,
pool_account,
&mut self.token_a_account,
&mut self.token_b_account,
&mut token_a_account,
&mut token_b_account,
token_a_account,
token_b_account,
&mut self.pool_fee_account,
&mut Account::default(),
],
Expand All @@ -1652,9 +1652,9 @@ mod tests {
&mut self,
depositor_key: &Pubkey,
deposit_account_key: &Pubkey,
mut deposit_token_account: &mut Account,
deposit_token_account: &mut Account,
deposit_pool_key: &Pubkey,
mut deposit_pool_account: &mut Account,
deposit_pool_account: &mut Account,
source_token_amount: u64,
minimum_pool_token_amount: u64,
) -> ProgramResult {
Expand All @@ -1670,7 +1670,7 @@ mod tests {
)
.unwrap(),
vec![
&mut deposit_token_account,
deposit_token_account,
&mut Account::default(),
&mut Account::default(),
],
Expand Down Expand Up @@ -1699,11 +1699,11 @@ mod tests {
&mut self.swap_account,
&mut Account::default(),
&mut Account::default(),
&mut deposit_token_account,
deposit_token_account,
&mut self.token_a_account,
&mut self.token_b_account,
&mut self.pool_mint_account,
&mut deposit_pool_account,
deposit_pool_account,
&mut Account::default(),
],
)
Expand All @@ -1714,9 +1714,9 @@ mod tests {
&mut self,
user_key: &Pubkey,
pool_key: &Pubkey,
mut pool_account: &mut Account,
pool_account: &mut Account,
destination_key: &Pubkey,
mut destination_account: &mut Account,
destination_account: &mut Account,
destination_token_amount: u64,
maximum_pool_token_amount: u64,
) -> ProgramResult {
Expand All @@ -1733,7 +1733,7 @@ mod tests {
)
.unwrap(),
vec![
&mut pool_account,
pool_account,
&mut Account::default(),
&mut Account::default(),
],
Expand Down Expand Up @@ -1764,10 +1764,10 @@ mod tests {
&mut Account::default(),
&mut Account::default(),
&mut self.pool_mint_account,
&mut pool_account,
pool_account,
&mut self.token_a_account,
&mut self.token_b_account,
&mut destination_account,
destination_account,
&mut self.pool_fee_account,
&mut Account::default(),
],
Expand Down Expand Up @@ -1846,7 +1846,7 @@ mod tests {
fn mint_token(
program_id: &Pubkey,
mint_key: &Pubkey,
mut mint_account: &mut Account,
mint_account: &mut Account,
mint_authority_key: &Pubkey,
account_owner_key: &Pubkey,
amount: u64,
Expand All @@ -1864,7 +1864,7 @@ mod tests {
initialize_account(program_id, &account_key, mint_key, account_owner_key).unwrap(),
vec![
&mut account_account,
&mut mint_account,
mint_account,
&mut mint_authority_account,
&mut rent_sysvar_account,
],
Expand All @@ -1883,7 +1883,7 @@ mod tests {
)
.unwrap(),
vec![
&mut mint_account,
mint_account,
&mut account_account,
&mut mint_authority_account,
],
Expand Down
Loading