Skip to content

smartcontract/serviceability: collapse OnChainAllocation flag branches#3649

Open
elitegreg wants to merge 1 commit into
mainfrom
gm/3613-collapse-onchainallocation-flag-branches
Open

smartcontract/serviceability: collapse OnChainAllocation flag branches#3649
elitegreg wants to merge 1 commit into
mainfrom
gm/3613-collapse-onchainallocation-flag-branches

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

@elitegreg elitegreg commented May 2, 2026

Summary

  • Collapse every is_feature_enabled(FeatureFlag::OnChainAllocation) branch in
    the serviceability program; rename the variant to OnChainAllocationDeprecated
    with bit 0 documented as reserved-and-never-reused.
  • For the boolean-flagged instructions (multicastgroup create/delete/update/
    subscribe, link create/delete/accept/update, device interface
    create/delete), require use_onchain_(de)allocation: true and accept the
    resource extension accounts as positional, non-optional args. Calls that flip
    the flag false now return InvalidArgument. link::update and
    multicastgroup::update only enforce this when tunnel / multicast-IP fields
    are actually being changed, so trivial field-only updates don't need extras.
  • Relax ActivateDeviceInterface and UnlinkDeviceInterface status guards to
    accept the target status as a no-op, since CreateDeviceInterface now
    produces Loopback-Activated / Physical-Unlinked atomically.
  • Propagate the rename into the Rust SDK.

Phase 4, PR 4.1 of the activator removal effort. Closes #3613. Tracker: #3607.

Testing Verification

  • cargo test -p doublezero-serviceability --features no-entrypoint — 453
    passed, 0 failed.
  • cargo clippy --features no-entrypoint --all-targets -- -Dclippy::all -Dwarnings — clean across the workspace.
  • cargo test -p doublezero_sdk — 183 passed, 0 failed (rename-only changes in
    the SDK).
  • Test handling: deleted *_legacy_* / *_backward_compat_* cases that
    exercised the now-rejected paths and tests that asserted intermediate Pending
    status (Create now activates atomically); migrated the remaining tests onto
    the new account layouts. Net coverage is preserved by the onchain-pair tests
    that already covered the same instruction logic.
  • New init_globalstate_and_config helper in tests/test_helpers.rs so tests
    don't have to set up every ResourceExtension by hand.

Comment thread smartcontract/programs/doublezero-serviceability/src/processors/link/create.rs Outdated
Comment thread smartcontract/sdk/rs/src/commands/device/interface/create.rs
Comment thread smartcontract/sdk/rs/src/commands/user/create.rs
Comment thread smartcontract/sdk/rs/src/commands/user/create_subscribe.rs
Comment thread smartcontract/sdk/rs/src/commands/user/delete.rs
Comment thread smartcontract/sdk/rs/src/commands/user/requestban.rs
Comment thread smartcontract/sdk/rs/src/commands/user/update.rs
elitegreg added a commit that referenced this pull request May 3, 2026
- Drop is_feature_enabled checks from Rust SDK commands; resource accounts
  are now always passed and the `use_*onchain_*` boolean flags are derived
  from whether the field is being set rather than the global feature flag.
- Enforce `resource_count >= 2` and `DeviceStatus::Activated` in
  process_create_device.
- Tighten link/create.rs status check to `!= LinkStatus::Requested`.
- Update integration tests to drop the legacy Pending → Activated flow
  for devices (CreateDevice now activates atomically).
- Update activator to use renamed FeatureFlag::OnChainAllocationDeprecated.
elitegreg added a commit that referenced this pull request May 5, 2026
- Drop is_feature_enabled checks from Rust SDK commands; resource accounts
  are now always passed and the `use_*onchain_*` boolean flags are derived
  from whether the field is being set rather than the global feature flag.
- Enforce `resource_count >= 2` and `DeviceStatus::Activated` in
  process_create_device.
- Tighten link/create.rs status check to `!= LinkStatus::Requested`.
- Update integration tests to drop the legacy Pending → Activated flow
  for devices (CreateDevice now activates atomically).
- Update activator to use renamed FeatureFlag::OnChainAllocationDeprecated.
@elitegreg elitegreg force-pushed the gm/3613-collapse-onchainallocation-flag-branches branch from 04ec2cd to 02f33c3 Compare May 5, 2026 16:03
elitegreg added a commit that referenced this pull request May 11, 2026
- Drop is_feature_enabled checks from Rust SDK commands; resource accounts
  are now always passed and the `use_*onchain_*` boolean flags are derived
  from whether the field is being set rather than the global feature flag.
- Enforce `resource_count >= 2` and `DeviceStatus::Activated` in
  process_create_device.
- Tighten link/create.rs status check to `!= LinkStatus::Requested`.
- Update integration tests to drop the legacy Pending → Activated flow
  for devices (CreateDevice now activates atomically).
- Update activator to use renamed FeatureFlag::OnChainAllocationDeprecated.
@elitegreg elitegreg force-pushed the gm/3613-collapse-onchainallocation-flag-branches branch 3 times, most recently from 5f1cf82 to 28608cd Compare May 12, 2026 16:28
Treat onchain allocation as always-on by removing every is_feature_enabled(OnChainAllocation)
branch from the serviceability program processors. Rename the FeatureFlag::OnChainAllocation
variant to OnChainAllocationDeprecated so bit 0 is reserved and never reused — the variant
itself is retained so the flag discriminant doesn't shift.

Boolean-flagged instructions (device/interface, link, multicastgroup) now validate
use_onchain_(de)allocation == true and require the ResourceExtension accounts as
non-optional positional args. Calls that pass false return InvalidArgument.

ActivateDeviceInterface and UnlinkDeviceInterface status guards are relaxed to accept
already-Activated / already-Unlinked interfaces idempotently, since CreateDeviceInterface
now activates atomically.

Tests covering the now-impossible feature-flag-disabled and legacy-allocation paths are
deleted. Remaining tests are migrated onto the always-on layout; the global_test.rs file
is removed entirely (its coverage is preserved by the per-instruction tests).

E2E backward-compatibility test cascades skip link operations when link_create_wan/dzx
are known-incompatible with the historic ABI.

Refs #3613
@elitegreg elitegreg force-pushed the gm/3613-collapse-onchainallocation-flag-branches branch from 28608cd to 330d482 Compare May 12, 2026 20:45
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.

activator removal phase 4.1: serviceability program — collapse OnChainAllocation flag branches

1 participant