Skip to content

serviceability: add reservation account for connection pre-reservation#3086

Merged
martinsander00 merged 1 commit intomainfrom
ms/reserve-connections
Mar 2, 2026
Merged

serviceability: add reservation account for connection pre-reservation#3086
martinsander00 merged 1 commit intomainfrom
ms/reserve-connections

Conversation

@martinsander00
Copy link
Contributor

@martinsander00 martinsander00 commented Feb 24, 2026

Summary

  • Add Reservation onchain account that allows an offchain reservation authority to pre-reserve connection seats on devices before the Activator creates User accounts
  • Introduce ReserveConnection and CloseReservation instructions — account existence represents a reserved seat, closing the account releases it
  • Add reserved_seats to Device, factored into capacity checks (users_count + reserved_seats >= max_users)
  • Add reservation_authority_pk to GlobalState for access control

Key files

  • state/reservation.rs — new Reservation account struct and serialization
  • state/device.rsreserved_seats field, capacity check update
  • processors/reservation/reserve.rs — ReserveConnection processor
  • processors/reservation/close.rs — CloseReservation processor (closes account, decrements seats)
  • processors/globalstate/setauthority.rs — support for setting reservation_authority_pk

Details

The Reservation account is a lightweight PDA ([prefix, reservation, device_pk, client_ip]) that tracks which device and client IP a seat is held for. There is no status enum — the account existing means "reserved", and closing it means "done". CloseReservation closes the account, returns rent to the payer, and decrements reserved_seats on the device.

Authority is checked against reservation_authority_pk in GlobalState, with a fallback to the foundation allowlist.

Testing Verification

  • 6 integration tests covering: happy-path reserve, close reservation, capacity limit (reserved_seats only), capacity limit (users_count + reserved_seats), unauthorized rejection with separate keypair, duplicate reservation for same (device, client_ip)
  • All 174 existing unit tests continue to pass
  • make rust-lint clean

@martinsander00 martinsander00 force-pushed the ms/reserve-connections branch 2 times, most recently from b0616e8 to 764386e Compare March 2, 2026 19:46
- Add Reservation onchain account (PDA: [prefix, reservation, device_pk,
  client_ip]) that allows a reservation authority to pre-reserve connection
  seats on devices before the Activator creates User accounts
- Introduce ReserveConnection and CloseReservation instructions — account
  existence represents a reserved seat, closing the account releases it
- Add reserved_seats to Device, factored into capacity checks on both
  reservation and user creation (users_count + reserved_seats >= max_users)
- Add reservation_authority_pk to GlobalState for access control
- Update Go, Python, and TypeScript SDKs with new fields
@martinsander00 martinsander00 force-pushed the ms/reserve-connections branch from 7969ff1 to aeb9573 Compare March 2, 2026 20:10
@martinsander00 martinsander00 merged commit bd8d8e4 into main Mar 2, 2026
30 checks passed
@martinsander00 martinsander00 deleted the ms/reserve-connections branch March 2, 2026 21:59
ben-dz added a commit that referenced this pull request Mar 2, 2026
## Summary
- PR #3086 added `reservation_authority_pk` to `GlobalState` but missed
updating the geolocation test helper introduced in PR #3120, breaking
`rust-lint` and `rust-test` on main.

## Testing Verification
- `make rust-lint` passes
- All `make rust-test` unit tests pass
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.

2 participants