Accounts on Solana are considered rent-exempt if they hold at least the cost of their rent for 2 years (based on the size of the account's data).
Is it possible to create an account that's not rent-exempt?
In the program code, I'm calculating rent using the following experiment:
let lamports_required_one_year = (Rent::get()?).due_amount(account_span, 1.0);
let lamports_required_for_exemption = (Rent::get()?).minimum_balance(account_span);
Then I'm hitting the System Program with a CPI using system_instruction::create_account().
I can create an account successfully with lamports_required_for_exemption as the lamports deposited, but if I use lamports_required_one_year I get the following:
Transaction simulation failed: Transaction leaves an account with a lower balance than rent-exempt minimum
You can also throw the same error from the CLI if you try to airdrop less than the rent-exempt amount to a brand new keypair.
So I'm wondering - if this method blocks creation of an account with less than the 2-year exemption requirement, how do you create an account with less than 2 years' of rent?
I'm also curious - since the rent exemption is fairly inexpensive - what is the use case for non-rent-exempt account creation?