Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find_metadata_big_maps can't handle contracts declaring storage type using shortened pair syntax #7

Open
lierdakil opened this issue Feb 4, 2022 · 1 comment

Comments

@lierdakil
Copy link

The culprit:

| Prim (_, "Pair", [l; r], _), Prim (_, "pair", [lt; rt], _) ->

Case in point: KT1VvnQFn9v3oHA7JLTdDZD6hdAx3T4TnUA2 on Hangzhou-net fails with Contract has no valid %metadata big-map! despite containing (big_map %metadata string bytes) within the top-level tree of nested pairs (as per spec). storage is declared as

  storage
   (pair (pair <...>)
          (pair <...>)
          (big_map <...>)
          (big_map %metadata string bytes)) ;

the corresponding Micheline representation is

{
  "code": [
    {...}
    {
      "prim": "storage",
      "args": [
        {
          "prim": "pair",
          "args": [
            {...},
            {...},
            {...},
            {
              "prim": "big_map",
              "args": [
                {
                  "prim": "string"
                },
                {
                  "prim": "bytes"
                }
              ],
              "annots": [
                "%metadata"
              ]
            }
          ]
        }
      ]
    },
    {...}
  ]
}

Notice the pair constructor here has 4 arguments in the Micheline representation, while the code only looks for cases where there are exactly 2.

@smondet
Copy link
Contributor

smondet commented Feb 4, 2022

Yes, for now that piece of code expects normalized michelson.

Cf. the POST RPC /chains/main/blocks/head/context/contracts/<KT1>/storage/normalized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants