View function throws an error with block.number

Looking at I understood the solidity view function can work with any function unless it mutate states, emit events or perform any other mutative operations.

Meanwhile I noticed the following does not work (at least in Remix). Returning the stored blockNumber or the block.number works but not returning their difference blockNumber - block.number.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract ThrowsError {

    uint256 private blockNumber;

    constructor () {
        blockNumber = block.number;

    function viewFunction() public view returns (uint256) {
        return blockNumber - block.number;

Here's the error that Remix Javascript VM throws:

call to ThrowsError.viewFunction errored: VM error: revert.

	The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
Debug the transaction to get more information.

Are there more restrictions on view functions? Could it be a problem with the Javascript VM?

You are getting an error because your code results in an underflow. return block.number - blockNumber; works as expected