solana: Fix clippy warnings
This commit is contained in:
parent
e377a75e2b
commit
0f0ea48fdc
|
@ -53,7 +53,6 @@ pub type Claim<'a> = Data<'a, ClaimData, { Uninitialized }>;
|
|||
|
||||
/// Consume a claim by initializing the account. Initialized claims act as an indicator proving
|
||||
/// that a message has been consumed.
|
||||
#[must_use]
|
||||
pub fn consume<T>(
|
||||
ctx: &ExecutionContext,
|
||||
payer: &Pubkey,
|
||||
|
|
|
@ -98,7 +98,7 @@ pub fn upgrade_contract(
|
|||
_data: UpgradeContractData,
|
||||
) -> Result<()> {
|
||||
verify_governance(&accs.vaa)?;
|
||||
claim::consume(ctx, &accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
claim::consume(ctx, accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
|
||||
let upgrade_ix = solana_program::bpf_loader_upgradeable::upgrade(
|
||||
ctx.program_id,
|
||||
|
@ -147,7 +147,7 @@ pub fn upgrade_guardian_set(
|
|||
_data: UpgradeGuardianSetData,
|
||||
) -> Result<()> {
|
||||
verify_governance(&accs.vaa)?;
|
||||
claim::consume(ctx, &accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
claim::consume(ctx, accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
|
||||
// Enforce single increments when upgrading.
|
||||
if accs.guardian_set_old.index != accs.vaa.new_guardian_set_index - 1 {
|
||||
|
@ -218,7 +218,7 @@ pub struct SetFeesData {}
|
|||
|
||||
pub fn set_fees(ctx: &ExecutionContext, accs: &mut SetFees, _data: SetFeesData) -> Result<()> {
|
||||
verify_governance(&accs.vaa)?;
|
||||
claim::consume(ctx, &accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
claim::consume(ctx, accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
accs.bridge.config.fee = accs.vaa.fee.as_u64();
|
||||
Ok(())
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ pub fn transfer_fees(
|
|||
_data: TransferFeesData,
|
||||
) -> Result<()> {
|
||||
verify_governance(&accs.vaa)?;
|
||||
claim::consume(ctx, &accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
claim::consume(ctx, accs.payer.key, &mut accs.claim, &accs.vaa)?;
|
||||
|
||||
// Make sure the account loaded to receive funds is equal to the one the VAA requested.
|
||||
if accs.vaa.to != accs.recipient.key.to_bytes() {
|
||||
|
|
|
@ -174,11 +174,11 @@ pub fn post_message_unreliable(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(unused_variables)] // message_key is used in `trace!`
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn post_message_internal<'b>(
|
||||
ctx: &ExecutionContext,
|
||||
bridge: &mut Mut<Bridge<'b, { AccountState::Initialized }>>,
|
||||
message_key: &Pubkey,
|
||||
#[cfg_attr(not(feature = "trace"), allow(unused_variables))] message_key: &Pubkey,
|
||||
message: &mut MessageData,
|
||||
emitter: &mut Signer<MaybeMut<Info<'b>>>,
|
||||
sequence: &mut Mut<Sequence<'b>>,
|
||||
|
|
|
@ -222,6 +222,7 @@ mod helpers {
|
|||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn post_message(
|
||||
client: &mut BanksClient,
|
||||
program: &Pubkey,
|
||||
|
@ -258,7 +259,7 @@ mod helpers {
|
|||
execute(
|
||||
client,
|
||||
payer,
|
||||
&[payer, emitter, &message],
|
||||
&[payer, emitter, message],
|
||||
&[
|
||||
system_instruction::transfer(&payer.pubkey(), &fee_collector, fee),
|
||||
instruction,
|
||||
|
@ -270,6 +271,7 @@ mod helpers {
|
|||
Ok(message.pubkey())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn post_message_unreliable(
|
||||
client: &mut BanksClient,
|
||||
program: &Pubkey,
|
||||
|
@ -298,7 +300,7 @@ mod helpers {
|
|||
execute(
|
||||
client,
|
||||
payer,
|
||||
&[payer, emitter, &message],
|
||||
&[payer, emitter, message],
|
||||
&[
|
||||
system_instruction::transfer(&payer.pubkey(), &fee_collector, fee),
|
||||
instruction,
|
||||
|
|
|
@ -396,7 +396,7 @@ async fn test_bridge_messages_unreliable() {
|
|||
assert_eq!(signatures.guardian_set_index, 0);
|
||||
|
||||
for (signature, _secret_key) in signatures.signatures.iter().zip(context.secret.iter()) {
|
||||
assert_eq!(*signature, true);
|
||||
assert!(*signature);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ impl<'b> RedeemerAccount<'b> {
|
|||
/// The `vaa.to` account must own the token account.
|
||||
fn verify_recipient_address(&self, recipient: &Pubkey) -> Result<()> {
|
||||
if recipient == self.info().key {
|
||||
return Ok(());
|
||||
Ok(())
|
||||
} else {
|
||||
self.verify_derivation(recipient, ())
|
||||
}
|
||||
|
|
|
@ -496,6 +496,7 @@ mod helpers {
|
|||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn complete_native_with_payload(
|
||||
client: &mut BanksClient,
|
||||
program: Pubkey,
|
||||
|
|
Loading…
Reference in New Issue