You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ soroban lab token wrap --network local --source me --asset USD:GDP7GGFMNMWABGWTF6BUB45MN6TPOCFY43KJVK5LDBCSJ2QTMQYYU3DACAW7SH5JG45U6YLCFB6YD2KVSOZQHMNEJQPN6KDZOCGSXWR72ZIFBBMP
❯ soroban contract invoke --network local --source me --id CAW7SH5JG45U6YLCFB6YD2KVSOZQHMNEJQPN6KDZOCGSXWR72ZIFBBMP -- name
The local network is a local quickstart running the commits above.
The me source is the networks root account.
What did you expect to see?
❯ soroban contract invoke --network local --source me --id CAW7SH5JG45U6YLCFB6YD2KVSOZQHMNEJQPN6KDZOCGSXWR72ZIFBBMP -- name"USD:GDP7GGFMNMWABGWTF6BUB45MN6TPOCFY43KJVK5LDBCSJ2QTMQYYU3DA"
What did you see instead?
❯ soroban contract invoke --network local --source me --id CAW7SH5JG45U6YLCFB6YD2KVSOZQHMNEJQPN6KDZOCGSXWR72ZIFBBMP -- name"USD\u0000:GDP7GGFMNMWABGWTF6BUB45MN6TPOCFY43KJVK5LDBCSJ2QTMQYYU3DA"
Discussion
Stellar assets have two types of asset codes, a 4 byte and 12 byte code. The specification of less than a 4 byte asset code when wrapping is selecting the 4 byte asset type, and the remaining characters are null (\u0000).
When rendering the asset to a string, it should be rendered without the null bytes. The null bytes are indicative of the string ending early, and not of characters that are meaningfully part of the code itself.
See SEP-11 for the correct rendering of the asset code.
The text was updated successfully, but these errors were encountered:
Ok I think this is basically originating here which is delegating to the native-contract wrapper type String that wraps the host type String, and asking it to render itself as a Rust String. The whole codepath there is actually fairly weak and wrong (doesn't do metering, doesn't do any of the suggested SEP-11 stuff) and arguably Rust Strings shouldn't be involved at all.
What version are you using?
What did you do?
The
local
network is a local quickstart running the commits above.The
me
source is the networks root account.What did you expect to see?
What did you see instead?
Discussion
Stellar assets have two types of asset codes, a 4 byte and 12 byte code. The specification of less than a 4 byte asset code when wrapping is selecting the 4 byte asset type, and the remaining characters are null (
\u0000
).When rendering the asset to a string, it should be rendered without the null bytes. The null bytes are indicative of the string ending early, and not of characters that are meaningfully part of the code itself.
See SEP-11 for the correct rendering of the asset code.
The text was updated successfully, but these errors were encountered: