The result is based on the state at the end of the previous block.
This means the start of the block.
Sorry I need to be more specific here. For historical transactions, you need to specify the block number as the previous block.
For example, if you want to simulate a transaction using
eth_call from block 123, you need to specify
blockNumber as 122 in order to obtain the correct result.
JakuAme is right:
The result of the function call will be based on the state of the
blockchain after all transactions in that block have been executed.
Edit 2: Taking block 123 as an example
eth_getBalance - returns the balance of the account after executing block 123
eth_getCode - Returns smart contract code after block execution. If a smart contract is deployed in block 123, this will return the deployed code.
eth_getTransactionCount - Get the transaction count of block 123
eth_getStorageAt - Returns value after block execution, if a value is changed in block 123, this will return the updated value.
eth_call - Execution is based on the state after block 123 execution. If you are trying to simulate a transaction from block 123, you need to specify block 122.
For your question:
for historical blocks, is the result of the function call guaranteed
to be the value after the block?
I thought you are asking about calling a smart contract function from an old block. Sorry for the confusion caused.