-
Notifications
You must be signed in to change notification settings - Fork 60
Not handling big numbers (>2^64) correctly) #87
Comments
This is just one of the many reasons you should be signing your own transactions. You're trusting the server to form the correct amounts and generate the actual underlying transaction. If you feed garbage in, you will not only get garbage out, but you will get signed garbage! The issue is not big amounts but illegal amounts. "99999999999999999999999999999999" is an illegal amount. Not because it is too large, but because it has too much precision. |
Thanks @JoelKatz for the info. Then the next thing here is if we want to add a warning in stellard when someone tries to create a transaction with an illegal amount or do we just expect the user to know what the legal limit is. One thing that still remains though is that stellard should show all the significant digits of a number instead of shortening it into something like |
Amending my previous comment after understanding more about rippled/stellard: Stellard represents my large amount as 1844674407370955e4 because it is actually 18446744073709550000 (and not 18446744073709551615). There was too much precision and therefore 1615 credits were lost due to stellard flooring it. I recently did a test and found that stellard floors truncates the lost precision amounts. Here are my test results (sending and receive a credit, showing full precision given by stellard).
The lost precision isn't hidden but is rather "burned". This is actually more of a protocol issue than a rippled/stellard issue although rippled/stellard are opaque in how amounts are handled. |
@irisli If you're going to form transactions, you need to understand the rules for forming valid transactions. The "user" in this context is the software that's forming and signing transactions -- it has to understand the serialization format. If it can produce data that's not in canonical form, the signature isn't going to be valid. |
I played around with stellard and found out a few things:
".00000000000000000000000000000001"
(10^-31). Anything smaller (more digits) doesn't work. I havent found any problems associated with this (other than a stellar-client related one)."99999999999999999999999999999999"
. Anything bigger than this doesn't work.Sending big amounts
If you try to send a large amount of the currency (such as
99999999999999999999999999999999
), it becomes shortened to 1844674407370955e4 (2^64).Not showing all the numbers
First problem is that stellard truncates the last few digits and doesn't show the exact amount. If you send
99999999999999999999999999999999
, it becomes1844674407370955e4
(2^64) (emphasis on the e4).Accepting a bigger range than it supports
If you send a large amount such as
99999999999999999999999999999999
, it gets reduced to1844674407370955e4
.Example:
Possible overflow
Where might have the rest of the
99999999999999999999999999999999
have went?It might have overflowed to the issuer part of the amount triplet. Note that the address is shorter than a normal address. It doesn't look like an attack could be possible because of this.
This triplet shows up if you look at the transaction information. Here is the full verbose output on how to find this:
The text was updated successfully, but these errors were encountered: