Fix any precision issues caused by the usage of double (arithmetic)
Scenario:
The XBridge protocol currently uses a mix of (float), double, int64_t and uint64_t and as such we are seeing precision issues eg when partial orders are created (ref: https://github.com/blocknetdx/blocknet/issues/570)
Proposed solution:
Replace all uses of (float), double, int64_t and uint64_t with a 'signed integer' type with 256 bits for all amounts (int256_t), enabling XBridge support for tokens with 18 decimal places (being similar to what ETH uses (uint256)). Further, using a signed type, as opposed to unsigned, would also prevent underflows in the event of a negative amount that results from a calculation.
To do:
- [ ] remove/fix any precision issues caused by the usage of double (arithmetic) and replace with
int256_tthroughout the XBridge code
QA and Acceptance info to follow...
@shrnkld LGTM
WIP and ideas: step 1: replace all uint64_t with int64_t and test. ~~step 2: replace all float with double and test calculations and performance (increasing precision points for erc20 support)~~ cannot find any instances of float related to xbridge in the src. step 3:replace all int64_t with int256_t and retest