Skip to content

test: airdrop reverts when recipient list exceeds 50 addresses#542

Merged
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
OpensrcLord:test/issue-537-airdrop-recipient-limit
Jul 18, 2026
Merged

test: airdrop reverts when recipient list exceeds 50 addresses#542
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
OpensrcLord:test/issue-537-airdrop-recipient-limit

Conversation

@OpensrcLord

Copy link
Copy Markdown
Contributor

Summary

Closes #537.

The airdrop entrypoint did not exist yet (tracked in #523), so this PR first adds airdrop_keys and then the boundary tests #537 asks for.

airdrop_keys (prerequisite, per #523 spec)

  • Creator-only: mints keys to a list of AirdropEntry { address, amount } recipients; non-creator callers revert with Unauthorized
  • Creator pays the bonding curve cost for every key plus the protocol fee on the total; creator fee is waived
  • Supply increases by the total airdropped amount, moving the curve exactly as individual buys would
  • Max 50 recipients per call (MAX_AIRDROP_RECIPIENTS); larger lists revert with the new AirdropRecipientLimitExceeded error (appended at the end of the enum, ABI-safe)
  • The whole airdrop is priced and validated before any storage write, so a failed call mints nothing
  • Emits KeysAirdropped { creator_id, total_keys, total_cost, recipient_count, ledger } and returns AirdropSummary { total_keys, total_cost, recipient_count }

Tests (creator-keys/tests/airdrop_recipient_limit.rs)

  • 51 recipients reverts with clear error — asserts AirdropRecipientLimitExceeded
  • 50 recipients succeeds — summary fields, supply, holder count, and every recipient balance verified
  • No state change after failed airdrop — seeds non-trivial state first, then asserts supply, holder count, protocol fee balance, and all 51 recipient balances are untouched after the revert

Build fix

ethnum 1.5.2 fails to compile on current stable rustc (1.97); bumped to 1.5.3 in Cargo.lock (no other dependency changes).

Verification

  • cargo test --workspace — all 120 test targets pass
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --check — clean

ethnum 1.5.2 fails to compile on current stable (transmute of a
zero-sized type to TryFromIntError is now a hard error). 1.5.3 builds
cleanly; no other dependencies change.
Implements airdrop_keys per issue accesslayerorg#523: the creator mints keys to a
list of recipient wallets, paying the bonding curve cost for every key
plus the protocol fee on the total (creator fee waived). Supply moves
along the curve exactly as individual buys would.

Recipient lists are capped at MAX_AIRDROP_RECIPIENTS (50); larger lists
revert with the new AirdropRecipientLimitExceeded error. The airdrop is
priced and validated in full before any storage write, so a failed call
mints nothing. Emits KeysAirdropped with a summary payload.
Closes accesslayerorg#537:
- 51 recipients reverts with AirdropRecipientLimitExceeded
- exactly 50 recipients succeeds and credits every recipient
- failed over-limit airdrop leaves supply, holder count, protocol fee
  balance, and all recipient balances unchanged
@OpensrcLord
OpensrcLord force-pushed the test/issue-537-airdrop-recipient-limit branch from 1ddd18e to e1710fb Compare July 18, 2026 10:59
@Chucks1093
Chucks1093 merged commit 2fe60eb into accesslayerorg:main Jul 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for airdrop reverting when recipient list exceeds 50 addresses

2 participants