Closed Quantumplation closed 2 years ago
For clarification, the cardano-cli prints all the utxos up to the point where it encounters the first utxo with a non-UTF8 asset name and then bombs there.
Yeah, it's just a presentation issue, and should be fixed as a presentation issue. The asset names are not required to be UTF8 (they have to support the use case of hashes for example).
@dcoutts would you accept a pull request?
If so, would you prefer:
please be careful with such transactions, i don't see a way for the "normal" cardano-cli user to handle such tokens in his utxos rather than filtering out the incoming utxo in total. so, not a good think for the mainnet atm.
@gitmachtl In particular, this is needed for protocol tokens whose names are the SHA256 hash of some data. Asset names are the perfect size to hold a SHA256 hash, and hex-encoding them first would make them too big.
The fix we have in our locally-patched cardano-cli locally is, if UTF8 encoding fails, print policyID.{[hex-encoded]}
, such as ba372dc1677a26ef3396bc357c31765ef0287e94d0c41629ad3.{ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb}
. When reading token names from the CLI, we apply a similar reverse translation.
(But yes, we have held off running our contracts on the public Alonzo White / Alonzo Purple testnets to avoid breaking anyone; we have been using a private alonzo purple instance instead)
Must be fixed in master
If reproduced, comment here to reopen.
External
Area Native Tokens Related to Native Tokens (Mary). Plutus Related to Plutus Scripts (Alonzo).
Summary
If you create a native token with an assetName that isn't valid UTF-8, cardano-cli is unable to render it as part of
cardano-cli query utxo
.Steps to reproduce Create a native token by constructing and serializing the transaction from haskell, using an "allow all" minting policy, which has an asset name that is not valid UTF-8.
In our case, we are setting the asset name to the bytes from a sha256 hash, since that fits perfectly in the 32 bytes allowed for the asset name.
Expected behavior
One of two possibilities seems sensible:
We've patched cardano-cli locally with the latter:
We wrap the assetName with curly brackets to give some indication that it's base16 encoded, rather than the actual asset name.
If there's interest in this approach, we're happy to submit a pull request!
System info (please complete the following information):
Screenshots and attachments
Additional context