Commit Graph

13737 Commits

Author SHA1 Message Date
Richard Holland
46e4df0f85 fix for #19 #20 #21 #22 #23 2023-02-20 11:04:20 +00:00
Richard Holland
1dea9bcfd6 second fix for #18 and #30 2023-02-20 10:22:40 +00:00
Elliot Lee
96aab1288f README: Add a few source code starting points (#4421)
Co-authored-by: John Freeman <jfreeman08@gmail.com>
2023-02-17 22:27:27 -08:00
Richard Holland
510c69d487 fix for #18 2023-02-17 13:48:55 +00:00
Richard Holland
0cdea9d7f7 fix for #17 2023-02-17 12:41:17 +00:00
Richard Holland
aa9b03e57b fix for #16 2023-02-17 12:29:46 +00:00
Richard Holland
38c466c47d fix for #30 2023-02-17 12:17:22 +00:00
Richard Holland
5f5a947d6c additional fixes for #8 #10 and #14 2023-02-17 11:20:03 +00:00
Richard Holland
7a008c21ee enforce network ID on peer handshake 2023-02-16 13:54:36 +00:00
Richard Holland
4f44747342 enforce utf8 on uris, change behaviour of accepting own sell offer to be an tec error 2023-02-16 13:23:24 +00:00
Ed Hennis
aebf2ac990 Resolve a couple of Github Action CI annoyances: (#4413)
* Set "fail-fast: false" so that multiple jobs in one workflow can
  finish independently. By default, if one job fails, other running jobs
  will be aborted, even if the other jobs are working fine and are
  almost done. This leads to wasted time and resources if the failure
  is, for example, OS specific, or due to a flaky unit test, and the
  failed job needs to be re-run, because all the jobs end up re-running.
* Put conditions back into the windows.yml job (manual, and for
  a specific branch name and that job). This prevents Github Actions
  from sending "No jobs were run" failure emails on every commit.
2023-02-15 11:34:32 -08:00
Richard Holland
ee073c179d ensure keylet is generated correctly for uritokens 2023-02-15 13:21:58 +00:00
Richard Holland
661b6b6dd4 fix for https://github.com/Xahau/xahaud/issues/15 2023-02-14 13:47:33 +00:00
Richard Holland
8f8177b139 fix for https://github.com/Xahau/xahaud/issues/14 2023-02-14 13:15:37 +00:00
Richard Holland
31ab52d149 fix for https://github.com/Xahau/xahaud/issues/13 2023-02-14 12:42:10 +00:00
Richard Holland
9ccb9d366d fix for https://github.com/Xahau/xahaud/issues/11 2023-02-14 11:37:02 +00:00
Richard Holland
06d3270e3e fix for https://github.com/Xahau/xahaud/issues/10 2023-02-14 11:21:32 +00:00
Richard Holland
0feaec0d7e fix for https://github.com/Xahau/xahaud/issues/8 2023-02-14 11:09:02 +00:00
Richard Holland
d6c699f734 rename CTIM to CTID 2023-02-14 08:47:20 +00:00
ledhed2222
ac78b7a9a7 Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (#4419) 2023-02-13 15:52:40 -08:00
Denis Angell
b72a87c7d3 Only account specified as destination can settle through brokerage: (#4399)
Without this amendment, for NFTs using broker mode, if the sell offer contains a destination and that destination is the buyer account, anyone can broker the transaction. Also, if a buy offer contains a destination and that destination is the seller account, anyone can broker the transaction. This is not ideal and is misleading.

Instead, with this amendment: If you set a destination, that destination needs to be the account settling the transaction. So, the broker must be the destination if they want to settle. If the buyer is the destination, then the buyer must accept the sell offer, as you cannot broker your own offers.

If users want their offers open to the public, then they should not set a destination. On the other hand, if users want to limit who can settle the offers, then they would set a destination.

Unit tests:

1. The broker cannot broker a destination offer to the buyer and the buyer must accept the sell offer. (0 transfer)
2. If the broker is the destination, the broker will take the difference. (broker mode)
2023-02-13 15:52:39 -08:00
Scott Schurr
39c32561bd Prevent brokered sale of NFToken to owner: (#4403)
Fixes #4374

It was possible for a broker to combine a sell and a buy offer from an account that already owns an NFT. Such brokering extracts money from the NFT owner and provides no benefit in return.

With this amendment, the code detects when a broker is returning an NFToken to its initial owner and prohibits the transaction. This forbids a broker from selling an NFToken to the account that already owns the token. This fixes a bug in the original implementation of XLS-20.

Thanks to @nixer89 for suggesting this fix.
2023-02-13 15:52:39 -08:00
ledhed2222
89aa8b21ec Fix 3 issues around NFToken offer acceptance (#4380)
Fixes 3 issues:

In the following scenario, an account cannot perform NFTokenAcceptOffer even though it should be allowed to:

- BROKER has < S
- ALICE offers to sell token for S
- BOB offers to buy token for > S
- BROKER tries to bridge the two offers

This currently results in `tecINSUFFICIENT_FUNDS`, but should not because BROKER is not spending any funds in this transaction, beyond the transaction fee.

When trading an NFT using IOUs, and when the issuer of the IOU has any non-zero value set for TransferFee on their account via AccountSet (not a TransferFee on the NFT), and when the sale amount is equal to the total balance of that IOU that the buyer has, the resulting balance for the issuer of the IOU will become positive. This means that the buyer of the NFT was supposed to have caused a certain amount of IOU to be burned. That amount was unable to be burned because the buyer couldn't cover it. This results in the buyer owing this amount back to the issuer. In a real world scenario, this is appropriate and can be settled off-chain.

Currency issuers could not make offers for NFTs using their own currency, receiving `tecINSUFFICIENT_FUNDS` if they tried to do so.

With this fix, they are now able to buy/sell NFTs using their own currency.
2023-02-13 15:52:39 -08:00
Shawn Xie
a828e24cf0 Allow NFT to be burned when number of offers is greater than 500 (#4346)
* Allow offers to be removable
* Delete sell offers first

Signed-off-by: Shawn Xie <shawnxie920@gmail.com>
2023-02-13 15:52:38 -08:00
ledhed2222
f7a8d2de84 Add fixUnburnableNFToken feature (#4391) 2023-02-13 15:52:38 -08:00
Richard Holland
0aa3b2ed74 fix txn hash lookup from index 2023-02-13 13:41:18 +00:00
Richard Holland
c9b4977d93 preliminary support for xls37 (Improved Concise Transaction Identifier) 2023-02-13 13:18:00 +00:00
Richard Holland
daacb45613 add CTIM to tx rpc 2023-02-10 15:53:49 +00:00
Howard Hinnant
32559463ef Change default vote on fixUniversalNumber from yes to no (#4414) 2023-02-09 21:01:48 -08:00
Richard Holland
2216c62fbc Merge branch 'dev' of github.com:Xahau/xahaud into dev 2023-02-09 16:59:25 +00:00
Richard Holland
750dbfc364 capitalization fix for server_definitions with URIToken 2023-02-09 16:59:16 +00:00
Wietse Wind
68bf9f264f Publish binary 2023-02-09 16:12:28 +01:00
Wietse Wind
c625309733 Build container: map /data/builds 2023-02-09 15:14:59 +01:00
Wietse Wind
ae0335a308 Conditionally copy to /data/builds 2023-02-09 14:55:47 +01:00
Wietse Wind
7a5d4d1977 Publish builds locally, to: http://build.xahau.tech 2023-02-09 14:51:37 +01:00
Wietse Wind
c33f5b46a8 zipzip - zip 2023-02-09 14:49:34 +01:00
Richard Holland
12d9d399a9 fix uritoken sell bug 2023-02-09 13:27:38 +00:00
Richard Holland
a11905c43a Merge branch 'dev' of github.com:Xahau/xahaud into dev 2023-02-09 12:35:55 +00:00
Richard Holland
348bfe5ede prevent version string clobbering by build engine 2023-02-09 12:35:45 +00:00
Wietse Wind
7fee0eb171 Fixes zip-zip 2023-02-09 13:29:46 +01:00
Richard Holland
69327445e9 rework URIToken amendment to use 5 different explicit transactors rather than inferred operations 2023-02-09 11:38:19 +00:00
Ed Hennis
8f514937a4 Update documented pathfinding configuration defaults: (#4409)
* Add recommended values for node which want to support "advanced"
  pathfinding, which is effectively the old default behavior.
2023-02-08 12:14:09 -08:00
John Freeman
36b34a7bd5 Update dependency: grpc (#4407) 2023-02-07 15:46:38 -08:00
Howard Hinnant
5edaec2bd0 Introduce min/max observers for Number
Three static member functions are introduced with
definitions consistent with std::numeric_limits:

static constexpr Number min() noexcept;

  Returns: The minimum positive value.  This is the value closest to zero.

static constexpr Number max() noexcept;

  Returns: The maximum possible value.

static constexpr Number lowest() noexcept;

  Returns: The negative value which is less than all other values.
2023-02-07 15:43:28 -08:00
Howard Hinnant
2f1f453052 Optimize uint128_t division by 10 within Number.cpp
* Optimization includes computing remainder from division.
* Used only within Number::operator*=.
2023-02-07 15:43:28 -08:00
Howard Hinnant
6eaaa7bcfa Replace Number division algorithm
* Replace division with faster algorithm.
* Correct some rounding bugs in multiplication.
* Add tests for rounding bugs.
2023-02-07 15:43:28 -08:00
Howard Hinnant
e354497f63 Include rounding mode in XRPAmount to STAmount conversion. 2023-02-07 15:43:28 -08:00
Howard Hinnant
6fcd654bee Remove undefined behavior
* Taking the negative of a signed negative is UB, but
  taking the negative of an unsigned is not.
2023-02-07 15:43:28 -08:00
Howard Hinnant
d275a2ab72 Silence warnings 2023-02-07 15:43:28 -08:00
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