feat: implement BLE swarm registry system with dual-chain support#99
Draft
feat: implement BLE swarm registry system with dual-chain support#99
Conversation
- Add FleetIdentity (ERC721) for BLE fleet ownership via Proximity UUID - Add ServiceProvider (ERC721) for service endpoint URL ownership - Add SwarmRegistryL1 with SSTORE2 for Ethereum L1 optimization - Add SwarmRegistryUniversal with native bytes storage for ZkSync Era compatibility - Implement XOR filter-based tag membership verification - Add deterministic swarm IDs derived from (fleetId, providerId, filter) - Support orphan detection and permissionless purging of burned NFT swarms - Include comprehensive test suites (157 tests total) - Add Solady dependency for SSTORE2 functionality
52bb4af to
538047d
Compare
Algorithm: Greedy All-or-Nothing with Level Priority. When bonds tie across admin/country/global levels, try each level in priority order (admin → country → global). Include the entire tier only if all members fit in the remaining room; otherwise skip that tier entirely. Cursors always advance regardless, preventing starvation of lower-priority levels when a larger tier is skipped. This guarantees every included tier is complete (no partial tiers), respects geographic priority, and avoids starving smaller levels.
Improved readability by replacing cryptic 'sc' abbreviation with descriptive 'tierCount' name across all 10 occurrences in: - highestActiveTier - discoverHighestBondedTier (3 level checks) - buildHighestBondedUUIDBundle (3 cursor inits) - _openTier - _findOpenTierView - _trimTierCount
- Move regionKey to 3rd position (indexed)
- Move bondRefund to last position
- Update FleetPromoted and FleetDemoted event declarations
to include indexed modifiers on fromTier and toTier
Event signature now:
FleetBurned(address indexed owner, uint256 indexed tokenId,
uint32 indexed regionKey, uint256 tierIndex,
uint256 bondRefund)
This groups indexed params first and places monetary values last.
…UUIDBundle\n\nReplace the greedy all-or-nothing algorithm with a shared-cursor\nfair-stop approach:\n\n- Single cursor descends from the highest active tier across all levels\n- At each cursor: try admin → country → global, include entire tier or skip\n- If ANY tier is skipped at a cursor position, STOP after finishing that cursor\n- Prevents cheaper tiers from being included when a same-priced peer was excluded\n\nTest suite rewritten: 36 tests (32 deterministic + 4 fuzz) covering\nbond priority, all-or-nothing, fair-stop, level filtering, lifecycle,\ncap enforcement, and integrity invariants."
…, globalCompetitiveHint, countryCompetitiveHint)
…oTier, DRY competitive hints, remove BOND_MULTIPLIER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add FleetIdentity (ERC721) for BLE fleet ownership via Proximity UUID
Add ServiceProvider (ERC721) for service endpoint URL ownership
Add SwarmRegistryL1 with SSTORE2 for Ethereum L1 optimization
Add SwarmRegistryUniversal with native bytes storage for ZkSync Era compatibility
Implement XOR filter-based tag membership verification
Add deterministic swarm IDs derived from (fleetId, providerId, filter)
Support orphan detection and permissionless purging of burned NFT swarms
Include comprehensive test suites (157 tests total)
Add Solady dependency for SSTORE2 functionality
Give more thought to buildHighestBondedUUIDBundle for the case we have incomplete tiers vs full tiers in all levels
Give more thought to offering low open tier as the default for registering fleets
Update docs
Review tests