fix(permission): exclude disabled ContractType 51 and surface unknown ops in UI#935
Open
Federico2014 wants to merge 1 commit into
Open
Conversation
d9aa970 to
a496006
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
Fixes two related problems in the interactive
updateaccountpermissionflow, 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: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 60xfb->0xf3, i.e.7fff1fc0033efb0f...->7fff1fc0033ef30f.... This matches the canonicalALL_OPERATIONS/AVAILABLE_OPERATIONSlists 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)andcontractTypeName(code)helpers and render every operation with a visible placeholder (e.g.Unsupported/Disabled op 51) instead of dropping it. Four sites updated:editActivePermissions(removed the silent.filter(...))printPermissionSummarypreviewprintPermissionDetailfinal previewAn unknown/disabled op is now visible and deletable.
Verification
./gradlew compileJavapasses.Scope
UpdateAccountPermissionInteractive.java.AVAILABLE_OPERATIONS(which excludes 51), so it was left unchanged.Fixes #934