-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Update Client UX to Support Denom Conversion #3510
Comments
cc @cosmos/cosmos-ui |
can you guys provide some context? |
What are the exact actionable items here? |
What needs to get added for CLI support here? |
can someone explain what |
|
@jbibla |
Proposal: |
Hmm, maybe, but I worry this would just make client implementation more difficult, since clients would now need to implement fixed-precision decimals instead of just integers. |
I think that is completely valid. Any finance app shows you fixed-precision decimals. I suppose they don't transmit values in |
Are you sure? I don't think this is standard practice at least in the blockchain client world - Ethereum, Bitcoin et al. all use whole integers. |
Yeah based on conversations with @jaekwon - to keep things simple for clients which interface with many cryptocurrencies (such as exchanges) we wanted to maintain standardization with the rest of the crypto ecosystem... which uses integers for the smallest denom. Not to mention unnecessary complexity of standardization of prefixes as this turns into a multi-token system... Clients interfacing using decimals really doesn't make any sense to me the more I consider its implications. Also let's not try to take traditional financial systems as any kind of standard to look up to hahaha |
they had years of harding there systems. why shouldn't we learn from them?
use case: we change the conversion of use case: different tokens might have different precisions. now a client always needs to query the precision of a token to identify what it means. sending values as decimals (really just the transportation layer) just fuses the integer representation with the internal precision. any client will then transform this representation back into integer and precision to work in it. as a rule of thumb: don't push logic onto a client if you can avoid it. the implementation of such logic needs to be implemented in all clients, multiplicating the effort to implement. |
Imho, clients will have these fixed as static values somewhere. The Ethereum But as for the other points, a bulk of the Ethereum clients I use (Dai CDPs, MEW, etc...) all have entry for ETH, not WEI. I imagine they do the conversions. |
Lunamint was also saying that they prefer |
After some discussion, we are okay with either one. We just need a standardized value to prevent confusion between |
So from the talks we've had internally, the cosmos SDK will accept WRT to namespacing, I believe the SDK will have to have a hard-coded list of denom matching for now. Eventually, we'll want a denom registry on chain. |
👍 to the denom registry on chain for the long run. Right now I think we could hard code in the option of accepting seems like it's going to be a huge hack job on the sdk side to have everything returned as |
Any client needs to do the conversion. This means the complexity of conversion multiplies. If we move this into the serving API, no client needs to do the conversion and we only implement this conversion once. |
@faboweb we are all in agreement here -- the REST API will accept |
are we? With what I'm suggesting the client would still be required to do the conversion from |
@rigelrozanski precisely. Im saying the REST client will do the conversion to and from. |
@alexanderbez well I'm saying it's going to be hacky to do the conversion to atoms in all the clients - we're going to need to manually changing all sorts of query result types like there are structs which just store "tokens" as an sdk.Int for instance in |
So I am building a POC on top of Cosmos-SDK and have the following to share: Token resolution problem was the first serious issue I ran into. Since in general tokens are based on integer arithmetic, tokens are non-divisible and hence to use them in numerous cases (let's say an account receiving 1e-8 of a token) you need to increase the token resolution to 1e9 or better to 1e12, which in turn allows you to retain more resolution. This means that the actual 1 token such as Atom should be 1e12 in the above example. I don't know the internals of Sia Coin, but their denom is Sia which is 1e+24 of a Hashlet (their lowest res denom). I presume the implementation was done this way to allow small fractions of Sia to be distributed to accounts as a part of the contract/taxation logic, or rather when it handles small amounts. FWIW, I would suggest that resolution-based denoms are not handled internally within the chain logic/infrastructure. I agree with statements that you would be pushing client complexity onto the infrastructure which has to be as generic as possible. However, while not being a part of the chain processing logic, SDK is a perfect place for providing ways of handling denoms with different resolutions (in a form of a small set of utility functions and if needed a registry). Hence, I would suggest that:
Client apps of the SDK as well as CLI utils etc., can all use these functions at a client level, pre-processing user input before sending it to SDK and formatting SDK output as needed. I also think this is where my suggestion for the support of scientific notation could go - (#3662) IMHO it would make sense to have a utility module in the SDK (or perhaps maintain this under
In the above example:
|
I think with #3747 we can go ahead and start modifying some of the client flows. |
Sounds like this has been done. |
Figure out how best to represent this in the CLI.
cc @sunnya97 @jaekwon
The text was updated successfully, but these errors were encountered: