Contract storage member

When I compile the tutorial code with nargo build, I hit the following error.

error: cannot find `storage` in this scope 
   ┌─ /Users/anonymous/aztec-packages/yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr:49:24
   │
49 │         let counters = storage.counters;
   │                        ------- not found in this scope
   │

Could someone explain how “storage” get defined? Is it because every contract has it implicitly? If so, how come it doesn’t work for me.

Thanks,
–h

30 Likes

Can you try running through the tutorial again? Our docs were bugged and the code references were pointing to incorrect code. It should be fixed now.

27 Likes

Actually we are still hunting this bug. Sometimes the LSP acts up and says storage is not in scope when there is another error. I’m hoping to get the docs fix out soon!

22 Likes

Thanks for the investigation.
Is the language server involved here? I am running nargo from the command line on the master branch.
This is also the first error. There were a few warnings before.

27 Likes

The tutorial docs have been updated so they correctly show the code from the latest release.

Also note that you should use aztec-cli compile to compile aztec contracts, not a nargo command.

53 Likes