Skip to content

Enable paymaster to cover gas for whitelist admin too and update swarm specification#101

Merged
aliXsed merged 5 commits intomainfrom
aliX/device-registry
Mar 26, 2026
Merged

Enable paymaster to cover gas for whitelist admin too and update swarm specification#101
aliXsed merged 5 commits intomainfrom
aliX/device-registry

Conversation

@aliXsed
Copy link
Copy Markdown
Collaborator

@aliXsed aliXsed commented Mar 26, 2026

Summary

Updated the Swarm System technical specification to reflect the latest smart contracts, including three major feature additions:

Changes

1. New UUID_ONLY Tag Type (§3.10)

  • Fleet owners can now register fleet-wide swarms where all tags broadcasting a given UUID are automatically members
  • No XOR filter, no per-tag hashing required
  • Covers the use case: "My swarm covers all tags under this UUID"
  • Uses the sentinel filter 0xff (1 byte)
  • Mutually exclusive with tag-specific swarms: a UUID has either one fleet-wide swarm OR tag-specific swarms, never both
  • checkMembership() short-circuits to true for UUID_ONLY swarms

2. Sponsored Fleet UUID Claims (§4.4, §11)

Added comprehensive documentation for FleetTreasuryPaymaster and IBondTreasury, enabling:

  • Web2-style onboarding with Web3 ownership: New users claim UUIDs without holding any crypto
  • Sponsors (e.g., Nodle) pre-fund the treasury with ETH (gas) and NODL (bonds)
  • User creates a fresh wallet (AA or otherwise), calls claimUuidSponsored(), gets full on-chain ownership
  • Zero friction for the user, complete transparency and auditability for all stakeholders
  • Reentrancy-safe, quota-controlled, supports multiple competing treasuries with different policies

3. FingerprintSize Enum Correction (§2.4, §6.3)

  • Replaced free-form uint8 fingerprintSize (1–16) with FingerprintSize enum: BITS_8 | BITS_16
  • Updated XOR filter membership formula to use correct slot counts: m = filterLength (BITS_8) or m = filterLength / 2 (BITS_16)
  • Updated fp mask: 0xFF (8-bit) or 0xFFFF (16-bit)

Spec Updates Details

  • §2.1: Added IBondTreasury.sol interface
  • §2.2: Added claimUuidSponsored() and hasFleetWideSwarm() to class diagram
  • §2.3: Corrected Swarm struct field type
  • §2.4: New FingerprintSize enum table
  • §3.3: Added UUID_ONLY to TagType table
  • §3.9: Updated tag hash flowchart with UUID_ONLY branch
  • §3.10: New section covering UUID_ONLY specification
  • §4.4: New section covering sponsored claim flow
  • §6.1–6.3: Updated with UUID_ONLY support and correct filter logic
  • §7.2: Added claimUuidSponsored state transition
  • §10.6: Added FleetTreasuryPaymaster to deployment order
  • §11: New comprehensive FleetTreasuryPaymaster specification
  • §12 (Appendix A): Shifted from §11

References

  • Contracts: src/swarms/FleetIdentityUpgradeable.sol, src/paymasters/FleetTreasuryPaymaster.sol
  • Interfaces: src/swarms/interfaces/IBondTreasury.sol, src/swarms/interfaces/SwarmTypes.sol

Closes #[issue-number] (if applicable)

aliXsed added 3 commits March 26, 2026 11:58
…aster sponsorship, and FingerprintSize enum

- Add new UUID_ONLY TagType for fleet-wide swarms (all tags under a UUID match)
- Document sponsored UUID claims via FleetTreasuryPaymaster and IBondTreasury
- Replace uint8 fingerprintSize with FingerprintSize enum (BITS_8 | BITS_16)
- Add §3.10 UUID_ONLY specification with registration, mutual exclusivity rules, and checkMembership short-circuit
- Add §4.4 Sponsored Claim Flow documenting Web2 UX with Web3 ownership (zero friction onboarding)
- Add §11 FleetTreasuryPaymaster complete specification covering gas and bond sponsorship
- Update §6 Swarm Operations with UUID_ONLY support and correct filter logic
- Update §7.2 State Transitions with claimUuidSponsored path
- Update §10.6 Deployment Order to include FleetTreasuryPaymaster
- Renumber §4.4-4.8 → §4.5-4.9, shift Appendix A → §12
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

LCOV of commit 49f5de5 during checks #627

Summary coverage rate:
  lines......: 32.4% (769 of 2372 lines)
  functions..: 28.7% (108 of 376 functions)
  branches...: 37.4% (139 of 372 branches)

Files changed coverage rate:
                                                  |Lines       |Functions  |Branches    
  Filename                                        |Rate     Num|Rate    Num|Rate     Num
  ======================================================================================
  src/paymasters/FleetTreasuryPaymaster.sol       | 0.0%     34| 0.0%     7| 0.0%     10
  src/swarms/ServiceProviderUpgradeable.sol       |85.0%     20|80.0%     5| 100%      2
  test/paymasters/FleetTreasuryPaymaster.t.sol    | 0.0%      6| 0.0%     3|    -      0

aliXsed added 2 commits March 26, 2026 15:38
- Enable `_validateAndPayGeneralFlow` to accept calls to `address(this)` from whitelist admins
- This allows admins to have gas-sponsored transactions for operations like `addWhitelistedUsers`, `removeWhitelistedUsers`, and `withdrawTokens`
- Admins retain the option to pay gas themselves by omitting the paymaster from transaction parameters
- Added 3 new tests to validate the admin-sponsored flow:
  - test_generalFlowValidation_adminToSelf_success
  - test_RevertIf_nonAdminToSelf_destinationNotAllowed
  - test_RevertIf_adminToSelf_paymasterBalanceTooLow
- Improved coverage from 91.18% to 97.06% (lines), 89.47% to 97.37% (branches), and 60% to 100% (conditions)
@aliXsed aliXsed changed the title Update swarm specification with UUID_ONLY, sponsored claims, and FingerprintSize enum Enable paymaster to cover gas for whitelist admin too and update swarm specification Mar 26, 2026
@aliXsed aliXsed merged commit bd6ba58 into main Mar 26, 2026
3 checks passed
@aliXsed aliXsed deleted the aliX/device-registry branch March 26, 2026 02:53
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.

1 participant