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

Supporting doubles #599

Open
KeKs0r opened this issue Apr 2, 2024 · 2 comments
Open

Supporting doubles #599

KeKs0r opened this issue Apr 2, 2024 · 2 comments

Comments

@KeKs0r
Copy link

KeKs0r commented Apr 2, 2024

Hi,

I am trying to decode queries for Umee, and they apparently use the double type: https://github.com/umee-network/umee/blob/main/proto/umee/leverage/v1/query.proto#L409

But when generating code i see that the binary reader throws an error that double is not supported:

Error: double not supported

Is there a known workaround, or way to support doubles?

@pyramation
Copy link
Collaborator

pyramation commented Apr 3, 2024

hey there @KeKs0r ! Thanks for reporting. it was our understanding not to support floats, doubles, or proto2 fields.

@webmaster128 — Simon, did we misunderstand, and is double something we need? It looks like umee is using double, not sure how the encoding should output, but we can take a look at ts-proto output

ideally mayabe we can treat double similar to other fields and maybe not a big add on

@webmaster128
Copy link

As far as I can tell (and according to this resource), the JavaScript number type is a 64 bit float, i.e. can hold protobuf floats and doubles.

Floats/doubles are generally not used much in blockchains as their behaviour can be host specific and can lead to non-deterministic execution. However, there are cases like compute in a query where this is safe as long as the query result is not used by the chain itself (which happens if you allow CosmWasm contracts to do the query).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants