We are using offchain indexing to store some value that will be read in offchain worker .
The keys that we are using to store data via offchain indexing is as following:
key = some_prefix + current_block_number + unique_index_for_current_block
One of the problems with the mentioned key naming is that in case of forks for the same block number there is a possibility that some keys might get overwitten.
My question is as following:
Is it a safe to assume that in case of forks for offchain indexing writes, a storage will always get overwritten by the canonical block eventually?
in other words:
Is it safe to assume that the canonical block would be the last block (with the same block_number) that gets imported in case of a fork?
If the answer to those questions is yes then we should be fine since the data stored in offchain storage will eventually be correct for any block number (we will access them after the block got finalized) but if the answer is no then
Is there a unique value per fork that we can use for our offchain keys to make them fork-aware?
It looks like we don't have access to current block hash in extrinsics so we might need some other value.