Skip to content

serviceability: expose public fn to calculate access pass airdrop target#3909

Merged
elitegreg merged 3 commits into
mainfrom
gm/accesspass-airdrop-target
Jun 16, 2026
Merged

serviceability: expose public fn to calculate access pass airdrop target#3909
elitegreg merged 3 commits into
mainfrom
gm/accesspass-airdrop-target

Conversation

@elitegreg

Copy link
Copy Markdown
Contributor

Summary

  • Extract a public, pure airdrop_user_target_lamports(rent, user_airdrop_lamports, multiplier) from airdrop_user_credits in the serviceability program, so the feed oracle can compute the expected access pass airdrop target without duplicating the program's math.
  • The function takes &Rent rather than calling Rent::get() internally, so it works both on-chain (caller passes Rent::get()?) and off-chain where Rent is fetched over RPC (getMinimumBalanceForRentExemption or the rent sysvar account).
  • airdrop_user_credits now delegates the target calculation to the new function, then subtracts the current balance and transfers the difference. Its signature and behavior are unchanged, so the three existing call sites are untouched.

Testing Verification

  • Added a unit test asserting the target equals minimum_balance(AIRDROP_USER_RENT_LAMPORTS_BYTES) + user_airdrop_lamports for multiplier = 1, and that result scaled by N for multiplier = N.
  • Existing accesspass and multicast allowlist tests still pass (cargo test -p doublezero-serviceability), confirming the refactor preserves the airdrop transfer behavior.

@elitegreg elitegreg marked this pull request as ready for review June 16, 2026 18:03
@elitegreg elitegreg enabled auto-merge (squash) June 16, 2026 18:03

@juan-malbeclabs juan-malbeclabs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elitegreg elitegreg merged commit 1fd36b6 into main Jun 16, 2026
37 of 38 checks passed
@elitegreg elitegreg deleted the gm/accesspass-airdrop-target branch June 16, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants