fix(drive-abci): report configured main control group authority when unauthorized#4000
Conversation
…oup change item authorized_action_takers_for_configuration_item returned NoOne for MainControlGroup(_) regardless of configuration, so UnauthorizedTokenActionError reported NoOne even when main_control_group_can_be_modified allowed the change, making misconfigured contracts look like group mutation was broken. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Covers the config-update path where main_control_group_can_be_modified is Group(0): the proposer alone does not apply the change, and the second group signature completes it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis change modifies ChangesMainControlGroup authorized action takers
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Proposer
participant GroupMember
participant StateTransitionValidator
participant TokenConfiguration
Proposer->>StateTransitionValidator: Propose main control group update
StateTransitionValidator->>TokenConfiguration: Check accumulated group power
TokenConfiguration-->>StateTransitionValidator: main_control_group remains None
GroupMember->>StateTransitionValidator: Submit corresponding update action
StateTransitionValidator->>TokenConfiguration: Recheck accumulated group power
TokenConfiguration-->>StateTransitionValidator: main_control_group set to Some(0)
Related PRs: None identified. Suggested labels: rust, tests, tokens Suggested reviewers: None identified. 🐰 A rabbit hops through control group gates, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
✅ Final review complete — no blockers (commit fe77f1f) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Codex + Sonnet
PR #4000 fixes a narrow reporting bug: authorized_action_takers_for_configuration_item previously hardcoded NoOne for MainControlGroup change items instead of returning the actual main_control_group_can_be_modified field. I verified the diff directly — the actual authorization gate (can_apply_token_configuration_item, lines 285-292 of can_apply_token_configuration_item/v0/mod.rs) already used main_control_group_can_be_modified correctly and is untouched by this PR, so no authorization behavior changes, only the error message reported via UnauthorizedTokenActionError. I traced that error's serialization path to ExecTxResult.info (not .data), confirming it is non-consensus-critical per the ABCI spec, so no platform_version gate is required. Both new DPP unit tests and the drive-abci group-authorization integration test are correct, compile-consistent, and meaningfully cover the fix and the underlying two-step group-approval invariant. No in-scope defects found.
Review provenance
- Codex reviewers:
gpt-5.6-sol— general (completed) - Verifier:
claude-sonnet-5— verifier - Sonnet reviewers:
claude-sonnet-5— general (completed)
|
superceeded by 4209 |
Issue being fixed or feature implemented
TokenConfigurationChangeItem::MainControlGroupis authorized by the token fieldmain_control_group_can_be_modified. The validation gate already used that field correctly, but theUnauthorizedTokenActionErrorproduced when the check fails reported the takers fromauthorized_action_takers_for_configuration_item, which hardcodesNoOneforMainControlGroup. That made failures look like the action was impossible for everyone, when the configured rule could beContractOwner,MainGroup,Group(0), or a specific identity:Since this PR was opened, #4154 added
controlling_action_takers_for_configuration_item(which returnsmain_control_group_can_be_modified) and a version-gatedstate_v1validation that uses it for the group-binding check. That superseded the original approach here of changingauthorized_action_takers_for_configuration_itemdirectly — the legacy helper's report must stay unchanged for protocol versions where it is already live.However, the misleading report was still reachable at the new validation version:
validate_state_v1delegates the main authorization check tovalidate_state_v0, which still built the error from the legacy helper. This PR has been reworked on top of #4154 to fix that remaining path.What was done?
validate_state_v0_with_reported_action_takers, which takes an optional override for the action takers reported inUnauthorizedTokenActionError.validate_state_v0passesNone, so behavior at validation version 0 is byte-for-byte unchanged.validate_state_v1now passes the already-computed controlling rule, so unauthorizedMainControlGroupupdates reportmain_control_group_can_be_modifiedinstead ofNoOne. For every other change item the controlling rule equals the legacy report, so nothing else changes.controlling_action_takers_for_configuration_itemreports each configuredmain_control_group_can_be_modifiedvalue verbatim.test_token_config_update_main_control_group_unauthorized_reports_configured_rule— a non-member submitting aMainControlGroupchange getsUnauthorizedTokenActionErrorreportingGroup(0)(the configured rule), notNoOne.test_token_config_update_by_group_member_changing_main_control_group— the existing valid path where a configured group updates the main control group once enough group power has signed.How Has This Been Tested?
Breaking Changes
None. Validation version 0 output is unchanged; the corrected report only applies at validation version 1 (protocol v13, not yet released).
Checklist:
For repository code-owners and collaborators only