oxheadalpha / TZComet

Contract Metadata Viewer on Tezos
https://www.oxheadalpha.com/TZComet/
MIT License
25 stars 3 forks source link

stack overflow if contract JSON tzip-16 metadata points to `tezos-storage:<key>` #62

Closed damian0815 closed 3 years ago

damian0815 commented 3 years ago

tzcomet gives a "stack overflow" when a contract's tzip-16 JSON contract metadata url key is tezos-storage:<key>

example: https://tqtezos.github.io/TZComet/#/explorer%3Fgo%3Dtrue%26explorer-input%3DKT1NSfdaD4Q6kVvBWKxYz1Dg6dJV5sJ3BN6D

contract source code: SmartPy link

(relevant lines from contract:

contract_metadata_json = sp.utils.bytes_of_string("{ ... tzip-16 metadata ... }")
METADATA_URL = "tezos-storage:contract_metadata_json"
metadata = sp.big_map({"" : sp.utils.bytes_of_string(METADATA_URL),
  "contract_metadata_json": contract_metadata_json})
...
sp.add_compilation_target("test_tzip12", TestTaquitoTzip12TokenMetadata(metadata = metadata))
damian0815 commented 3 years ago

probably related: #60

smondet commented 3 years ago

It is indeed the same issue as #60, the problem is not with the tezos-storage:.. URI, it is with the other blob of bytes that is at the toplevel of the storage (field called contract_metadata_json cf. BCD).

It is a parsing bug of TZComet that we'll try to fix but in your case it does seem useless and you should know that every time you'll call that contract that top-level blob will cost you deserialization/type-checking gas (in other words, when something is not hidden in a big-map, it's not just origination burn).

Closing since we already keep track of #60, but thanks for the report!

damian0815 commented 3 years ago

yikes, good to know - thanks