smartcontract/serviceability: collapse OnChainAllocation flag branches#3649
Open
elitegreg wants to merge 1 commit into
Open
smartcontract/serviceability: collapse OnChainAllocation flag branches#3649elitegreg wants to merge 1 commit into
elitegreg wants to merge 1 commit into
Conversation
elitegreg
commented
May 3, 2026
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.
04ec2cd to
02f33c3
Compare
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.
5f1cf82 to
28608cd
Compare
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
28608cd to
330d482
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is_feature_enabled(FeatureFlag::OnChainAllocation)branch inthe serviceability program; rename the variant to
OnChainAllocationDeprecatedwith bit 0 documented as reserved-and-never-reused.
create/delete/update/subscribe, linkcreate/delete/accept/update, device interfacecreate/delete), requireuse_onchain_(de)allocation: trueand accept theresource extension accounts as positional, non-optional args. Calls that flip
the flag false now return
InvalidArgument.link::updateandmulticastgroup::updateonly enforce this when tunnel / multicast-IP fieldsare actually being changed, so trivial field-only updates don't need extras.
ActivateDeviceInterfaceandUnlinkDeviceInterfacestatus guards toaccept the target status as a no-op, since
CreateDeviceInterfacenowproduces Loopback-Activated / Physical-Unlinked atomically.
Phase 4, PR 4.1 of the activator removal effort. Closes #3613. Tracker: #3607.
Testing Verification
cargo test -p doublezero-serviceability --features no-entrypoint— 453passed, 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 inthe SDK).
*_legacy_*/*_backward_compat_*cases thatexercised 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.
init_globalstate_and_confighelper intests/test_helpers.rsso testsdon't have to set up every ResourceExtension by hand.