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
I guess DID metadata is expected to be a flat key value pair. If you try setting it to a multi-layer json, it breaks any rpc command that causes a transaction.
Here is an example:
(base) PS C:\Users\gaerax> chia rpc wallet did_get_metadata '{\"wallet_id\": 8}'
{
"metadata": {
"foo": "bar" <--- correctly formatted metadata, everything works fine
},
"success": true,
"wallet_id": 8
}
(base) PS C:\Users\gaerax> chia rpc wallet did_update_metadata '{\"wallet_id\": 8, \"metadata\": {\"foo\": {\"bar\": \"foobar\"}}, \"fee\": 500000}'
Request failed: {'error': "can't cast <class 'dict'> ({'bar': 'foobar'}) to bytes", 'success': False, 'traceback': 'Traceback (most recent call last):\n File "chia\\rpc\\util.py", line 21, in inner\n File "chia\\rpc\\util.py", line 82, in rpc_endpoint\n File "chia\\rpc\\wallet_rpc_api.py", line 2404, in did_update_metadata\n File "chia\\wallet\\did_wallet\\did_wallet.py", line 1430, in update_metadata\n File "chia\\wallet\\wallet_state_manager.py", line 505, in update_wallet_puzzle_hashes\n File "chia\\wallet\\did_wallet\\did_wallet.py", line 527, in puzzle_hash_for_pk\n File "chia\\wallet\\did_wallet\\did_wallet_puzzles.py", line 191, in metadata_to_program\n File "clvm\\SExp.py", line 182, in to\n File "clvm\\SExp.py", line 98, in to_sexp_type\n File "clvm\\SExp.py", line 55, in convert_atom_to_bytes\nValueError: can\'t cast <class \'dict\'> ({\'bar\': \'foobar\'}) to bytes\n'}
(base) PS C:\Users\gaerax> chia rpc wallet did_get_metadata '{\"wallet_id\": 8}'
{
"metadata": {
"foo": {
"bar": "foobar" <--- bad metadata, should not be here given the above error
}
},
"success": true,
"wallet_id": 8
}
(base) PS C:\Users\gaerax> chia wallet did create <--- now this doesn't work
Failed to create DID wallet: {'error': "can't cast <class 'dict'> ({'bar': 'foobar'}) to bytes", 'success': False, 'traceback': 'Traceback (most recent call last):\n File "chia\\rpc\\util.py", line 21, in inner\n File "chia\\rpc\\util.py", line 82, in rpc_endpoint\n File "chia\\rpc\\wallet_rpc_api.py", line 726, in create_new_wallet\n File "chia\\wallet\\did_wallet\\did_wallet.py", line 128, in create_new_did_wallet\n File "chia\\wallet\\did_wallet\\did_wallet.py", line 1251, in generate_new_decentralised_id\n File "chia\\wallet\\did_wallet\\did_wallet.py", line 1119, in get_new_did_innerpuz\n File "chia\\wallet\\did_wallet\\did_wallet.py", line 1106, in get_new_p2_inner_puzzle\n File "chia\\wallet\\wallet.py", line 168, in get_new_puzzle\n File "chia\\wallet\\wallet_state_manager.py", line 546, in get_unused_derivation_record\n File "chia\\wallet\\wallet_state_manager.py", line 439, in create_more_puzzle_hashes\n File "chia\\wallet\\did_wallet\\did_wallet.py", line 527, in puzzle_hash_for_pk\n File "chia\\wallet\\did_wallet\\did_wallet_puzzles.py", line 191, in metadata_to_program\n File "clvm\\SExp.py", line 182, in to\n File "clvm\\SExp.py", line 98, in to_sexp_type\n File "clvm\\SExp.py", line 55, in convert_atom_to_bytes\nValueError: can\'t cast <class \'dict\'> ({\'bar\': \'foobar\'}) to bytes\n'}
The transaction to update the metadata doesn't happen, but I guess it saves the metadata somewhere, because even if you restart chia, the error persists.
The error also comes up in the gui when creatings a did, sending a transaction, burning an nft, etc.
and gives this error in the console.
useShowError.tsx:12 Error: can't cast <class 'dict'> ({'bar': 'foobar'}) to bytes
at o.<anonymous> (Client.ts:236:16)
at o.emit (node:events:514:28)
at u.re (websocket.js:1098:20)
at u.emit (node:events:514:28)
at u.value (receiver.js:528:14)
at receiver.js:479:23
at permessage-deflate.js:308:9
at permessage-deflate.js:391:7
at afterWrite (node:internal/streams/writable:500:5)
at onwrite (node:internal/streams/writable:480:7)
You can fix the error by making another valid update to the metadata.
Version
2.1.4
What platform are you using?
Windows
What ui mode are you using?
CLI
Relevant log output
2024-01-26T20:16:41.208 wallet chia.rpc.util : WARNING Error while handling message: Traceback (most recent call last):
File "chia\rpc\util.py", line 21, in inner
File "chia\rpc\util.py", line 82, in rpc_endpoint
File "chia\rpc\wallet_rpc_api.py", line 2404, in did_update_metadata
File "chia\wallet\did_wallet\did_wallet.py", line 1430, in update_metadata
File "chia\wallet\wallet_state_manager.py", line 505, in update_wallet_puzzle_hashes
File "chia\wallet\did_wallet\did_wallet.py", line 527, in puzzle_hash_for_pk
File "chia\wallet\did_wallet\did_wallet_puzzles.py", line 191, in metadata_to_program
File "clvm\SExp.py", line 182, in to
File "clvm\SExp.py", line 98, in to_sexp_type
File "clvm\SExp.py", line 55, in convert_atom_to_bytes
ValueError: can't cast <class 'dict'> ({'bar': 'foobar'}) to bytes2024-01-26T20:25:02.291 wallet chia.rpc.util : WARNING Error while handling message: Traceback (most recent call last): File "chia\rpc\util.py", line 21, in inner File "chia\rpc\util.py", line 82, in rpc_endpoint File "chia\rpc\wallet_rpc_api.py", line 726, in create_new_wallet File "chia\wallet\did_wallet\did_wallet.py", line 128, in create_new_did_wallet File "chia\wallet\did_wallet\did_wallet.py", line 1251, in generate_new_decentralised_id File "chia\wallet\did_wallet\did_wallet.py", line 1119, in get_new_did_innerpuz File "chia\wallet\did_wallet\did_wallet.py", line 1106, in get_new_p2_inner_puzzle File "chia\wallet\wallet.py", line 168, in get_new_puzzle File "chia\wallet\wallet_state_manager.py", line 546, in get_unused_derivation_record File "chia\wallet\wallet_state_manager.py", line 439, in create_more_puzzle_hashes File "chia\wallet\did_wallet\did_wallet.py", line 527, in puzzle_hash_for_pk File "chia\wallet\did_wallet\did_wallet_puzzles.py", line 191, in metadata_to_program File "clvm\SExp.py", line 182, in to File "clvm\SExp.py", line 98, in to_sexp_type File "clvm\SExp.py", line 55, in convert_atom_to_bytesValueError: can't cast <class 'dict'> ({'bar': 'foobar'}) to bytes
2024-01-26T20:45:21.196 wallet chia.rpc.rpc_server : WARNING Error while handling message: Traceback (most recent call last):
File "chia\rpc\rpc_server.py", line 325, in safe_handle
File "chia\rpc\rpc_server.py", line 316, in ws_api
File "chia\rpc\util.py", line 82, in rpc_endpoint
File "chia\rpc\wallet_rpc_api.py", line 1112, in send_transaction
File "chia\wallet\wallet.py", line 450, in generate_signed_transaction
File "chia\wallet\wallet.py", line 362, in _generate_unsigned_transaction
File "chia\wallet\wallet.py", line 196, in get_new_puzzlehash
File "chia\wallet\wallet_state_manager.py", line 546, in get_unused_derivation_record
File "chia\wallet\wallet_state_manager.py", line 439, in create_more_puzzle_hashes
File "chia\wallet\did_wallet\did_wallet.py", line 527, in puzzle_hash_for_pk
File "chia\wallet\did_wallet\did_wallet_puzzles.py", line 191, in metadata_to_program
File "clvm\SExp.py", line 182, in to
File "clvm\SExp.py", line 98, in to_sexp_type
File "clvm\SExp.py", line 55, in convert_atom_to_bytes
ValueError: can't cast <class 'dict'> ({'bar': 'foobar'}) to bytes
The text was updated successfully, but these errors were encountered:
What happened?
I guess DID metadata is expected to be a flat key value pair. If you try setting it to a multi-layer json, it breaks any rpc command that causes a transaction.
Here is an example:
The transaction to update the metadata doesn't happen, but I guess it saves the metadata somewhere, because even if you restart chia, the error persists.
The error also comes up in the gui when creatings a did, sending a transaction, burning an nft, etc.
and gives this error in the console.
You can fix the error by making another valid update to the metadata.
Version
2.1.4
What platform are you using?
Windows
What ui mode are you using?
CLI
Relevant log output
The text was updated successfully, but these errors were encountered: