You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, instead of returning none if the current value is the maximum already, it returns the saturated value, this is counterintuitive for me. Additionally, it seems that this behavior is a bug in the AutoIncAssetId, which IMO should return an error if the maximum value for the asset it is reached, otherwise we will keep overwriting the asset with AssetId::MAX, when a new asset is created, see here.
This is the only usage (as far as I can tell) in the polkadot-sdk, so my suggestion is to change this to this line to simply use a checked operation instead of a saturating one.
The text was updated successfully, but these errors were encountered:
The documentation of incrementable says:
Returns
Somewith the incremented value if it is possible, or
Noneif it is not.
as can be seen here.
However, instead of returning none if the current value is the maximum already, it returns the saturated value, this is counterintuitive for me. Additionally, it seems that this behavior is a bug in the
AutoIncAssetId
, which IMO should return an error if the maximum value for the asset it is reached, otherwise we will keep overwriting the asset withAssetId::MAX
, when a new asset is created, see here.This is the only usage (as far as I can tell) in the polkadot-sdk, so my suggestion is to change this to this line to simply use a checked operation instead of a saturating one.
The text was updated successfully, but these errors were encountered: