Skip to content

serviceability-instruction: link domain builders (RFC-26 R2)#4051

Open
juan-malbeclabs wants to merge 3 commits into
feat/rfc26-r1-device-buildersfrom
feat/rfc26-r2-link-builders
Open

serviceability-instruction: link domain builders (RFC-26 R2)#4051
juan-malbeclabs wants to merge 3 commits into
feat/rfc26-r1-device-buildersfrom
feat/rfc26-r2-link-builders

Conversation

@juan-malbeclabs

@juan-malbeclabs juan-malbeclabs commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

RFC-26 R2 (stacked on the previous phase's branch). accept_link, update_link (LinkUpdateAuthority preamble + conditional tunnel_net / tunnel-resource / topology-union sections), delete_link (topology reference-count accounts), set_link_health.

All builders route through authorize() -> build_with_permission unless noted; each carries a verbatim account-layout doc-comment copied from its processor.

Testing Verification

  • Unit tests assert the exact AccountMeta list (incl. trailing [payer, system]) and the borsh tag byte for every builder, covering the conditional/variable-account paths.

Closes #4017. Part of RFC-26 (rfcs/rfc26-rust-instruction-builder-library.md).


PR stack (RFC-26 builder library)

Stacked PRs, merge in order (each is based on the previous one's branch):

  1. serviceability-instruction: scaffold pure instruction-builder crate (RFC-26 R0) #4049 — R0 scaffold + exemplars
  2. serviceability-instruction: device domain builders (RFC-26 R1) #4050 — R1 device
  3. serviceability-instruction: link domain builders (RFC-26 R2) #4051 — R2 link ← this PR
  4. serviceability-instruction: user domain builders (RFC-26 R3) #4052 — R3 user
  5. serviceability-instruction: location/exchange/contributor builders (RFC-26 R4) #4053 — R4 location/exchange/contributor
  6. serviceability-instruction: multicastgroup + allowlist builders (RFC-26 R5) #4054 — R5 multicastgroup + allowlists
  7. serviceability-instruction: tenant + permission builders (RFC-26 R6) #4055 — R6 tenant + permission
  8. serviceability-instruction: topology + feed builders (RFC-26 R7) #4056 — R7 topology + feed
  9. serviceability-instruction: accesspass + resource builders (RFC-26 R8) #4057 — R8 accesspass + resource
  10. serviceability-instruction: globalstate/globalconfig/allowlist/index/migrate builders (RFC-26 R9) #4058 — R9 globalstate/config/allowlist/index/migrate

R10 (commands/* migration + program-test) and RF (fixtures) follow as separate PRs.

…RFC-26 R0)

Add the `doublezero-serviceability-instruction` crate: pure, RPC-free builders
that return a single unsigned `Instruction` per serviceability instruction
(SPL-style), with the trailing-account convention centralized in `common`.

- `common::build` (no-permission path) + `common::build_with_permission`
  (deferred, activate-in-one-place Permission append) + `compute_budget_prelude`.
- Four exemplar builders: create_device, delete_device (legacy/atomic),
  create_link, create_subscribe_user. All route through build_with_permission.
- Correct the RFC's length-detected family: only CreateUser is length-detected;
  DeleteUser (state-detected) and CreateSubscribeUser (split_trailing_permission)
  both route through authorize().

Refs #4015, RFC-26.
Complete the device domain on top of the R0 exemplars (create/delete):
update_device (max(old,new) dz_prefix block), set_device_health,
create_device_interface (Vpnv4 topology PDAs), delete_device_interface,
update_device_interface (segment-routing + topology reconcile). All route
through authorize() -> build_with_permission.

Refs #4016, RFC-26.
Complete the link domain on top of the R0 create_link exemplar: accept_link,
update_link (LinkUpdateAuthority preamble + conditional tunnel_net / tunnel
resource / topology-union sections), delete_link (topology reference-count
accounts), set_link_health. All route through authorize() -> build_with_permission.

Refs #4017, RFC-26.
juan-malbeclabs added a commit that referenced this pull request Jul 14, 2026
…RFC-26 R0) (#4049)

## Summary

RFC-26 **R0**: scaffold the pure, RPC-free instruction-builder crate
`doublezero-serviceability-instruction` — SPL-style builders that return
a single unsigned `Instruction` per serviceability instruction, no
signing/sending.

- `common::build` (no-permission trailing `[payer, system]`) +
`common::build_with_permission` (the deferred, activate-in-one-place
Permission append) + `compute_budget_prelude` (1.4M CU / 256 KiB).
- Four exemplar builders establishing the pattern every later PR copies:
`create_device`, `delete_device` (legacy/atomic), `create_link`,
`create_subscribe_user`.
- Deps limited to `doublezero-serviceability` + `solana-program` +
`solana-system-interface` + `solana-compute-budget-interface` — no RPC
tree.

The `suspend_device` exemplar from the RFC was replaced with
`delete_device` (`SuspendDevice` is a deprecated variant); the RFC and
#4015 were updated, and the "length-detected family" classification was
corrected (only `CreateUser` is length-detected).

## Why

Instruction assembly is currently coupled to signing+sending inside
`commands/*::execute()`; there is no reusable `build_xxx(args) ->
Instruction`. See
[rfcs/rfc26-rust-instruction-builder-library.md](rfcs/rfc26-rust-instruction-builder-library.md).

## Testing Verification

- Unit tests assert the exact `AccountMeta` list (incl. trailing
`[payer, system]`) and the borsh tag byte for each exemplar, including
the `delete_device` legacy vs atomic layouts and the
`create_subscribe_user` optional-feed placement.

Closes #4015. Part of RFC-26.

---

### PR stack (RFC-26 builder library)

Stacked PRs, merge in order (each is based on the previous one's
branch):

1. #4049 — R0 scaffold + exemplars  ← **this PR**
2. #4050 — R1 device
3. #4051 — R2 link
4. #4052 — R3 user
5. #4053 — R4 location/exchange/contributor
6. #4054 — R5 multicastgroup + allowlists
7. #4055 — R6 tenant + permission
8. #4056 — R7 topology + feed
9. #4057 — R8 accesspass + resource
10. #4058 — R9 globalstate/config/allowlist/index/migrate

R10 (commands/* migration + program-test) and RF (fixtures) follow as
separate PRs.
@juan-malbeclabs juan-malbeclabs force-pushed the feat/rfc26-r1-device-builders branch from 5f2d846 to 1ee524d Compare July 14, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant