bitshares-ui: Incorrect implementation of the disable-bit smartcoin issuer permissions & flags?

Describe the bug

The new disable-bit permissions are as follows:

// If one of the following bits is set in asset issuer permissions,
// it means the asset issuer (or owner for bitassets) does NOT have the permission to update
// the corresponding flag, parameters or perform certain actions.
// This is to be compatible with old client software.
// Note: This comment is copied and reformatted above for better Doxygen documentation formatting.
lock_max_supply      = 0x200, ///< the max supply of the asset can not be updated
disable_new_supply   = 0x400, ///< unable to create new supply for the asset
// For disable_mcr_update, disable_icr_update and disable_mssr_update,
// if one of these is set in asset issuer permissions, and
// - if the bitasset owner has set a value for the corresponding parameter, the value can not be updated,
// - if the bitasset owner has not set a value for the corresponding parameter, the parameter can still be
//   updated by the price feed producers.
// Note: This comment is copied and reformatted above for better Doxygen documentation formatting.
disable_mcr_update   = 0x800, ///< the bitasset owner can not update MCR, permission only
disable_icr_update   = 0x1000, ///< the bitasset owner can not update ICR, permission only
disable_mssr_update  = 0x2000, ///< the bitasset owner can not update MSSR, permission only
disable_bsrm_update  = 0x4000, ///< the bitasset owner can not update BSRM, permission only
disable_collateral_bidding = 0x8000  ///< Can not bid collateral after a global settlement

So, if my understanding of the above is correct, then the following should be true:

  • When the “lock_max_supply” issuer flag is enabled, the asset creator does not have permission to update the “lock_max_supply” flag.

This applies for the rest of these disable-bit flags, so when the toggle is disabled, the flag should become available to edit, right?

When you disable the issuer permission, the corresponding flag is missing, you’re therefore unable to enable the flag to enable the new feature?

To Reproduce Steps to reproduce the behavior:

  • Go to the asset creator page.
  • Enable smartcoin options
  • Go to the issuer permission page, disable severl of these disable-bit issuer permissions.
  • Go to the flag page, look for the corresponding flag for the issuer permission you just disabled, it will not be there.

Expected behavior

Unlike the enable-bit issuer permissions, the disable-bit issuer permissions should result in the opposite behaviour in the flags - they should be visible and editable flags when their disable-bit issuer permission has been disabled.

Additional context

Core code reference: https://github.com/bitshares/bitshares-core/blob/3174d22b5267d0057d0857ac53086e9813c8559f/libraries/protocol/include/graphene/protocol/types.hpp#L205

This is the point where the disabled disable-bit permission fails to be included as a configurable flag: https://github.com/bitshares/bitshares-ui/blob/cba882168c99327e068b2ee23e5ccf8d704a589a/app/components/Account/AccountAssetCreate.jsx#L771

The double-negative terminology is confusing.

Misconfiguration of these disable-bit’s corresponding flags could be preventing users from creating new smartcoins.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 22 (22 by maintainers)

Most upvoted comments

Update: fixed some errors in my comment https://github.com/bitshares/bitshares-ui/issues/3732#issuecomment-2365207854, and added more info to some items.

Updated my comment https://github.com/bitshares/bitshares-ui/issues/3732#issuecomment-2365207854 with a full list of asset issuer permissions and flags.

I’ve changed the Astro UX to use the same permission/flag wording as the reference UI, minus expanding the acronyms to full wording to avoid translation into incorrect acronym definitions, so the user isn’t affected by the double negative terminology.

I don’t think wording in the reference UI is perfect, but it is a good start. Thanks. We know the system is complicated and hard to make perfect UI/UX.

Asset Issuer Permissions

Issuer Permission Which bit in data storage Value in binary form Value in Hex form Asset Effect MPA/PM Default? UIA Default?
charge_market_fee ???? ???? ???? ???* ???? ???? ???? ???1 0x0001 The asset issuer/owner can update the charge_market_fee flag (see the Flags section for more info) Yes Yes
charge_market_fee ???? ???? ???? ???* ???? ???? ???? ???0 0 The asset issuer/owner can NOT update the charge_market_fee flag (see the Flags section for more info). Note: if the charge_market_fee flag is set to 0, can no longer start charging market trading fees; if the charge_market_fee flag is set to non-zero, the market trading fee rates can still be updated to 0 or non-zero at any time so that trading is not charged or charged.
white_list ???? ???? ???? ??*? ???? ???? ???? ??1? 0x0002 The asset issuer/owner can update the white_list flag (see the Flags section for more info) Yes Yes
white_list ???? ???? ???? ??*? ???? ???? ???? ??0? 0 The asset issuer/owner can NOT update the white_list flag (see the Flags section for more info). Note: if the white_list flag is set to 0, can no longer start enforcing whitelisting or blacklisting; if the white_list flag is set to non-zero, can still configure to not enforce whitelisting or blacklisting at any time by clearing the whitelisting and blacklisting authorities.
override_authority ???? ???? ???? ?*?? ???? ???? ???? ?1?? 0x0004 The asset issuer/owner can update the override_authority flag (see the Flags section for more info) Yes Yes
override_authority ???? ???? ???? ?*?? ???? ???? ???? ?0?? 0 The asset issuer/owner can NOT update the override_authority flag (see the Flags section for more info).
transfer_restricted ???? ???? ???? *??? ???? ???? ???? 1??? 0x0008 The asset issuer/owner can update the transfer_restricted flag (see the Flags section for more info) Yes Yes
transfer_restricted ???? ???? ???? *??? ???? ???? ???? 0??? 0 The asset issuer/owner can NOT update the transfer_restricted flag (see the Flags section for more info).
disable_force_settle ???? ???? ???* ???? ???? ???? ???1 ???? 0x0010 The asset issuer/owner can update the disable_force_settle flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning. Yes
disable_force_settle ???? ???? ???* ???? ???? ???? ???0 ???? 0 The asset issuer/owner can NOT update the disable_force_settle flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning. Yes
global_settle ???? ???? ??*? ???? ???? ???? ??1? ???? 0x0020 The asset issuer/owner can manually globally settle this asset (BitAsset or Prediction Market). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning, and for Prediction Markets this issuer permission can only be non-zero which means global-settlement has to be enabled. Yes
global_settle ???? ???? ??*? ???? ???? ???? ??0? ???? 0 The asset issuer/owner can NOT manually globally settle this asset (BitAsset). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning, and for Prediction Markets this issuer permission can only be non-zero which means global-settlement has to be enabled. Yes
disable_confidential ???? ???? ?*?? ???? ???? ???? ?1?? ???? 0x0040 The asset issuer/owner can update the disable_confidential flag (see the Flags section for more info) Yes Yes
disable_confidential ???? ???? ?*?? ???? ???? ???? ?0?? ???? 0 The asset issuer/owner can NOT update the disable_confidential flag (see the Flags section for more info).
witness_fed_asset ???? ???? *??? ???? ???? ???? 1??? ???? 0x0080 The asset issuer/owner can update the witness_fed_asset flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning. Yes
witness_fed_asset ???? ???? *??? ???? ???? ???? 0??? ???? 0 The asset issuer/owner can NOT update the witness_fed_asset flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning. Yes
committee_fed_asset ???? ???* ???? ???? ???? ???1 ???? ???? 0x0100 The asset issuer/owner can update the committee_fed_asset flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning. Yes
committee_fed_asset ???? ???* ???? ???? ???? ???0 ???? ???? 0 The asset issuer/owner can NOT update the committee_fed_asset flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning. Yes
lock_max_supply ???? ??*? ???? ???? ???? ??1? ???? ???? 0x0200 The asset issuer/owner can NOT update the lock_max_supply flag (see the Flags section for more info)
lock_max_supply ???? ??*? ???? ???? ???? ??0? ???? ???? 0 The asset issuer/owner can update the lock_max_supply flag (see the Flags section for more info). Yes Yes
disable_new_supply ???? ?*?? ???? ???? ???? ?1?? ???? ???? 0x0400 The asset issuer/owner can NOT update the disable_new_supply flag (see the Flags section for more info)
disable_new_supply ???? ?*?? ???? ???? ???? ?0?? ???? ???? 0 The asset issuer/owner can update the disable_new_supply flag (see the Flags section for more info). Yes Yes
disable_mcr_update ???? *??? ???? ???? ???? 1??? ???? ???? 0x0800 The asset issuer/owner can NOT update (set/change/delete) the maintenance_collateral_ratio extension of the asset. If a value is set in the maintenance_collateral_ratio extension, it takes precedence over the same parameter suggested by the price feed publishers, otherwise the value suggested by the price feed publishers takes effect. Please note that this issuer permission only applies to BitAssets, for Prediction Markets this issuer permission is ignored (can be either zero or non-zero), and for other asset types this issuer permission can only be 0 and has no meaning.
disable_mcr_update ???? *??? ???? ???? ???? 0??? ???? ???? 0 The asset issuer/owner can update (set/change/delete) the maintenance_collateral_ratio extension of the asset. If a value is set in the maintenance_collateral_ratio extension, it takes precedence over the same parameter suggested by the price feed publishers, otherwise the value suggested by the price feed publishers takes effect. Please note that this issuer permission only applies to BitAssets, for Prediction Markets this issuer permission is ignored (can be either zero or non-zero), and for other asset types this issuer permission can only be 0 and has no meaning. Yes Yes
disable_icr_update ???* ???? ???? ???? ???1 ???? ???? ???? 0x1000 The asset issuer/owner can NOT update (set/change/delete) the initial_collateral_ratio extension of the asset. If a value is set in the initial_collateral_ratio extension, it takes precedence over the same parameter suggested by the price feed publishers, otherwise the value suggested by the price feed publishers takes effect. Please note that this issuer permission only applies to BitAssets, for Prediction Markets this issuer permission is ignored (can be either zero or non-zero), and for other asset types this issuer permission can only be 0 and has no meaning.
disable_icr_update ???* ???? ???? ???? ???0 ???? ???? ???? 0 The asset issuer/owner can update (set/change/delete) the initial_collateral_ratio extension of the asset. If a value is set in the initial_collateral_ratio extension, it takes precedence over the same parameter suggested by the price feed publishers, otherwise the value suggested by the price feed publishers takes effect. Please note that this issuer permission only applies to BitAssets, for Prediction Markets this issuer permission is ignored (can be either zero or non-zero), and for other asset types this issuer permission can only be 0 and has no meaning. Yes Yes
disable_mssr_update ??*? ???? ???? ???? ??1? ???? ???? ???? 0x2000 The asset issuer/owner can NOT update (set/change/delete) the maximum_short_squeeze_ratio extension of the asset. If a value is set in the maximum_short_squeeze_ratio extension, it takes precedence over the same parameter suggested by the price feed publishers, otherwise the value suggested by the price feed publishers takes effect. Please note that this issuer permission only applies to BitAssets, for Prediction Markets this issuer permission is ignored (can be either zero or non-zero), and for other asset types this issuer permission can only be 0 and has no meaning.
disable_mssr_update ??*? ???? ???? ???? ??0? ???? ???? ???? 0 The asset issuer/owner can update (set/change/delete) the maximum_short_squeeze_ratio extension of the asset. If a value is set in the maximum_short_squeeze_ratio extension, it takes precedence over the same parameter suggested by the price feed publishers, otherwise the value suggested by the price feed publishers takes effect Please note that this issuer permission only applies to BitAssets, for Prediction Markets this issuer permission is ignored (can be either zero or non-zero), and for other asset types this issuer permission can only be 0 and has no meaning. Yes Yes
disable_bsrm_update ?*?? ???? ???? ???? ?1?? ???? ???? ???? 0x4000 The asset issuer/owner can NOT update the black_swan_response_method extension of the asset. Please note that this issuer permission only applies to BitAssets, for other asset types (including Prediction Markets) this issuer permission can only be 0 and has no meaning.
disable_bsrm_update ?*?? ???? ???? ???? ?0?? ???? ???? ???? 0 The asset issuer/owner can update the black_swan_response_method extension of the asset. Please note that this issuer permission only applies to BitAssets, for other asset types (including Prediction Markets) this issuer permission can only be 0 and has no meaning. Yes Yes
disable_collateral_bidding *??? ???? ???? ???? 1??? ???? ???? ???? 0x8000 The asset issuer/owner can NOT update the disable_collateral_bidding flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning.
disable_collateral_bidding *??? ???? ???? ???? 0??? ???? ???? ???? 0 The asset issuer/owner can update the disable_collateral_bidding flag (see the Flags section for more info). Please note that this issuer permission only applies to BitAssets and Prediction Markets, for other asset types this issuer permission can only be 0 and has no meaning. Yes Yes

Asset Flags

Flag Which bit in data storage Value in binary form Value in Hex form Asset Effect
charge_market_fee ???? ???? ???? ???* ???? ???? ???? ???1 0x0001 Market trades in this asset may be charged, depending on the fee rate settings.
charge_market_fee ???? ???? ???? ???* ???? ???? ???? ???0 0 Market trades in this asset are not charged
white_list ???? ???? ???? ??*? ???? ???? ???? ??1? 0x0002 The use of this asset may be restricted by asset authorization (whitelist and/or blacklist), depending on the settings of whitelisting and blacklisting authorities.
white_list ???? ???? ???? ??*? ???? ???? ???? ??0? 0 The use of this asset is not restricted by asset authorization (whitelist and/or blacklist) (but other restrictions may still apply)
override_authority ???? ???? ???? ?*?? ???? ???? ???? ?1?? 0x0004 The asset issuer/owner can transfer any amount of this asset from the balance of any account to another account (note that the balance after transfer cannot be negative).
override_authority ???? ???? ???? ?*?? ???? ???? ???? ?0?? 0 The asset issuer/owner can NOT transfer this asset from the balance of other accounts
transfer_restricted ???? ???? ???? *??? ???? ???? ???? 1??? 0x0008 When transferring this asset, can only from the asset issuer/owner or to the asset issuer/owner. The same from or to limitation also applies to HTLCs and withdraw-permission withdrawals. Cannot create vesting balances with this asset. Cannot transfer this asset to blind/stealth/confidential addresses. Please note that this limitation does not prevent other operations such as buying from anyone or selling to anyone.
transfer_restricted ???? ???? ???? *??? ???? ???? ???? 0??? 0 No such limitation (but other restrictions may still apply).
disable_force_settle ???? ???? ???* ???? ???? ???? ???1 ???? 0x0010 Holders of this asset can NOT request a forced settlement for some amount of their asset, unless this asset is globally settled or individually settled to a fund (and other restrictions may still apply). Please note that this flag only applies to BitAssets, for Prediction Markets this flag is ignored (can be either zero or non-zero), and for other asset types this flag can only be 0 and has no meaning.
disable_force_settle ???? ???? ???* ???? ???? ???? ???0 ???? 0 Holders of this asset can request a forced settlement for some amount of their asset (but other restrictions may still apply). Please note that this flag only applies to BitAssets, for Prediction Markets this flag is ignored (can be either zero or non-zero), and for other asset types this flag can only be 0 and has no meaning.
global_settle ???? ???? ??*? ???? ???? ???? ??0? ???? 0 Please note that this flag has no meaning and can only be zero.
disable_confidential ???? ???? ?*?? ???? ???? ???? ?1?? ???? 0x0040 Can NOT transfer an amount of this asset from the balance of an account to blind/stealth/confidential addresses. Note that transferring from blind/stealth/confidential addresses to other blind/stealth/confidential addresses or to the balance of an account is still allowed.
disable_confidential ???? ???? ?*?? ???? ???? ???? ?0?? ???? 0 Can transfer an amount of this asset from the balance of an account to blind/stealth/confidential addresses (but other restrictions may still apply).
witness_fed_asset ???? ???? *??? ???? ???? ???? 1??? ???? 0x0080 Active witnesses can publish price feeds for this asset (BitAsset or Prediction market). Please note that this flag only applies to BitAssets and Prediction Markets, for other asset types this flag can only be 0 and has no meaning. Please note that the witness_fed_asset flag and committee_fed_asset flag can not both be non-zero.
witness_fed_asset ???? ???? *??? ???? ???? ???? 0??? ???? 0 It is NOT the active witnesses’ job to publish price feeds for this asset (BitAsset or Prediction market). Please note that this flag only applies to BitAssets and Prediction Markets, for other asset types this flag can only be 0 and has no meaning.
committee_fed_asset ???? ???* ???? ???? ???? ???1 ???? ???? 0x0100 Active committee members can publish price feeds for this asset (BitAsset or Prediction market). Please note that this flag only applies to BitAssets and Prediction Markets, for other asset types this flag can only be 0 and has no meaning. Please note that the witness_fed_asset flag and committee_fed_asset flag can not both be non-zero.
committee_fed_asset ???? ???* ???? ???? ???? ???0 ???? ???? 0 It is NOT the active committee members’ job to publish price feeds for this asset (BitAsset or Prediction market). Please note that this flag only applies to BitAssets and Prediction Markets, for other asset types this flag can only be 0 and has no meaning.
lock_max_supply ???? ??*? ???? ???? ???? ??1? ???? ???? 0x0200 The maximum supply of this asset is locked, which means that the asset issuer/owner can NOT update the maximum supply of this asset. Note that if the lock_max_supply issuer permission is zero, the asset issuer/owner can still update this flag to unlock the maximum supply.
lock_max_supply ???? ??*? ???? ???? ???? ??0? ???? ???? 0 The asset issuer/owner can update the maximum supply of this asset.
disable_new_supply ???? ?*?? ???? ???? ???? ?1?? ???? ???? 0x0400 Cannot create new supply for this asset (or say unable to “mint” more tokens).
disable_new_supply ???? ?*?? ???? ???? ???? ?0?? ???? ???? 0 Can create new supply for this asset (or say able to “mint” more tokens).
disable_mcr_update ???? *??? ???? ???? ???? 0??? ???? ???? 0 Please note that this flag has no meaning and can only be zero.
disable_icr_update ???* ???? ???? ???? ???0 ???? ???? ???? 0 Please note that this flag has no meaning and can only be zero.
disable_mssr_update ??*? ???? ???? ???? ??0? ???? ???? ???? 0 Please note that this flag has no meaning and can only be zero.
disable_bsrm_update ?*?? ???? ???? ???? ?0?? ???? ???? ???? 0 Please note that this flag has no meaning and can only be zero.
disable_collateral_bidding *??? ???? ???? ???? 1??? ???? ???? ???? 0x8000 It is NOT allowed to bid for collateral in the global-settlement pool when this asset (BitAsset) has been globally settled. Please note that this flag only applies to BitAssets, for Prediction Markets this flag is ignored (can be either zero or non-zero), and for other asset types this flag can only be 0 and has no meaning.
disable_collateral_bidding *??? ???? ???? ???? 0??? ???? ???? ???? 0 It is allowed to bid for collateral in the global-settlement pool when this asset (BitAsset) has been globally settled (but other restrictions may still apply). Please note that this flag only applies to BitAssets, for Prediction Markets this flag is ignored (can be either zero or non-zero), and for other asset types this flag can only be 0 and has no meaning.

I’ve changed the Astro UX to use the same permission/flag wording as the reference UI, minus expanding the acronyms to full wording to avoid translation into incorrect acronym definitions, so the user isn’t affected by the double negative terminology.

image

Now that I’ve adjusted the issuer permission to the new spec, the above yields:

"issuer_permissions": 511,
"flags": 0,

image The above yields:

"issuer_permissions": 65535,
"flags": 1631,

issuer permission UI checkbox value asset effect resulting hexadecimal literal value lock_max_supply true (checked) Unable to lock max supply. 0x200

Not exactly.

lock_max_supply false (unchecked) Able to lock max supply. 0 disable_new_supply true Unable to configure flag. 0x400

Correct. Others should be inline with this narrative.

disable_new_supply false Able to configure flag. 0 disable_mcr_update true Unable to set static MCR. 0x800

Not exactly. (Also the same for the following 3.)

disable_mcr_update false Able to set static MCR 0 disable_icr_update true Unable to set static ICR 0x1000 disable_icr_update false Able to set static ICR. 0 disable_mssr_update true Unable to set static MSSR 0x2000 disable_mssr_update false Able to set static MSSR 0 disable_bsrm_update true Unable to set BSRM strategy. 0x4000 disable_bsrm_update false Able to set BSRM strategy 0 disable_collateral_bidding true Unable to configure flag 0x8000

Correct.

disable_collateral_bidding false Able to configure flag 0

issuer flags UI checkbox value asset effect resulting hexadecimal literal value lock_max_supply true Locked max supply 0x200 lock_max_supply false Unlocked max supply 0 disable_new_supply true Locked new supply 0x400 disable_new_supply false Unlocked new supply 0 disable_collateral_bidding true Disabled collateral bidding 0x8000 disable_collateral_bidding false Enabled collateral bidding 0

This is how I am currently understanding it, the reason why 511 isn’t what’s being calculated is because each of the new disable-bit issuer permissions are providing their hex value towards the final value when default checked true (which is by default disabling the feature)

Should it be the opposite, ie disable_mcr_update true = 0 and false = 0x800 then?

By default all permissions should be enable. That being said, the enable-bits should all be 1, and the disable-bits should all be 0. (I don’t use “true” or “false” to describe it.)

For permission only bits, the flag can only be set to 0.

https://github.com/bitshares/bitshares-core/blob/d069614135b3e7a3661a0ebb64ee0dc6b4d4b4f4/libraries/protocol/asset_ops.cpp#L287-L289

   // The permission-only bits can not be set in flag
   FC_ASSERT( 0 == (flags & global_settle),
              "Can not set global_settle flag, it is for issuer permission only" );

https://github.com/bitshares/bitshares-core/blob/d069614135b3e7a3661a0ebb64ee0dc6b4d4b4f4/libraries/protocol/asset_ops.cpp#L320-L328

   FC_ASSERT( 0 == (flags & disable_mcr_update),
              "Can not set disable_mcr_update flag, it is for issuer permission only" );
   FC_ASSERT( 0 == (flags & disable_icr_update),
              "Can not set disable_icr_update flag, it is for issuer permission only" );
   FC_ASSERT( 0 == (flags & disable_mssr_update),
              "Can not set disable_mssr_update flag, it is for issuer permission only" );
   FC_ASSERT( 0 == (flags & disable_bsrm_update),
              "Can not set disable_bsrm_update flag, it is for issuer permission only" );