|
@@ -16,15 +16,17 @@ pub struct TestTokenSeedsInit<'info> {
|
|
|
payer = authority,
|
|
|
mint::decimals = 6,
|
|
|
mint::authority = authority,
|
|
|
+
|
|
|
)]
|
|
|
pub mint: Account<'info, Mint>,
|
|
|
#[account(
|
|
|
init,
|
|
|
- seeds = [b"my-token-seed".as_ref(),],
|
|
|
+ seeds = [b"my-token-seed".as_ref()],
|
|
|
bump,
|
|
|
payer = authority,
|
|
|
token::mint = mint,
|
|
|
token::authority = authority,
|
|
|
+
|
|
|
)]
|
|
|
pub my_pda: Account<'info, TokenAccount>,
|
|
|
#[account(mut)]
|
|
@@ -42,6 +44,7 @@ pub struct TestInitAssociatedToken<'info> {
|
|
|
payer = payer,
|
|
|
associated_token::mint = mint,
|
|
|
associated_token::authority = payer,
|
|
|
+
|
|
|
)]
|
|
|
pub token: Account<'info, TokenAccount>,
|
|
|
pub mint: Account<'info, Mint>,
|
|
@@ -86,6 +89,7 @@ pub struct TestPdaInit<'info> {
|
|
|
seeds = [b"my-seed", domain.as_bytes(), foo.key.as_ref(), &seed],
|
|
|
bump,
|
|
|
payer = my_payer,
|
|
|
+ space = DataU16::LEN + 8
|
|
|
)]
|
|
|
pub my_pda: Account<'info, DataU16>,
|
|
|
#[account(mut)]
|
|
@@ -102,8 +106,9 @@ pub struct TestPdaInitZeroCopy<'info> {
|
|
|
seeds = [b"my-seed".as_ref()],
|
|
|
bump,
|
|
|
payer = my_payer,
|
|
|
+ space = DataZeroCopy::LEN + 8
|
|
|
)]
|
|
|
- pub my_pda: Loader<'info, DataZeroCopy>,
|
|
|
+ pub my_pda: AccountLoader<'info, DataZeroCopy>,
|
|
|
#[account(mut)]
|
|
|
pub my_payer: Signer<'info>,
|
|
|
pub system_program: Program<'info, System>,
|
|
@@ -116,7 +121,7 @@ pub struct TestPdaMutZeroCopy<'info> {
|
|
|
seeds = [b"my-seed".as_ref()],
|
|
|
bump = my_pda.load()?.bump,
|
|
|
)]
|
|
|
- pub my_pda: Loader<'info, DataZeroCopy>,
|
|
|
+ pub my_pda: AccountLoader<'info, DataZeroCopy>,
|
|
|
/// CHECK:
|
|
|
pub my_payer: AccountInfo<'info>,
|
|
|
}
|
|
@@ -204,7 +209,7 @@ pub struct TestI8<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestInit<'info> {
|
|
|
- #[account(init, payer = payer)]
|
|
|
+ #[account(init, payer = payer, space = DataI8::LEN + 8)]
|
|
|
pub data: Account<'info, DataI8>,
|
|
|
#[account(mut)]
|
|
|
pub payer: Signer<'info>,
|
|
@@ -213,7 +218,7 @@ pub struct TestInit<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestInitZeroCopy<'info> {
|
|
|
- #[account(init, payer = payer, space = 8 + size_of::<DataZeroCopy>())]
|
|
|
+ #[account(init, payer = payer, space = DataZeroCopy::LEN + 8)]
|
|
|
pub data: Loader<'info, DataZeroCopy>,
|
|
|
#[account(mut)]
|
|
|
pub payer: Signer<'info>,
|
|
@@ -222,7 +227,7 @@ pub struct TestInitZeroCopy<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestInitMint<'info> {
|
|
|
- #[account(init, mint::decimals = 6, mint::authority = payer, mint::freeze_authority = payer, payer = payer)]
|
|
|
+ #[account(init, mint::decimals = 6, mint::authority = payer, mint::freeze_authority = payer, payer = payer, )]
|
|
|
pub mint: Account<'info, Mint>,
|
|
|
#[account(mut)]
|
|
|
pub payer: Signer<'info>,
|
|
@@ -233,7 +238,7 @@ pub struct TestInitMint<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestInitToken<'info> {
|
|
|
- #[account(init, token::mint = mint, token::authority = payer, payer = payer)]
|
|
|
+ #[account(init, token::mint = mint, token::authority = payer, payer = payer, )]
|
|
|
pub token: Account<'info, TokenAccount>,
|
|
|
pub mint: Account<'info, Mint>,
|
|
|
#[account(mut)]
|
|
@@ -246,14 +251,14 @@ pub struct TestInitToken<'info> {
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestCompositePayer<'info> {
|
|
|
pub composite: TestInit<'info>,
|
|
|
- #[account(init, payer = composite.payer, space = 8 + size_of::<Data>())]
|
|
|
+ #[account(init, payer = composite.payer, space = Data::LEN + 8)]
|
|
|
pub data: Account<'info, Data>,
|
|
|
pub system_program: Program<'info, System>,
|
|
|
}
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestFetchAll<'info> {
|
|
|
- #[account(init, payer = authority)]
|
|
|
+ #[account(init, payer = authority, space = DataWithFilter::LEN + 8)]
|
|
|
pub data: Account<'info, DataWithFilter>,
|
|
|
#[account(mut)]
|
|
|
pub authority: Signer<'info>,
|
|
@@ -262,7 +267,7 @@ pub struct TestFetchAll<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestInitWithEmptySeeds<'info> {
|
|
|
- #[account(init, seeds = [], bump, payer = authority, space = 8 + size_of::<Data>())]
|
|
|
+ #[account(init, seeds = [], bump, payer = authority, space = Data::LEN + 8)]
|
|
|
pub pda: Account<'info, Data>,
|
|
|
#[account(mut)]
|
|
|
pub authority: Signer<'info>,
|
|
@@ -278,7 +283,7 @@ pub struct TestEmptySeedsConstraint<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct InitWithSpace<'info> {
|
|
|
- #[account(init, payer = payer)]
|
|
|
+ #[account(init, payer = payer, space = DataU16::LEN + 8)]
|
|
|
pub data: Account<'info, DataU16>,
|
|
|
#[account(mut)]
|
|
|
pub payer: Signer<'info>,
|
|
@@ -287,7 +292,8 @@ pub struct InitWithSpace<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestInitIfNeeded<'info> {
|
|
|
- #[account(init_if_needed, payer = payer, space = 500)]
|
|
|
+ // intentionally using more space (+500) to check whether space is checked when using init_if_needed
|
|
|
+ #[account(init_if_needed, payer = payer, space = DataU16::LEN + 8 + 500)]
|
|
|
pub data: Account<'info, DataU16>,
|
|
|
#[account(mut)]
|
|
|
pub payer: Signer<'info>,
|
|
@@ -335,7 +341,7 @@ pub struct TestInitMintIfNeeded<'info> {
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
pub struct TestInitTokenIfNeeded<'info> {
|
|
|
- #[account(init_if_needed, token::mint = mint, token::authority = authority, payer = payer)]
|
|
|
+ #[account(init_if_needed, token::mint = mint, token::authority = authority, payer = payer, )]
|
|
|
pub token: Account<'info, TokenAccount>,
|
|
|
pub mint: Account<'info, Mint>,
|
|
|
#[account(mut)]
|
|
@@ -353,7 +359,7 @@ pub struct TestInitAssociatedTokenIfNeeded<'info> {
|
|
|
init_if_needed,
|
|
|
payer = payer,
|
|
|
associated_token::mint = mint,
|
|
|
- associated_token::authority = authority,
|
|
|
+ associated_token::authority = authority
|
|
|
)]
|
|
|
pub token: Account<'info, TokenAccount>,
|
|
|
pub mint: Account<'info, Mint>,
|