Skip to content

smartcontract/serviceability,sdk: deprecate user activate/reject/closeaccount/ban instructions#3735

Merged
elitegreg merged 1 commit into
mainfrom
gm/issue3622
May 20, 2026
Merged

smartcontract/serviceability,sdk: deprecate user activate/reject/closeaccount/ban instructions#3735
elitegreg merged 1 commit into
mainfrom
gm/issue3622

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

⚠️ DO NOT MERGE until onchain ProgramConfig.min_compatible_version has been bumped to ≥ 0.12.0. ⚠️

Phase 7.1 of the activator-removal effort (tracker #3607).

Summary

  • Deprecate the four user-lifecycle program instructions whose only client was the now-deleted activator: ActivateUser (variant 37), RejectUser (38), CloseAccountUser (43), and BanUser (45). Their dispatch handlers now short-circuit to DoubleZeroError::Deprecated (custom code 67). The enum cases are kept (as unit variants) so borsh discriminator positions don't shift — old clients still get a deterministic deprecation error rather than an unknown-instruction decode failure.
  • Delete the corresponding program processor files (processors/user/{activate,reject,closeaccount,ban}.rs) and their argument structs.
  • Delete the corresponding Rust SDK command wrappers (sdk/rs/src/commands/user/{activate,reject,closeaccount,ban}.rs); they had no remaining live callers. RequestBanUserCommand (operator-driven, atomic post-RFC-11) is unaffected.
  • Prune legacy test_activate_user_* integration tests that exercised the activator-driven flow; the atomic-create-and-activate path is already covered by test_create_user_atomic_*. Drop the obsolete test_user_ban_requires_pendingban test.
  • Add tests/deprecated_user_instructions_test.rs asserting all four discriminators now return ProgramError::Custom(67).

Risk

Hard removal. Any client running CLI < 0.12.0 against an upgraded program will no longer be able to send these four instructions. The min_compatible_version bump must happen first — this PR is the merge-after-gate-met half.

Testing Verification

  • cargo test -p doublezero-serviceability --tests — 33 integration tests pass, including the 4 new deprecation assertions and the unchanged test_user_delete_from_banned.
  • cargo test -p doublezero-serviceability --lib and cargo test -p doublezero_sdk --lib pass (256 + 165 unit tests).
  • make rust-lint clean.
  • Sending instruction byte 37/38/43/45 with arbitrary payload returns Custom(0x43) = Deprecated, verified end-to-end by the new test.

Closes #3622. Tracker: #3607.

…eaccount/ban instructions

Phase 7.1 of the activator-removal effort (tracker #3607). With the
offchain activator gone and onchain allocation always-on, the four
user-lifecycle instructions ActivateUser / RejectUser / CloseAccountUser
/ BanUser are unreachable from any live caller. Their dispatch handlers
now return DoubleZeroError::Deprecated (custom code 67); the enum
variants stay at borsh tag positions 37/38/43/45 so the wire format is
unchanged. Processor files and SDK command wrappers are deleted.

Gated on onchain min_compatible_version >= 0.12.0.

Closes #3622
@elitegreg elitegreg marked this pull request as ready for review May 20, 2026 16:28
@elitegreg elitegreg enabled auto-merge (squash) May 20, 2026 16:43
Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elitegreg elitegreg merged commit 392eb00 into main May 20, 2026
33 checks passed
@elitegreg elitegreg deleted the gm/issue3622 branch May 20, 2026 16:51
elitegreg added a commit that referenced this pull request May 21, 2026
…group/interface activator-only instructions (#3736)

> ⚠️ **DO NOT MERGE** until onchain
`ProgramConfig.min_compatible_version` has been bumped to **≥ 0.15.0**.
⚠️

Phase 7.2 of the activator-removal effort (tracker #3607).
Contributor-side companion to #3735 (Phase 7.1, user-lifecycle).

## Summary

- Deprecate the 13 contributor-side program instructions whose only
client was the now-deleted activator: `ActivateDevice` (21),
`RejectDevice` (22), `CloseAccountDevice` (27), `ActivateLink` (29),
`RejectLink` (30), `CloseAccountLink` (35), `ActivateMulticastGroup`
(47), `RejectMulticastGroup` (48), `DeactivateMulticastGroup` (53),
`ActivateDeviceInterface` (72), `RemoveDeviceInterface` (75),
`UnlinkDeviceInterface` (77), and `RejectDeviceInterface` (78). Dispatch
arms now short-circuit to `DoubleZeroError::Deprecated` (custom code
67); the borsh variant tags are kept as unit variants so the wire format
is unchanged — old clients still hit a deterministic deprecation error
rather than an unknown-instruction decode failure.
- Delete the corresponding program processor files
(`processors/{device,link,multicastgroup}/{activate,reject,closeaccount}.rs`
and `processors/device/interface/{activate,reject,remove,unlink}.rs`)
and their argument structs.
- Delete the corresponding Rust SDK command wrappers
(`sdk/rs/src/commands/{device,link,multicastgroup}/...` and
`device/interface/...`) and the orphaned `DoubleZeroProgram` trait
methods on the CLI side; verified no live caller remains across
`smartcontract/cli/`, `client/`, `controlplane/`, `telemetry/`, and
`api/`.
- Bump `MIN_COMPATIBLE_VERSION` from `0.12.0` to **`0.15.0`** in
`smartcontract/programs/doublezero-serviceability/src/min_version.rs`.
The activator-removal tracker (#3607) documented this gate as ≥ 0.14.1,
but the `client/v0.14.1` git tag was a patch release built from a commit
whose workspace Cargo `version = "0.14.0"` — so the v0.14.1 CLI binary
self-reports as 0.14.0 in its startup version check (`embedded_version <
program.min_compat_version` → bail). `v0.15.0` is the first release
whose embedded version actually satisfies the intended ≥ 0.14.1 gate, so
setting the program gate to `0.15.0` is what we mean in practice. Same
value used for the `globalMinVersions` floor in
`e2e/compatibility_test.go`.
- Prune integration tests that exercised the deprecated flows; rewrite
the multi-step device delete + close-account sequence in
`device_test.rs`, `device_update_location_test.rs`, and the
`close_device` helper in `resource_extension_test.rs` to use the
existing atomic `DeleteDevice` path. Delete
`unlink_device_interface_test.rs` entirely (its subject is wholly the
deprecated `UnlinkDeviceInterface` flow). Drop the unused
`activate_link` helper in `doublezero-telemetry/tests/test_helpers.rs`
(its consumers already use `create_and_activate_link`, which is atomic
via `CreateLink`).
- Add `tests/deprecated_contributor_instructions_test.rs` — 13
`#[tokio::test]` cases, one per removed variant, asserting
`ProgramError::Custom(67) = Deprecated`.

`CloseResource` (variant 85) is preserved: audit confirms it is
foundation-allowlist-driven, not activator-driven.

## Risk

Hard removal. Any client running CLI < 0.15.0 against an upgraded
program will no longer be able to send these 13 instructions. The
`min_compatible_version` bump must happen first — this PR is the
merge-after-gate-met half.

This PR is significantly larger than the 500-line guideline (47 files,
+267 / -4892 in the main change). The phase is one indivisible gate flip
per the tracker (#3607), and Phase 7.1 (#3735, +130 / -2580) set the
precedent.

## Testing Verification

- `cargo test -p doublezero-serviceability --test
deprecated_contributor_instructions_test` — 13 / 13 deprecation
assertions pass.
- `cargo test -p doublezero-serviceability --tests` — all integration
tests pass (full suite, including the rewritten atomic-close tests).
- `cargo test -p doublezero-serviceability --lib` — 257 unit tests pass.
- `cargo test -p doublezero_sdk --lib` — 153 unit tests pass.
- `make rust-lint` clean.
- E2E `TestE2E_BackwardCompatibility` exercises CLI versions v0.15.0
through `current` against the upgraded program from this branch.

Closes #3623. Tracker: #3607.
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.

activator removal phase 7.1: remove user activate/reject/closeaccount instructions [DO NOT MERGE — gated on min_compatible_version >= 0.12.0]

2 participants