BlockhashRegistry - Existing blockhashes can be overwritten
Last 256 blocks, that are available in the EVM environment, are stored in `BlockhashRegistry` by calling `snapshot()` or `saveBlockNumber(uint _blockNumber)` functions. Older blocks are recreated by calling `recreateBlockheaders`.\\nThe methods will overwrite existing blockhashes.\\n```\\nfunction saveBlockNumber(uint \\_blockNumber) public {\\n\\n    bytes32 bHash = blockhash(\\_blockNumber);\\n\\n    require(bHash != 0x0, "block not available");\\n\\n    blockhashMapping[\\_blockNumber] = bHash;\\n    emit LogBlockhashAdded(\\_blockNumber, bHash);\\n}\\n```\\n\\n```\\nblockhashMapping[bnr] = calculatedHash;\\n```\\n
Resolution\\nAddressed with 80bb6ecf and 17d450cf by checking if blockhash exists and changing the `assert` to `require`.\\nIf a block is already saved in the smart contract, it can be checked and a SSTORE can be prevented to save gas. Require that blocknumber hash is not stored.\\n```\\nrequire(blockhashMapping[\\_blockNumber] == 0x0, "block already saved");\\n```\\n
```\\nfunction saveBlockNumber(uint \\_blockNumber) public {\\n\\n    bytes32 bHash = blockhash(\\_blockNumber);\\n\\n    require(bHash != 0x0, "block not available");\\n\\n    blockhashMapping[\\_blockNumber] = bHash;\\n    emit LogBlockhashAdded(\\_blockNumber, bHash);\\n}\\n```\\n