diff --git a/CHANGELOG.md b/CHANGELOG.md index b8ff0ac09..06e8bcb9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ All notable changes to this project will be documented in this file. - Fix `access-pass fund` and `access-pass user-balances` slot counting to track remaining slots per `(payer, client_ip)` pair, preventing a connected user on IP_B from consuming open slots for IP_A; also fix required balance formula to always add `wallet_rent_min` on top of `needs_rent` rather than taking the max - Add `--user-payer` filter to `user list` command - Serviceability: onchain activation - atomic close for DeleteDevice ([#3188](https://github.com/malbeclabs/doublezero/pull/3188)) + - Fix `access-pass user-balances` and `access-pass fund` underestimating the required wallet balance: the wallet's own rent-exempt minimum was used as a floor rather than being added, causing `missing: 0` to be reported even when provisioning would fail with insufficient funds ([#3213](https://github.com/malbeclabs/doublezero/pull/3213)) - Onchain Programs - Serviceability: DeleteUser instruction supports atomic deallocate+closeaccount when OnchainAllocation feature is enabled - Serviceability: CreateLink instruction supports atomic create+allocate+activate when OnchainAllocation feature is enabled diff --git a/smartcontract/cli/src/accesspass/fund.rs b/smartcontract/cli/src/accesspass/fund.rs index 543db9739..970aad132 100644 --- a/smartcontract/cli/src/accesspass/fund.rs +++ b/smartcontract/cli/src/accesspass/fund.rs @@ -243,8 +243,8 @@ mod tests { #[test] fn test_fund_all_sufficiently_funded() { let payer = Pubkey::from_str_const("1111111FVAiSujNZVgYSc27t6zUTWoKfAGxbRzzPB"); - // balance > required (2_250_000) - let client = setup_client_with_balance(payer, 3_000_000); + // balance > required (wallet_rent_min + needs_rent = 1_000_000 + 1_250_000 = 2_250_000) + let client = setup_client_with_balance(payer, 2_500_000); let mut out = Vec::new(); let res = @@ -260,7 +260,7 @@ mod tests { #[test] fn test_fund_dry_run_shows_summary_without_transferring() { let payer = Pubkey::from_str_const("1111111FVAiSujNZVgYSc27t6zUTWoKfAGxbRzzPB"); - // balance = 500_000 < required (2_250_000), deficit = 1_750_000 + // balance = 500_000 < required (wallet_rent_min + needs_rent = 1_000_000 + 1_250_000 = 2_250_000), deficit = 1_750_000 let client = setup_client_with_balance(payer, 500_000); let mut out = Vec::new(); @@ -316,8 +316,8 @@ mod tests { #[test] fn test_fund_min_balance_dominates_rent() { let payer = Pubkey::from_str_const("1111111FVAiSujNZVgYSc27t6zUTWoKfAGxbRzzPB"); - // balance = 1_500_000 < required = wallet_rent_min (1_000_000) + max(needs_rent=1_250_000, min_balance=2_000_000) = 3_000_000 - // deficit = 1_500_000 + // balance = 1_500_000 > needs_rent (1_250_000) but < required + // required = wallet_rent_min + max(needs_rent, min_balance) = 1_000_000 + max(1_250_000, 2_000_000) = 3_000_000, deficit = 1_500_000 let client = setup_client_with_balance(payer, 1_500_000); let mut out = Vec::new(); @@ -338,7 +338,7 @@ mod tests { fn test_fund_rent_dominates_min_balance() { let payer = Pubkey::from_str_const("1111111FVAiSujNZVgYSc27t6zUTWoKfAGxbRzzPB"); // balance = 500_000, min_balance = ~1 lamport - // required = wallet_rent_min (1_000_000) + max(needs_rent=1_250_000, 1) = 2_250_000, deficit = 1_750_000 + // required = wallet_rent_min + max(needs_rent, min_balance) = 1_000_000 + max(1_250_000, 1) = 2_250_000, deficit = 1_750_000 let client = setup_client_with_balance(payer, 500_000); let mut out = Vec::new();