Skip to content

Commit

Permalink
revert bump changes
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Dec 2, 2024
1 parent f26a669 commit 5cf02db
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions programs/protocol-contracts-solana/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pub mod gateway {
initialized_pda.authority = ctx.accounts.signer.key();
initialized_pda.chain_id = chain_id;
initialized_pda.deposit_paused = false;
initialized_pda.bump = ctx.bumps.pda;

Ok(())
}
Expand Down Expand Up @@ -108,8 +107,6 @@ pub mod gateway {
let whitelist_candidate = &mut ctx.accounts.whitelist_candidate;
let authority = &ctx.accounts.authority;

ctx.accounts.whitelist_entry.bump = ctx.bumps.whitelist_entry;

// signature provided, recover and verify that tss is the signer
if signature != [0u8; 64] {
validate_whitelist_tss_signature(
Expand Down Expand Up @@ -168,8 +165,7 @@ pub mod gateway {
Ok(())
}

pub fn initialize_rent_payer(ctx: Context<InitializeRentPayer>) -> Result<()> {
ctx.accounts.rent_payer_pda.bump = ctx.bumps.rent_payer_pda;
pub fn initialize_rent_payer(_ctx: Context<InitializeRentPayer>) -> Result<()> {
Ok(())
}

Expand Down Expand Up @@ -378,7 +374,7 @@ pub mod gateway {
);

let token = &ctx.accounts.token_program;
let signer_seeds: &[&[&[u8]]] = &[&[b"meta", &[pda.bump]]];
let signer_seeds: &[&[&[u8]]] = &[&[b"meta", &[ctx.bumps.pda]]];

// make sure that ctx.accounts.recipient_ata is ATA (PDA account of token program)
let recipient_ata = get_associated_token_address(
Expand Down Expand Up @@ -528,7 +524,7 @@ pub struct Initialize<'info> {

#[derive(Accounts)]

Check warning on line 525 in programs/protocol-contracts-solana/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

[clippy] programs/protocol-contracts-solana/src/lib.rs#L525

warning: unexpected `cfg` condition value: `anchor-debug` --> programs/protocol-contracts-solana/src/lib.rs:525:10 | 525 | #[derive(Accounts)] | ^^^^^^^^ | = note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name` = help: consider adding `anchor-debug` as a feature in `Cargo.toml` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration = note: this warning originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)
Raw output
programs/protocol-contracts-solana/src/lib.rs:525:10:w:warning: unexpected `cfg` condition value: `anchor-debug`
   --> programs/protocol-contracts-solana/src/lib.rs:525:10
    |
525 | #[derive(Accounts)]
    |          ^^^^^^^^
    |
    = note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
    = help: consider adding `anchor-debug` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: this warning originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)


__END__
pub struct SetDepositFee<'info> {
#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(mut)]
Expand All @@ -540,7 +536,7 @@ pub struct Deposit<'info> {
#[account(mut)]
pub signer: Signer<'info>,

#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

pub system_program: Program<'info, System>,
Expand All @@ -551,10 +547,10 @@ pub struct DepositSplToken<'info> {
#[account(mut)]
pub signer: Signer<'info>,

#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(seeds = [b"whitelist", mint_account.key().as_ref()], bump = whitelist_entry.bump)]
#[account(seeds = [b"whitelist", mint_account.key().as_ref()], bump)]
pub whitelist_entry: Account<'info, WhitelistEntry>, // attach whitelist entry to show the mint_account is whitelisted

pub mint_account: Account<'info, Mint>,
Expand All @@ -575,7 +571,7 @@ pub struct Withdraw<'info> {
#[account(mut)]
pub signer: Signer<'info>,

#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

/// CHECK: to account is not read so no need to check its owners; the program neither knows nor cares who the owner is.
Expand All @@ -588,7 +584,7 @@ pub struct WithdrawSPLToken<'info> {
#[account(mut)]
pub signer: Signer<'info>,

#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(mut, associated_token::mint = mint_account, associated_token::authority = pda)]
Expand All @@ -602,7 +598,7 @@ pub struct WithdrawSPLToken<'info> {
#[account(mut)]
pub recipient_ata: AccountInfo<'info>,

#[account(mut, seeds = [b"rent-payer"], bump = rent_payer_pda.bump)]
#[account(mut, seeds = [b"rent-payer"], bump)]
pub rent_payer_pda: Account<'info, RentPayerPda>,

pub token_program: Program<'info, Token>,
Expand All @@ -614,7 +610,7 @@ pub struct WithdrawSPLToken<'info> {

#[derive(Accounts)]
pub struct UpdateTss<'info> {
#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(mut)]
Expand All @@ -623,7 +619,7 @@ pub struct UpdateTss<'info> {

#[derive(Accounts)]
pub struct UpdateAuthority<'info> {
#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(mut)]
Expand All @@ -632,7 +628,7 @@ pub struct UpdateAuthority<'info> {

#[derive(Accounts)]
pub struct UpdatePaused<'info> {
#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(mut)]
Expand All @@ -655,7 +651,7 @@ pub struct Whitelist<'info> {

pub whitelist_candidate: Account<'info, Mint>,

#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(mut)]
Expand All @@ -679,7 +675,7 @@ pub struct Unwhitelist<'info> {

pub whitelist_candidate: Account<'info, Mint>,

#[account(mut, seeds = [b"meta"], bump = pda.bump)]
#[account(mut, seeds = [b"meta"], bump)]
pub pda: Account<'info, Pda>,

#[account(mut)]
Expand All @@ -706,18 +702,13 @@ pub struct Pda {
authority: Pubkey,
chain_id: u64,
deposit_paused: bool,
bump: u8,
}

#[account]
pub struct WhitelistEntry {
bump: u8,
}
pub struct WhitelistEntry {}

#[account]
pub struct RentPayerPda {
bump: u8,
}
pub struct RentPayerPda {}

#[cfg(test)]
mod tests {
Expand Down

0 comments on commit 5cf02db

Please sign in to comment.