Part of #4014.
Scaffold the new doublezero_serviceability_instruction crate at crates/doublezero-serviceability-instruction/ and establish the pattern every later PR copies.
Scope
- New crate +
Cargo.toml; register it as a workspace member. Dependencies limited to doublezero-serviceability, solana-program, doublezero-program-common (no solana-client/tokio/backon).
src/common.rs: the build(program_id, instruction, accounts, payer) helper (the single place that appends the trailing [payer(signer,writable), system_program]). The read-only Permission PDA is derived from the payer inside build and appended last, but ships commented out until each instruction's authorize() migration is activated — it is never a caller-supplied parameter. Also compute_budget_prelude() -> [Instruction; 2] (CU 1_400_000, heap 256 KiB).
src/lib.rs: module wiring, re-exports, and a documented list of excluded deprecated variants.
- 4 exemplar builders, one per family, to prove the shape end to end:
create_device — variable dz_prefix blocks (builder fixes resource_count).
create_link — fixed accounts.
delete_device — variable-account builder with a legacy/atomic-close split and RPC-read resource-owner accounts (replaces the originally-planned suspend_device, which is a deprecated variant — SuspendDevice/ResumeDevice return DoubleZeroError::Deprecated; suspend/resume now go through UpdateDevice{desired_status}).
create_subscribe_user — length-detected feed (no permission parameter; never appends a Permission account).
Acceptance
- Builders return a single unsigned
Instruction with accounts in exact processor order incl. trailing accounts; no RPC.
- Unit tests assert the account list (ported from the existing
mockall command expectations) and data[0] == <tag>.
- First
ix_*.bin/.json golden fixtures emitted for the exemplars (see RF).
make rust-build, make rust-test, make rust-fmt clean.
Part of #4014.
Scaffold the new
doublezero_serviceability_instructioncrate atcrates/doublezero-serviceability-instruction/and establish the pattern every later PR copies.Scope
Cargo.toml; register it as a workspace member. Dependencies limited todoublezero-serviceability,solana-program,doublezero-program-common(nosolana-client/tokio/backon).src/common.rs: thebuild(program_id, instruction, accounts, payer)helper (the single place that appends the trailing[payer(signer,writable), system_program]). The read-only Permission PDA is derived from the payer insidebuildand appended last, but ships commented out until each instruction'sauthorize()migration is activated — it is never a caller-supplied parameter. Alsocompute_budget_prelude() -> [Instruction; 2](CU1_400_000, heap256 KiB).src/lib.rs: module wiring, re-exports, and a documented list of excluded deprecated variants.create_device— variabledz_prefixblocks (builder fixesresource_count).create_link— fixed accounts.delete_device— variable-account builder with a legacy/atomic-close split and RPC-read resource-owner accounts (replaces the originally-plannedsuspend_device, which is a deprecated variant —SuspendDevice/ResumeDevicereturnDoubleZeroError::Deprecated; suspend/resume now go throughUpdateDevice{desired_status}).create_subscribe_user— length-detected feed (nopermissionparameter; never appends a Permission account).Acceptance
Instructionwith accounts in exact processor order incl. trailing accounts; no RPC.mockallcommand expectations) anddata[0] == <tag>.ix_*.bin/.jsongolden fixtures emitted for the exemplars (see RF).make rust-build,make rust-test,make rust-fmtclean.