Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"book_offers" and "ripple_path_find" return no result for 3 letter currencies with a lower case letter (Version: 1.8.5) #4112

Closed
nixer89 opened this issue Mar 2, 2022 · 19 comments · Fixed by #4566
Assignees
Labels
Bug Documentation README changes, code comments, etc. Testable

Comments

@nixer89
Copy link
Collaborator

nixer89 commented Mar 2, 2022

Issue Description

The rippled method to get existing offers ("book_offers") does not return any offers for tokens with a 3 letter currency code where, at least, one letter is lower case.
This does NOT affect currencies where all letters are capital or the currency code is > 3 letters (HEX code)

Steps to Reproduce

You can simply reproduce this behavior by calling the "book_offers" method with one of the following tokens in the "TakerGets" field:

Example 1:
Issuer: rGbNLwrYNuPim39crh1bjyyauefF1VHPoj
Currency: xSD
Current DEX offers: 97

Example 2:
Issuer: raZ87rZoVjgg8oc5LijSigyN8rbutXGdbw
Currency: Lil
Current DEX offers: 10

Example 3:
Issuer: rJXesdkxGHDtzTEgxxbo7h9C1WyVr8NNgw
Currency: Vtc
Current DEX offers: 3

Expected Result

Rippled should return the offers for these tokens when calling the "book_offers" method.

Actual Result

Calling the "book_offers" method results in an empty response:

 {
   "result" : {
      "ledger_current_index" : 70037039,
      "offers" : [],
      "status" : "success",
      "validated" : false
   }
}

Environment

I am using Ubuntu 20.04 with rippled 1.8.5

@nixer89 nixer89 changed the title [book_offers returns no result for 3 letter currencies with a lowser case letter] (Version: [1.8.5]) book_offers returns no result for 3 letter currencies with a lowser case letter (Version: 1.8.5) Mar 2, 2022
@Mwni
Copy link

Mwni commented Mar 2, 2022

can confirm.

rippled json ledger_entry '{"index": "7529200710EDE8B8ECEBED45D52D5279F5E22632FDA3E94770DF1F1A4EE99592", "ledger_index": "validated"}'

returns the offer object

rippled book_offers 'Vtc/rJXesdkxGHDtzTEgxxbo7h9C1WyVr8NNgw' 'XRP'

returns empty list

@nixer89 nixer89 changed the title book_offers returns no result for 3 letter currencies with a lowser case letter (Version: 1.8.5) book_offers returns no result for 3 letter currencies with a lower case letter (Version: 1.8.5) Mar 2, 2022
@ximinez
Copy link
Collaborator

ximinez commented Mar 2, 2022

Tokens / issued currencies are case sensitive. This is working as intended. https://xrpl.org/currency-formats.html#issued-currency-amounts

Update: #4112 (comment)

@ximinez ximinez closed this as completed Mar 2, 2022
@Mwni
Copy link

Mwni commented Mar 2, 2022

In which book can the offer then be found? Because it's not in Vtc/rJXesdkxGHDtzTEgxxbo7h9C1WyVr8NNgw - XRP and the currency's code is Vtc.

@nixer89
Copy link
Collaborator Author

nixer89 commented Mar 2, 2022

Yes, currency codes are case sensitive.

But I have to disagree to close the ticket.

I stated clearly that issued tokens with (at least) 1 lower case letter (because case sensitive) have no return value on the "book_offers" command.

The issued token is "xSD" (lower 'x', capital 'S' and 'D')

So using 'xSD' with the "book_offers" command does NOT return any result, even though there are more than enough offers.

This is clearly a bug of the "book_offers" command.

Here is an example of the book_offers command for the currency "xSD" and an existing offer which should have been returned in the book_offers command, but didn't:

image

@ximinez
Copy link
Collaborator

ximinez commented Mar 2, 2022

Reopening this ticket. I misunderstood the issue.

To clarify, there are tokens issued with mixed-case three-letter IDs. There are offers on the books for these tokens. The apparent bug is that requesting book_offers for these tokens returns no results.

@ximinez ximinez reopened this Mar 2, 2022
@ximinez
Copy link
Collaborator

ximinez commented Mar 2, 2022

A general request: Instead of or in addition to posting screenshots, please please please copy and paste the text into a code block, and include both the request and the response.

@ximinez
Copy link
Collaborator

ximinez commented Mar 2, 2022

Preliminary analysis:

  1. The command-line currency code parser expects only three letter currency codes: https://github.com/ripple/rippled/blob/develop/src/ripple/net/impl/RPCCall.cpp#L124
  2. The to_currency function, which converts three letter string currency codes to the binary form, transforms the code to all upper case before parsing it: https://github.com/ripple/rippled/blob/develop/src/ripple/protocol/impl/UintTypes.cpp#L96-L103
  3. The to_string(Currency) function only checks the currency code against a mask. It does not check that the code is all upper case: https://github.com/ripple/rippled/blob/develop/src/ripple/protocol/impl/UintTypes.cpp#L58-61

I strongly suspect that the transaction from the Issuer that originally "minted" the coins was submitted either as a binary blob or as JSON with the currency code in hex form. (e.g. 0000000000000000000000007853440000000000 instead of xSD.) Maybe a transaction generation / signing library is not changing the codes to upper case.

Workaround:

On the command line use json book_offers. On all interfaces, specify the currency code as hex.

$ rippled -q json book_offers '{ "taker_gets": { "currency": "XRP"}, "taker_pays":{ "currency": "0000000000000000000000007853440000000000", "issuer": "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj" }, "limit": 1 }'                        {
   "result" : {
      "ledger_current_index" : 70043768,
      "offers" : [
         {
            "Account" : "rwwhhgHnE3Fkxsn7jTjKLn1vB1ZfkJ2nSj",
            "BookDirectory" : "F0D9A4E5630EB2399BEB08EF1A88AC7497C3C3D0FCF3AAB158038D7EA4C68000",
            "BookNode" : "0",
            "Flags" : 131072,
            "LedgerEntryType" : "Offer",
            "OwnerNode" : "d",
            "PreviousTxnID" : "C0365738014A23E99944D77B835229D028F0802C07AB577A6E85573ABA0DBC93",
            "PreviousTxnLgrSeq" : 70025103,
            "Sequence" : 67477579,
            "TakerGets" : "2998350",
            "TakerPays" : {
               "currency" : "xSD",
               "issuer" : "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj",
               "value" : "2998350000"
            },
            "index" : "3D37F39FA6D4716AC2F9BCD455F120228300443E12E240B491458A2BD678CE28",
            "owner_funds" : "13243166",
            "quality" : "1000"
         }
      ],
      "status" : "success",
      "validated" : false
   }
}

Solution:

I have not found conclusive documentation, but I believe that the original designers of the XRPL did not intend to allow for three letter currencies with lower-case letters. I think that they assumed that input would be checked such that it would be difficult to create one, and thus didn't check the output side for upper-case values. Thus, I think the solution is to modify the to_string(Currency) to only show the three letter code if it's all upper-case, otherwise display the code as hex.

I could, of course, be wrong.

@nixer89
Copy link
Collaborator Author

nixer89 commented Mar 3, 2022

Thank you @ximinez for the first analysis.

you wrote:

I strongly suspect that the transaction from the Issuer that originally "minted" the coins was submitted either as a binary blob
or as JSON with the currency code in hex form. (e.g. 0000000000000000000000007853440000000000 instead of xSD.)
Maybe a transaction generation / signing library is not changing the codes to upper case.

I think the token was issued using a JSON structure and using the actual currency code as "xSD". (through my "Token Creator" service, which allows lower case letters)

Here is the issuing transaction for "xSD":

https://livenet.xrpl.org/transactions/ACFF1E845922465E14E232DA57521B76C7A495591107E17571D688D5B2403AAC/raw

based on this documentation:
https://xrpl.org/currency-formats.html#standard-currency-codes

for 3 letter currency codes ("standard currency codes"), the following rule does apply:

Currency codes must be exactly 3 ASCII characters in length. The following characters are permitted: all uppercase and
lowercase letters, digits, as well as the symbols ?, !, @, #, $, %, ^, &, *, <, >, (, ), {, }, [, ], and |.

So lower case letters are allowed too.
And I am not aware of any other problems with tokens including a lower case letter, except with the "book_offers" command.

And the "book_offers" method does not only return NO result via command line, but also via websocket call.

As example:

{
  "command": "book_offers",
  "taker_gets": {
    "currency": "xSD",
    "issuer": "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj"
  },
  "taker_pays": {
    "currency": "XRP"
  },
  "limit": 10
}

So the "problem" does not exists exclusively through the command line interface.

And while we are on it: I tried to find other methods where you use a currency code as "input" parameter.
Another example is the "ripple_path_find" method.

Issuing the following JSON command via websocket:

{
  "command": "ripple_path_find",
  "source_account": "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
  "source_currencies": [
    {
      "currency": "xSD"
    }
  ],
  "destination_account": "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
  "destination_amount": "-1"
}

returns the following result:

{
	alternatives: []
	destination_account: "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
	destination_amount: "-1",
	destination_currencies: [
		"434F524500000000000000000000000000000000",
		"CX1",
		"xSD",
		"ELS",
		"476F6C64534543436F696E316564000000000000",
		"53454357617272696F72436C7562000000000000",
		"ATH",
		"XRP",
		"534F4C4F00000000000000000000000000000000",
		"WTF",
		"4E657269616E0000000000000000000000000000"
	]
	full_reply: true,
	source_account: "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
	status: "success"
}

It does NOT return any possible paths (but there are plenty of offers)

And using "xSD" encoded as hex in the request like this:

{
  "command": "ripple_path_find",
  "source_account": "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
  "source_currencies": [
    {
      "currency": "0000000000000000000000007853440000000000"
    }
  ],
  "destination_account": "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
  "destination_amount": "-1"
}

Does return an actual result (paths):

{
	alternatives: [
		{
			destination_amount: "2156543",
			paths_canonical: []
			paths_computed: [
				[
					{
						account: "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj",
						type: 1
					}
					{
						currency: "XRP",
						type: 16
					}
				]
			]
			source_amount: {
				currency: "xSD",
				issuer: "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
				value: "2156542207.423284"
			}
		}
	]
	destination_account: "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
	destination_amount: "-1",
	destination_currencies: [
		"434F524500000000000000000000000000000000",
		"CX1",
		"xSD",
		"ELS",
		"476F6C64534543436F696E316564000000000000",
		"53454357617272696F72436C7562000000000000",
		"ATH",
		"XRP",
		"534F4C4F00000000000000000000000000000000",
		"WTF",
		"4E657269616E0000000000000000000000000000"
	]
	full_reply: true,
	source_account: "rH9dpxicuSAMt8nQMYH1cx3NsUg5MvwsJF",
	status: "success"
} 

So this seems to be another method not working properly with lower case letters in a 3 letter currency code.

"book_offers" and "ripple_path_find" (and possibly "path_find"?) are the only methods not handling tokens with lower case letters properly. All other methods seems to work fine and do return the currency code in proper upper and lower case.

@nixer89 nixer89 changed the title book_offers returns no result for 3 letter currencies with a lower case letter (Version: 1.8.5) "book_offers" and "ripple_path_find" return no result for 3 letter currencies with a lower case letter (Version: 1.8.5) Mar 3, 2022
@ximinez
Copy link
Collaborator

ximinez commented Mar 3, 2022

Thank you @ximinez for the first analysis.

My pleasure.

I think the token was issued using a JSON structure and using the actual currency code as "xSD". (through my "Token Creator" service, which allows lower case letters)

Right, so I assume the JSON was not submitted directly to rippled. I assume the "Token Creator" took the "xSD" string, encoded it into the transaction, signed it and returned the blob or submitted the blob to rippled. Serialization bypasses the upper-case conversion that I pointed out above

To demonstrate what I mean, I took the transaction you linked to, stripped out the memos for simplicity, and signed it locally using rippled:

$ cat lowercase.txt
{
  "Account": "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj",
  "Amount": {
    "currency": "xSD",
    "issuer": "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj",
    "value": "23000000000"
  },
  "Destination": "rGxTL4RgJeJcN3SySxAQMnMnWXDEELjMfk",
  "Fee": "2508",
  "Flags": 2147614720,
  "LastLedgerSequence": 69077356,
  "Sequence": 68941944,
  "TransactionType": "Payment"
}

$ rippled -q sign secret "$(cat lowercase.txt)" offline
{
   "result" : {
      "deprecated" : "This command has been deprecated and will be removed in a future version of the server. Please migrate to a standalone signing tool.",
      "status" : "success",
      "tx_blob" : "120000228002000024041BF878201B041E096C61D7082BD67AFBC0000000000000000000000000005853440000000000AB0328314528B88BEDBC7EED6FA409264AEE26236840000000000009CC732102E823276AD8EF64B749670068C56BC884728EB7B97FAB58216F10CD870E00925C74473045022100A87993AC04BDAF828E4A9073694E2D67F93667735635036CE85F4AE701E508F90220034B7226D78E5A0785A3B333AB648A73C67D479CDE6D072D6236DF0EBC134CE08114AB0328314528B88BEDBC7EED6FA409264AEE26238314AF06BF442AAB014D14CBC488CA8AEFAA77FE8B97",
      "tx_json" : {
         "Account" : "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj",
         "Amount" : {
            "currency" : "XSD",
            "issuer" : "rGbNLwrYNuPim39crh1bjyyauefF1VHPoj",
            "value" : "23000000000"
         },
         "Destination" : "rGxTL4RgJeJcN3SySxAQMnMnWXDEELjMfk",
         "Fee" : "2508",
         "Flags" : 2147614720,
         "LastLedgerSequence" : 69077356,
         "Sequence" : 68941944,
         "SigningPubKey" : "02E823276AD8EF64B749670068C56BC884728EB7B97FAB58216F10CD870E00925C",
         "TransactionType" : "Payment",
         "TxnSignature" : "3045022100A87993AC04BDAF828E4A9073694E2D67F93667735635036CE85F4AE701E508F90220034B7226D78E5A0785A3B333AB648A73C67D479CDE6D072D6236DF0EBC134CE0",
         "hash" : "A4D4D1DC2FDE29C6A5BCE77DB536C43E02D1B108330DE8EBAABA1C39CF8EB160"
      }
   }
}

Notice that the currency code returned is all upper-case - XSD - because rippled converted it in that same to_currency function I linked to above. Also notice that the serialized blob contains 000000000000000000000000005853440000000000, which is the serialized currency code. The 585344 in the middle are the base 16 ASCII values of the upper-case letters.

What this indicates to me is that rippled takes any three-letter currency code that it sees (via command line, RPC, etc.) and deliberately converts it to upper case.

Here is the issuing transaction for "xSD":

https://livenet.xrpl.org/transactions/ACFF1E845922465E14E232DA57521B76C7A495591107E17571D688D5B2403AAC/raw

The problem with this example is that is probably showing the same display discrepancy that affects ledger_entry and any other commands that display currency codes.

based on this documentation: https://xrpl.org/currency-formats.html#standard-currency-codes

for 3 letter currency codes ("standard currency codes"), the following rule does apply:

Currency codes must be exactly 3 ASCII characters in length. The following characters are permitted: all uppercase and
lowercase letters, digits, as well as the symbols ?, !, @, #, $, %, ^, &, *, <, >, (, ), {, }, [, ], and |.

So lower case letters are allowed too. And I am not aware of any other problems with tokens including a lower case letter, except with the "book_offers" command.

Yes, the question is: Which is correct: rippled or the documentation? For code this old (the logic was introduced 8 years ago), where the documentation was probably written later, it might be rippled.

That's not to say we can't decide to change rippled to match the docs, but that is not a step to be taken lightly, since there's no telling how much existing code relies on the current behavior.

And the "book_offers" method does not only return NO result via command line, but also via websocket call.

Yes, I should have been more clear about that. rippled converts any three letter currency code in any JSON to upper-case, regardless of where it came from. The command-line client simply converts the parameters into an appropriate JSON representation before submitting to the rippled RPC server.

So this seems to be another method not working properly with lower case letters in a 3 letter currency code.

Exactly. I would expect that all methods convert the 3 letter codes to upper-case.

"book_offers" and "ripple_path_find" (and possibly "path_find"?) are the only methods not handling tokens with lower case letters properly. All other methods seems to work fine and do return the currency code in proper upper and lower case.

I can't find any methods that don't do this conversion. Could you provide an example?

@NetScr1be
Copy link

Not to take away from the great work done on this so far BUT, there seems to be another case worth considering;

All upper-case but six characters including a symbol.

Issuer Account XUMM KYC Accountname Token Currency Code Total Supply Number of TrustLines Number of Holders Current Dex Offers
r6BEe9QVrqwhuBdqsy6pBkfKqb5nrdaUa check_circle $GHOST 100000000000 18437 2 6

@mDuo13
Copy link
Collaborator

mDuo13 commented Mar 4, 2022

@NetScr1be The case you are referring is not relevant to this issue. Anything other than the Standard Currency Code is only possible if something other than the rippled APIs are encoding and decoding it from binary. This issue is describing issues with the way the rippled APIs encode and decode "Standard Currency Codes" which are always exactly 3 characters.

@NetScr1be
Copy link

Does that mean the fix for this issue might orphan non-compliant currencies (even though it allowed their creation)?

I realize I'm not a developer but we have to interpret these situations for our clients and, so far, looking into it only creates more confusion.

For example;

Searching for 'xSD' on https://xrpl.services/tokens returns both 'XSD' and 'xSD'. There is no hexadecimal currency code at all when looking at the details.

The same with 'mXm' the support ticket for which triggered this iteration of this issue.

Searching for $Ghost returns;

Currency: $GHOST
Currency (HEX-Code): 2447484F53540000000000000000000000000000

$Ghost seems to comply with specification for Non-standard currency codes

You can also use a 160-bit (40-character) hexadecimal string such as 015841551A748AD2C1F76FF6ECB0CCCD00000000 as the currency code. To prevent this from being treated as a "standard" currency code, the first 8 bits MUST NOT be 0x00.

@WietseWind
Copy link
Member

WietseWind commented Mar 9, 2022

@NetScr1be Your example, $GHOST, is perfectly compliant providing it's not how it's stored on the XRPL: it's the text representation of the underlying XRPL value (HEX code) you are referring to. This means the client that created it converted text to HEX, and the XRPL was presented only the HEX. When querying XRPL nodes, this also has to be done with that same HEX value, which works just fine.

This issue is only related to 3 char (non HEX) currency codes, containing one or more lowercase characters.

@ximinez
Copy link
Collaborator

ximinez commented Mar 15, 2022

Does that mean the fix for this issue might orphan non-compliant currencies (even though it allowed their creation)?

Nothing will be orphaned. The transactions and ledger objects will still be on the ledger. The consequence will be that any non-compliant currencies will need to use their full hex code instead of the three letter version.

I realize I'm not a developer but we have to interpret these situations for our clients and, so far, looking into it only creates more confusion.

Bugs suck. Bugs that people start using as if they're "correct" behavior suck worse. (I'm not trying to be dismissive here. My point is that sometimes you just have to rip off the bandaid and deal with the consequences.)

Searching for 'xSD' on https://xrpl.services/tokens returns both 'XSD' and 'xSD'. There is no hexadecimal currency code at all when looking at the details.

xrpl.services is a 3rd party service, AFAIK, and I have no idea how it's interfacing with the rippled API, or interpreting the data from it.

@nixer89
Copy link
Collaborator Author

nixer89 commented Mar 16, 2022

xrpl.services is a 3rd party service, AFAIK, and I have no idea how it's interfacing with the rippled API, or interpreting the data from it.

That is interesting. xrpl.services is actually built by me and what I do is to scan a full ledger, using the ledger_data method and iterating through the markers. (directly connected to rippled via admin port)
Example request:

{
    command: "ledger_data",
    limit: 100000,
    binary: false
 }

I use "binary":false to get the plain JSON objects.

I filter for all RippleState objects and collect information about issued currencies. To determine the currency code, I simple access the RippleState object's "Balance" field and then the "currency" field.

And for "xSD", the currency field actually contains "xSD" in the JSON response and not a HEX encoded currency code (and neither an upper case 3 letter code).

I do not execute any conversion of currency codes in my API code and here is the result for "xSD":

image

And here is an example where rippled actually returns a HEX encoded currency code: (currency code > 3 letters)

image

so, while rippled seems to run every "input´" currency code through the "toUpperCase" function (if submitted via JSON and not blob), it does not run the currency code through a "toUpperCase" function when providing currency data.

This behavior and the text in the documentation give the impression that for 3 letter currency codes, lower and upper case letters are allowed. I can submit a transaction, issuing a 3 letter currency with lower case letters. And I can query that very same transaction (Payment) and the underlying Trustline (RippleState) and the currency code is also provided in lower case.

So there was no way to see as a developer/user that lower case letters in 3 letter currency codes should not be used.

@ximinez
Copy link
Collaborator

ximinez commented Mar 16, 2022

That is interesting. xrpl.services is actually built by me and what I do is to scan a full ledger, using the ledger_data method and iterating through the markers. (directly connected to rippled via admin port) Example request:

Thank you for the great work!

so, while rippled seems to run every "input´" currency code through the "toUpperCase" function (if submitted via JSON and not blob), it does not run the currency code through a "toUpperCase" function when providing currency data.

This is, unfortunately, true. I got into more detail about that above.

I can submit a transaction, issuing a 3 letter currency with lower case letters.

Can you though? Everything I've seen so far indicates that if you submit the transaction as JSON with a 3-letter code including lower case letters, the code will be converted to upper case before the transaction is signed. Of course, signing is disabled on most servers now, particularly the public-facing ones, so unless the issuer is running their own node and signing there, the transaction is being signed and encoded by another tool/library (possibly even one of "ours"), so rippled never sees the currency code as a string...

The only real question in my mind is how to fix it. On the input side, and risk breaking older apps that counted on the case being changed. Or on the output side, and confused everyone when their currency codes go from 3 letters to serialized hex...

@XRPLF XRPLF deleted a comment Apr 27, 2022
@XRPLF XRPLF deleted a comment Jul 22, 2022
@donovanhide
Copy link
Contributor

donovanhide commented Oct 3, 2022

Also seeing this or a related issue with currency codes containing a number:

Spec:

https://xrpl.org/currency-formats.html#standard-currency-codes

Does not match used regex:

https://github.com/XRPLF/rippled/blob/develop/src/ripple/net/impl/RPCCall.cpp#L124

alpha should be alnum with other permitted characters added.

rippled -q json book_offers '{ "taker_gets": { "currency": "XRP"}, "taker_pays":{ "currency": "ES1", "issuer": "rsSexxQoxzpqkrDjfdqS2j9kNR9afnm7yh" }, "limit": 1 }'

{
   "result" : {
      "ledger_current_index" : 74818046,
      "offers" : [],
      "status" : "success",
      "validated" : false
   }
}

rippled book_offers XRP ES1/rsSexxQoxzpqkrDjfdqS2j9kNR9afnm7yh
{
   "error" : "invalidParams",
   "error_code" : 31,
   "error_message" : "Invalid currency/issuer 'ES1/rsSexxQoxzpqkrDjfdqS2j9kNR9afnm7yh'",
   "rpc" : {
      "method" : "book_offers",
      "params" : [ "XRP", "ES1/rsSexxQoxzpqkrDjfdqS2j9kNR9afnm7yh" ]
   },
   "status" : "error"
}

@intelliot intelliot moved this to 🆕 New in Core Ledger Dec 14, 2022
@intelliot intelliot added Bug Documentation README changes, code comments, etc. labels Dec 14, 2022
@intelliot intelliot moved this from 🆕 New to 📋 Backlog in Core Ledger Jan 10, 2023
@thejohnfreeman
Copy link
Collaborator

Took a look at this. Here is the way I see it:

The XRPL doesn't care if the letters are lowercase or uppercase. It correctly permits all and only characters from the alphabet documented on xrpl.org, and defined in UintTypes.cpp, when they are submitted in the hex representation. When they are submitted in an ASCII string representation, rippled, but not XRPL, is more restrictive, and I'm not convinced there is a good reason. At this point, anyway, the horse has left the barn.

I think rippled should just get out of the way and let clients submit 3-character currency codes that include characters that are not uppercase letters. It requires only two changes:

  • Change the character set used in the regex in jvParseCurrencyIssuer from merely [:alpha:] to the full alphabet defined in UintTypes.cpp.
  • Remove the call to ::toupper in to_currency (which should relax the surrounding algorithm call from std::transform to just std::copy).

thejohnfreeman added a commit to thejohnfreeman/rippled that referenced this issue Jun 9, 2023
A few methods, including `book_offers`, take currency codes as
parameters. The XRPL doesn't care if the letters in those codes are
lowercase or uppercase, as long as they come from an alphabet defined
internally. rippled doesn't care either, when they are submitted in
a hex representation. When they are submitted in an ASCII string
representation, rippled, but not XRPL, is more restrictive, preventing
clients from interacting with some currencies already in the XRPL.

This change gets rippled out of the way and lets clients submit currency
codes in ASCII using the full alphabet.

Fixes XRPLF#4112
@intelliot
Copy link
Collaborator

Proposed solution: #4566

sappenin added a commit to XRPLF/xrpl4j that referenced this issue Aug 11, 2023
intelliot pushed a commit that referenced this issue Sep 22, 2023
A few methods, including `book_offers`, take currency codes as
parameters. The XRPL doesn't care if the letters in those codes are
lowercase or uppercase, as long as they come from an alphabet defined
internally. rippled doesn't care either, when they are submitted in a
hex representation. When they are submitted in an ASCII string
representation, rippled, but not XRPL, is more restrictive, preventing
clients from interacting with some currencies already in the XRPL.

This change gets rippled out of the way and lets clients submit currency
codes in ASCII using the full alphabet.

Fixes #4112
sappenin added a commit to XRPLF/xrpl4j that referenced this issue Oct 9, 2023
* Add unit test to validate rippled bug (See XRPLF/rippled#4112)
* Update test to cover binary codec
sophiax851 pushed a commit to sophiax851/rippled that referenced this issue Jun 12, 2024
A few methods, including `book_offers`, take currency codes as
parameters. The XRPL doesn't care if the letters in those codes are
lowercase or uppercase, as long as they come from an alphabet defined
internally. rippled doesn't care either, when they are submitted in a
hex representation. When they are submitted in an ASCII string
representation, rippled, but not XRPL, is more restrictive, preventing
clients from interacting with some currencies already in the XRPL.

This change gets rippled out of the way and lets clients submit currency
codes in ASCII using the full alphabet.

Fixes XRPLF#4112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Documentation README changes, code comments, etc. Testable
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

13 participants