Skip to main content
edited tags
Link
Source Link
ZeroNine
  • 516
  • 3
  • 13

Can flood type attacks occur if there isn't a signer for updating data on a PDA?

So this is just something I've been thinking about. Hypothetically, if I had a PDA where anybody can call similar to the basic example below..

#[program]
mod hello_anchor {
    use super::*;
    pub fn set_data(ctx: Context<SetData>, data: u64) -> Result<()> {
        ctx.accounts.my_account.data = data;
        Ok(())
    }
}

#[account]
#[derive(Default)]
pub struct MyAccount {
    data: u64
}

#[derive(Accounts)]
pub struct SetData<'info> {
    #[account(mut)]
    pub my_account: Account<'info, MyAccount>
}

and there is no signer, would the PDA be susceptible to some type of "flood attack", where any body can just trigger it over and over and cause the app to crash or slow down other legitimate updates to the PDA?

My apologies if I'm way off on my thinking here, just trying to understand a broader picture of what would happen in this case.