Inside a FRAME runtime I want to check whether a specific storage item was already read in the current block. Reason is to determine the impact of storage accesses across the extrinsics of a block rather than only per extrinsic.

Basically, for every read I want to know if either one of those statements is true:

  1. The storage item already been read in the current block.
  2. The storage item has already been written in the current block.

In both cases the item wouldn't be included in the witness:

  1. The witness does not contain duplicate keys.
  2. If the key was written it can be pulled from the overlay and doesn't need to be in the witness.

1 Answer 1


You can not check whether a specific storage item was already read or written. You need to assume the worst case, aka always having a "fresh" read.

  • If for example you want to check a storage value could you not store a tracking storage value which takes a bool. Each read you update this bool, use it to check against your statements. At the start of every block, could you then use some hook to reset this tracking value? Im new to substrate so please point out any errors in my understanding of concepts Commented Feb 25, 2022 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.