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

Substrate storage.<pallet>.<item>.<version>.is(block) false positive #334

Open
khssnv opened this issue Aug 13, 2024 · 2 comments
Open

Substrate storage.<pallet>.<item>.<version>.is(block) false positive #334

khssnv opened this issue Aug 13, 2024 · 2 comments

Comments

@khssnv
Copy link

khssnv commented Aug 13, 2024

Describe the bug

The call storage.mypallet.myitem.v1.is(blockHeader) (where storage is imported from types generated by squid-substrate-typegen) returns true at block at height where it expected to return true for v2 (which added new fields to myitem type) only.

To Reproduce

  1. Setup the project.

    git clone --branch debug/khssnv-squid-sdk-bug-report https://github.com/Cerebellum-Network/cere-squid-indexer.git
    cd cere-squid-indexer
    npm i
  2. Launch processor.

    docker compose up -d db
    sqd process
  3. See error message.

    ...
    Unexpected storage layout version selection. Selected v48013 for spec version 54116 which is higher than the next v48017.
    ...

Please tell if this one is too large and I'll prepare a minimal reproducible example.

Expected behavior

In my specific case with the project set up above, the storage.ddcCustomers.buckets.v48013.is(block) call is expected to return false instead of true at height 5,238,731 and return true at storage.ddcCustomers.buckets.v54100.is(block).

Environment (please complete the following information):

  • specify the version of the core packages: "@subsquid/substrate-processor": "8.3.0", "@subsquid/substrate-typegen": "8.1.0", "@subsquid/substrate-metadata-explorer": "3.2.0"
  • node.js version 16
  • npm version 10.8
  • OS version Linux x1 6.5.0-1027-oem #28-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 25 13:32:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Reproducible example or a repo link https://github.com/Cerebellum-Network/cere-squid-indexer

Applicable to decoding issues:

@belopash
Copy link
Contributor

As a workaround you can check v2 before v1, This is happening because v1 type implements v2

@khssnv
Copy link
Author

khssnv commented Aug 14, 2024

Thanks! Looks like it is vice versa,v2 implements v1 since v2 has all the fields of v1 plus some extra.

In my specific case a lower version omits some fields of the upper version: v48013.Bucket, v54100.Bucket.

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

Successfully merging a pull request may close this issue.

2 participants