horizon
horizon copied to clipboard
HTTP 500 when tx.memo.length exceeds max_length
At the moment an Internal server error occurs when sending a transaction with a text memo larger than 28 characters.
I propose to create an error like the following:
{
"type": "https://stellar.org/horizon-errors/transaction_failed",
"title": "Transaction Failed",
"status": 400,
"detail": "The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details. Descriptions of each code can be found at: https://www.stellar.org/developers/learn/concepts/list-of-operations.html",
"instance": "",
"extras": {
"envelope_xdr":",
"result_codes": {
"transaction": "tx_memo_exceeds_size"
},
"result_xdr": ""
}
}
Details of the 500:
{
"type": "https://stellar.org/horizon-errors/server_error",
"title": "Internal Server Error",
"status": 500,
"detail": "An error occurred while processing this request. This is usually due to a bug within the server software. Trying this request again may succeed if the bug is transient, otherwise please report this issue to the issue tracker at: https://github.com/stellar/horizon/issues. Please include this response in your issue.",
"instance": "horizon-testnet-001.prd.stellar001.internal.stellar-ops.com/5Ce6iMSfqt-430421"
}
The effort required to pinpoint where a transaction is malformed is a bit too much effort to tackle right now, but I agree that we can do better at communicating "You have crafted an XDR structure that is corrupt" in this case.
Out of curiosity, could you provide the transaction that you were attempting to post? How did you produce a transaction whose memo was too long? the XDR libraries that stellar provides should all error out prior to serializing to XDR if you've violated the schema, and if you were able to corrupt a transaction using the library we should fix that.
A repro case for this ticket would be much appreciated.
This occurs because MEMO_TEXT : A string encoded using either ASCII or UTF-8, up to 28-bytes long. https://www.stellar.org/developers/guides/concepts/transactions.html
memo has to be 28 characters or less, right?