Skip to content

fix(permission): exclude disabled ContractType 51 and surface unknown ops in UI#935

Open
Federico2014 wants to merge 1 commit into
tronprotocol:release_v4.9.7from
Federico2014:fix/update-permission-shielded-op51
Open

fix(permission): exclude disabled ContractType 51 and surface unknown ops in UI#935
Federico2014 wants to merge 1 commit into
tronprotocol:release_v4.9.7from
Federico2014:fix/update-permission-shielded-op51

Conversation

@Federico2014

Copy link
Copy Markdown
Contributor

Summary

Fixes two related problems in the interactive updateaccountpermission flow, both stemming from how the active-permission operations bitmap is handled.

1. Default active permission grants a disabled ContractType

When an account has no existing active permission, the flow applied a hardcoded default operations bitmap that granted ContractType 51 (ShieldedTransferContract). Shielded transfer is disabled on mainnet and most networks, so the node rejected the whole AccountPermissionUpdate:

CONTRACT_VALIDATE_ERROR, Contract validate error : 51 isn't a validate ContractType
UpdateAccountPermission  failed !!!

This triggered even when the user only edited owner_permission, because the default active permission is auto-applied.

Fix: clear bit 51 in the default bitmap (UpdateAccountPermissionInteractive.java): byte index 6 0xfb -> 0xf3, i.e. 7fff1fc0033efb0f... -> 7fff1fc0033ef30f.... This matches the canonical ALL_OPERATIONS / AVAILABLE_OPERATIONS lists in the same file, which already exclude 51.

2. Unknown/disabled ops were silently hidden and undeletable in the UI

Operations absent from operationsMap (such as the disabled ContractType 51) were filtered out of the preview and the edit/delete menus. As a result a user could neither see nor remove such an op through the interactive UI — making the problem above impossible to self-diagnose or fix manually.

Fix: add opLabel(code) and contractTypeName(code) helpers and render every operation with a visible placeholder (e.g. Unsupported/Disabled op 51) instead of dropping it. Four sites updated:

  • "Current allowed operations" list in editActivePermissions (removed the silent .filter(...))
  • the delete list
  • printPermissionSummary preview
  • printPermissionDetail final preview

An unknown/disabled op is now visible and deletable.

Verification

  • Decoded both bitmaps: only op 51 is removed; no other bits change.
  • ./gradlew compileJava passes.
  • No tests pinned the old bitmap string.

Scope

  • Single file changed: UpdateAccountPermissionInteractive.java.
  • The add-operation menu already sources from AVAILABLE_OPERATIONS (which excludes 51), so it was left unchanged.

Fixes #934

@Federico2014 Federico2014 changed the base branch from release_v4.9.6 to release_v4.9.7 June 16, 2026 14:13
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.

1 participant