From adbf6a6ce9bfd6b1d5c1ffab14cae21ebd38ce81 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 1 Apr 2025 13:43:58 -0700 Subject: [PATCH] FEVM: document the differences in the Filecoin BLOCKHASH instruction fixes https://github.com/filecoin-project/ref-fvm/issues/1414 --- .../filecoin-evm-runtime/difference-with-ethereum.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/smart-contracts/filecoin-evm-runtime/difference-with-ethereum.md b/smart-contracts/filecoin-evm-runtime/difference-with-ethereum.md index fb78c6ea7..05d218cc0 100644 --- a/smart-contracts/filecoin-evm-runtime/difference-with-ethereum.md +++ b/smart-contracts/filecoin-evm-runtime/difference-with-ethereum.md @@ -36,6 +36,13 @@ Filecoin EVM runtime emulates EVM self-destruct behavior but isn’t able to ent The `CALLCODE` opcode has not been implemented. Use the newer `DELEGATECALL` opcode. +## BLOCKHASH + +Ethereum has one block at every height while Filecoin can have none, one, or many (usually around 4-5). This means that the `BLOCKHASH` instruction behaves a bit differently in the Filecoin EVM: + +- Because there can be multiple blocks at any given height, `BLOCKHASH` returns the hash of all the concatenation of the CIDs of all the blocks at the requested height. +- Because there can be no blocks at any given height, if `BLOCKHASH` is called on a height with _no blocks_, it returns the `BLOCKHASH` of the first preceding height with blocks. + ## Bare-value sends In Ethereum, `SELFDESTRUCT` is the only way to send funds to a smart contract without giving the target smart contract a chance to execute code.