Weight lottery by actual sats donated (devfund% × fee rate) - #2561
Open
TempleOfSats wants to merge 6 commits into
Open
Weight lottery by actual sats donated (devfund% × fee rate)#2561TempleOfSats wants to merge 6 commits into
TempleOfSats wants to merge 6 commits into
Conversation
Adds devfund (percentage = DEVFUND × 100) to the public GET /api/info/ response, documents it in the serializer/OAS schema, adds value tests (0/5/20/100%), and updates env/docs. Additive and backward-compatible: old clients ignore the new field.
Dormant frontend plumbing. Info.devfund? type; federationLottery(federation, devfundOverrides) with a backward-compatible signature (clamp [0, 50]); a new service that probes each coordinator's /api/info/ (silent requests, 15 s timeout, 30 min module cache) returning alias → %. Nothing consumes it yet — behavior unchanged, project compiles.
Federation gains loadDevFund() + devFundLoaded flag: probes coordinators, overwrites badges.donatesToDevFund for reachable ones, re-runs the weighted lottery and reorders coordinators, then notifies the UI. Not called yet — dormant, no side effects.
Activates the feature. FederationContext calls loadDevFund() on mount; GarageContext re-derives the default MakerForm host to the new [0] once devFundLoaded, guarded by coordinatorPickedRef (markCoordinatorPicked/resetCoordinatorPicked wired in MakerForm) so a late lottery shuffle never overwrites an explicit user choice. Only user-visible behavior change.
Consolidate the live DevFund lookup into the canonical Coordinator.loadInfo(). DevFundProfile no longer issues its own GET /api/info/ request — it reuses the coordinator's fetch (now a shared in-flight Promise, guarded by a private _infoPromise) and reads devfund from coordinator.info. Coordinators with valid info are not re-fetched. Timeout (15s), silent requests, 30-min cache and the static-fallback behavior are preserved; concurrent callers (startup probe + dialogs) collapse into one request per coordinator.
The lottery weight is now devfund% × (maker_fee + taker_fee) instead of devfund% alone. A coordinator with high devfund% but low fees no longer outranks one that donates more actual sats. Fee data is read from the existing /api/info/ probe (no new request, no backend change). Static fallback uses a 0.2% default total fee.
Contributor
|
Good idea to fetch the updated devfund live. I wish we would also move more stuff from the federation.json to endpoints. |
alicecoordinator
approved these changes
Aug 16, 2026
Contributor
|
Only now I read that this is a follow up to #2560. I think both changes are reasonable, so I think we can merge this PR (I guess the other one will be automatically closed). |
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.
Follow-up to #2560
The lottery weight is now devfund% × (maker_fee + taker_fee) instead of devfund% alone. A coordinator with high devfund% but low fees no longer outranks one that donates more actual sats.
Changes:
Static fallback uses 0.2% default total fee. No backend changes needed.