9935 Commits

Author SHA1 Message Date
Howard Hinnant
3f33471220 Introduce rounding modes for Number:
You can set a thread-local flag to direct Number how to round
non-exact results with the syntax:

    Number::rounding_mode prev_mode = Number::setround(Number::towards_zero);

This flag will stay in effect for this thread only until another call
to setround.  The previously set rounding mode is returned.

You can also retrieve the current rounding mode with:

    Number::rounding_mode current_mode = Number::getround();

The available rounding modes are:

* to_nearest : Rounds to nearest representable value.  On tie, rounds
               to even.
* towards_zero : Rounds towards zero.
* downward : Rounds towards negative infinity.
* upward : Rounds towards positive infinity.

The default rounding mode is to_nearest.
2023-02-07 15:43:28 -08:00
Howard Hinnant
a82ad5ba76 Use Number for IOUAmount and STAmount arithmetic
* Guarded by amendment fixUniversalNumber
* Produces slightly better accuracy in some computations.
2023-02-07 15:43:28 -08:00
Howard Hinnant
48e804c40c Add tests 2023-02-07 15:43:28 -08:00
Howard Hinnant
c9c54c9799 Add implicit conversion from STAmount to Number 2023-02-07 15:43:28 -08:00
Howard Hinnant
24fe5f9fd0 Add clip
* Return 0 if abs(x) < limit, else returns x
2023-02-07 15:43:28 -08:00
Howard Hinnant
476ee8a479 Add conversions between Number, XRPAmount and int64_t
* Conversions to Number are implicit
* Conversions away from Number are explicit and potentially lossy
* If lossy, round to nearest, and to even on tie
2023-02-07 15:43:28 -08:00
Howard Hinnant
0ee63b7c7b AMM Add Number class and associated algorithms 2023-02-07 15:43:28 -08:00
Richard Holland
2916b7e692 fix buildinfo test 2023-02-07 18:13:31 +00:00
Richard Holland
d72a597aa4 fix for https://github.com/Xahau/xahaud/issues/7 2023-02-07 16:55:38 +00:00
Richard Holland
5da990661a version string generation 2023-02-07 16:15:57 +00:00
Richard Holland
d3cc1a8798 fix validator list unit tests 2023-02-07 12:10:41 +00:00
Richard Holland
aa61e1be38 fix for https://github.com/Xahau/xahaud/issues/6 2023-02-07 09:40:47 +00:00
Richard Holland
307f9702ea fix for https://github.com/Xahau/xahaud/issues/5 2023-02-07 09:18:46 +00:00
Richard Holland
192308fb3e fix for https://github.com/Xahau/xahaud/issues/4 2023-02-07 08:52:39 +00:00
Richard Holland
0e2e674c51 clean up invariant check for IOUescrow + remove (now) unwanted testcase 2023-02-07 08:43:23 +00:00
Richard Holland
0f10f3b5c0 second fix for https://github.com/Xahau/xahaud/issues/3 2023-02-06 12:41:30 +00:00
Richard Holland
86614de00e fix admin rpc test for networkid 2023-02-06 12:16:26 +00:00
Richard Holland
b9903a822f remove networkid from test env 2023-02-06 11:11:46 +00:00
Richard Holland
584db523b4 merge fail 2023-02-06 10:50:43 +00:00
Richard Holland
14dee2d976 Merge branch 'icv2-super' into dev 2023-02-06 10:35:57 +00:00
Richard Holland
cfb8e02f16 bug fix 2023-02-06 09:17:33 +00:00
Denis Angell
43b6e89303 nit: change flag guard 2023-02-06 09:17:13 +00:00
Denis Angell
0aa2c26680 clang-format 2023-02-06 09:16:10 +00:00
Denis Angell
c848fe91d6 tests 2023-02-06 09:15:53 +00:00
Denis Angell
56d062f907 fix lint bug 2023-02-06 09:13:57 +00:00
Denis Angell
7d4b00cfcb remove comments 2023-02-06 09:12:56 +00:00
Denis Angell
66105b6c68 debug & testing 2023-02-06 09:12:38 +00:00
Denis Angell
641b8c546d [FOLD] remove comment 2023-02-06 09:12:27 +00:00
Denis Angell
8186dd960e [FOLD] invalid tests 2023-02-06 09:12:06 +00:00
Denis Angell
11bfcbf915 fix generic 2023-02-06 09:11:43 +00:00
Denis Angell
8df65be522 fix uri token flags 2023-02-06 09:09:20 +00:00
Denis Angell
9effcc3924 add testfile and cmake 2023-02-06 09:05:26 +00:00
Denis Angell
163c2b4631 clang-format 2023-02-06 09:03:11 +00:00
Denis Angell
be7ca74e46 finish tests 2023-02-06 09:01:39 +00:00
Denis Angell
448258f861 fix final dest amount 2023-02-06 09:00:34 +00:00
Denis Angell
f8591d0fd6 fix finalAmount + guard dest Issuer 2023-02-06 09:00:03 +00:00
Denis Angell
31da4bf8d4 bad currency guard 2023-02-06 08:59:47 +00:00
Denis Angell
4e6e81f5de clang-format 2023-02-06 08:59:33 +00:00
Denis Angell
b5e9325bd9 clang-format 2023-02-06 08:59:21 +00:00
Denis Angell
c7aec60cec precision paychan test 2023-02-06 08:59:08 +00:00
Denis Angell
5d6726ce07 update insuficient funds error 2023-02-06 08:58:35 +00:00
Denis Angell
ac72ef80a4 nit 2023-02-06 08:58:18 +00:00
Denis Angell
c681de1d39 nit 2023-02-06 08:58:04 +00:00
Denis Angell
b3168c7ea5 nit 2023-02-06 08:56:35 +00:00
Denis Angell
272a6c0999 todo: fix this failing test 2023-02-06 08:56:18 +00:00
Denis Angell
0133a4136e add transfer rate 2023-02-06 08:55:46 +00:00
Richard Holland
c2f99e80af uritoken bugfix, TSH for uritoken, make all txns take optional hook parameters 2023-02-03 12:53:06 +00:00
Ed Hennis
e4b17d1cf2 XRPFees: Fee setting and handling improvements (#4247)
* Introduces amendment `XRPFees`
* Convert fee voting and protocol messages to use XRPAmounts
* Includes Validations, Change transactions, the "Fees" ledger object,
  and subscription messages

* Improve handling of 0 drop reference fee with TxQ. For use with networks that do not want to require fees
* Note that fee escalation logic is still in place, which may cause the
  open ledger fee to rise if the network is busy. 0 drop transactions
  will still queue, and fee escalation can be effectively disabled by
  modifying the configuration on all nodes

* Change default network reserves to match Mainnet

* Name the new SFields *Drops (not *XRP)
* Reserve SField IDs for Hooks

* Clarify comments explaining the ttFEE transaction field validation
2023-02-02 16:20:35 -08:00
Richard Holland
fc8695f044 change debug to + to ensure version string is sane when compiled locally 2023-02-02 23:09:13 +00:00
Richard Holland
25e65f739f bug fix server_definitions 2023-02-02 23:08:33 +00:00