Skip to content

LSP: Add a code lens button for checking storage terms

We want to check storage metadata for warnings like Hash mismatch in metadata's JSON document in LSP for terms like

let bad_tezos_sha256_storage  =
  {
   data = 42;
   metadata =
     Big_map.literal
       [
         ("",
          [%bytes
          "sha256://0xff7c7fde391bc46a28cd98a77733fbe5927190dbe5493fe81244ee29dc624577/tezos-storage:m"]);
         ("m", hen_metadata)
       ]
  }

in src/test/contracts/contract_metadata/metadata_tzip16.mligo.

Since the operation can be slow (it's a term-level computation and can involve downloading JSON from external recourses), looks like we should do it on a code lens press, instead of doing this on a keystroke.

Proabably we should use storage_of_typed function to do this

There are different ways to understand which values are potential storages to check. We can get storage from the contract sig (since after #2076 (closed) is resolved we have a correct contract sig) and check for toplevel bindings with this type, or, for example, introduce an attribute like @tzip16-complaint

#2041 (closed) probably should be resolved together with this issue

Slack thread: https://tezos-dev.slack.com/archives/C04EM6W78A0/p1698250785097829?thread_ts=1698148549.411069&cid=C04EM6W78A0

Edited by Sorokin-Anton