Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

bug: sorting hex #163

Open
pmespresso opened this issue Feb 11, 2020 · 2 comments
Open

bug: sorting hex #163

pmespresso opened this issue Feb 11, 2020 · 2 comments
Labels
F2-bug 🐜 question Further information is requested
Milestone

Comments

@pmespresso
Copy link
Contributor

Currently storing BigNumbers as hexadecimal as prisma can only handle up to 53 bit integers, but the thing is that we cannot sort hexadecimals (i don't think?).

Maybe there is a way, but we certainly won't get anything reliable 'order_by' on these.

Not sure yet how to fix...

@pmespresso pmespresso added question Further information is requested F2-bug 🐜 labels Feb 11, 2020
@amaury1093
Copy link
Contributor

amaury1093 commented Feb 12, 2020

but the thing is that we cannot sort hexadecimals (i don't think?)

yeah, unless we write a SCALE-encoded compact integer converter as a psql plugin, i don't think we can sort. psql also allows you to create your own data types, but I'm not sure if prisma exposes that.

postgresql handles up to u64, so if the runtime exposes u128 (like the current balance), then for lossless storage, our only way is to store hex strings/binary.

we could for now store them as u64 though, and wait for the day it breaks (which could happen in 5 months or 5 years or 50 years), but i'm willing to try that. Edit: no, prisma doesn't allow it

@pmespresso
Copy link
Contributor Author

yeah, unless we write a SCALE-encoded compact integer converter as a psql plugin

have you done this before (do you think this would be realistic for us to do)?

@pmespresso pmespresso added this to the v1.0-alpha milestone Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐜 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants