Skip to content

Is it safe to rely on blockhash() in EventStorage.sol #6

Description

@akolotov

I have gone through your idea implemented in EventStorage.sol and found that you rely on blockhash()

require(parsedHeader.derivedHash == block.blockhash(parsedHeader.blockNumber));

In other words you assume that blockhash() will always return a correct value for any correct block number. But at the same moment I can read in Solidity documentation that

The block hashes are not available for all blocks for scalability reasons.
You can only access the hashes of the most recent 256 blocks, all other values will be zero.

(https://solidity.readthedocs.io/en/v0.4.24/units-and-global-variables.html#block-and-transaction-properties)

So, judging on this your code will work only if the block we are referring has the number greater than (N-256) where N is the current block number. Is it known limitation or Solidity documentation is obsoleted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions