Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change marker module param for max_total_supply to BigInt #1292

Closed
4 tasks
arnabmitra opened this issue Jan 9, 2023 · 1 comment · Fixed by #1675
Closed
4 tasks

Change marker module param for max_total_supply to BigInt #1292

arnabmitra opened this issue Jan 9, 2023 · 1 comment · Fixed by #1675
Assignees
Labels
bug Something isn't working marker Marker Module
Milestone

Comments

@arnabmitra
Copy link
Contributor

Summary

Problem Definition

A marker is defined with a supply as Cosmos Int, which is nothing but a BigInt, which is the way it should be.

var _ customProtobufType = (*Int)(nil)

// Int wraps big.Int with a 257 bit range bound
// Checks overflow, underflow and division by zero
// Exists in range from -(2^256 - 1) to 2^256 - 1
type Int struct {
	i *big.Int
}
// MarkerAccount holds the marker configuration information in addition to a base account structure.
message MarkerAccount {
  option (gogoproto.goproto_getters)         = false;
  option (gogoproto.goproto_stringer)        = false;
  option (cosmos_proto.implements_interface) = "MarkerAccountI";

  // base cosmos account information including address and coin holdings.
  cosmos.auth.v1beta1.BaseAccount base_account = 1
      [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""];
  // Address that owns the marker configuration.  This account must sign any requests
  // to change marker config (only valid for statuses prior to finalization)
  string manager = 2 [(gogoproto.moretags) = "json:\"manager,omitempty\""];
  // Access control lists
  repeated AccessGrant access_control = 3 [(gogoproto.nullable) = false];
  // Indicates the current status of this marker record.
  MarkerStatus status = 4;
  // value denomination and total supply for the token.
  string denom = 5;
  // the total supply expected for a marker.  This is the amount that is minted when a marker is created.
  string supply = 6 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
    (gogoproto.nullable)   = false,
    (gogoproto.moretags)   = "json:\"total_supply\" yaml:\"total_supply\""
  ];
  // Marker type information
  MarkerType marker_type = 7 [(gogoproto.moretags) = "json:\"marker_type,omitempty\""];
  // A fixed supply will mint additional coin automatically if the total supply decreases below a set value.  This
  // may occur if the coin is burned or an account holding the coin is slashed. (default: true)
  bool supply_fixed = 8;
  // indicates that governance based control is allowed for this marker
  bool allow_governance_control = 9;
}

However, the uint64 max_total_supply = 1 is an uint64
and this is checked overtime a marker is created
maxAllowed := sdk.NewCoin(marker.GetDenom(), sdk.NewIntFromUint64(k.GetParams(ctx).MaxTotalSupply))

  option (gogoproto.equal)            = false;
  option (gogoproto.goproto_stringer) = false;

  // maximum amount of supply to allow a marker to be created with
  uint64 max_total_supply = 1 [(gogoproto.customtype) = "uint64", (gogoproto.nullable) = false];
  // indicates if governance based controls of markers is allowed.
  bool enable_governance = 2;
  // a regular expression used to validate marker denom values from normal create requests (governance
  // requests are only subject to platform coin validation denom expression)
  string unrestricted_denom_regex = 3;
}

Hence this limit's it to max of uint64

We have had some clients ask if this supply can be extended to fit in a BigInt.
cc: @jdfigure

Proposal

We need a new param that is checked, and the old param should be deprecated.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@iramiller
Copy link
Member

The ability to represent 18 trillion tokens with 6 digit precision should be sufficient for all normal use cases. Part of the recommendation here is to not use excessive decimal precision for tokens like was done with hash (let alone something like ether).

However, this limitation is a function of the configuration parameter system only and as such can be fixed when this part of the system is refactored for the deprecation of the params module in the Cosmos SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working marker Marker Module
Projects
Development

Successfully merging a pull request may close this issue.

3 participants