When the simulated backend Fork(parentHash common.Hash) is called, the necessary removed logs event should be emitted has it would on non-simulated backend.
On the old simulated backend (before #28202 was merged) we were using (bc *BlockChain) InsertChain(chain types.Blocks) to simulate chain reorgs under similar conditions, and did not face this issue. However, in the new simulated backend we don't have access anymore to the blockchain (it's not exported) and can only use the Fork function.
Note that the Fork function call the BlockChain.SetHead(head uint64) function which may be the source of the issue.
Actual behaviour
Removed logs event are not emitted.
Steps to reproduce the behaviour
Create a simulated backend
Deploy a contract that can emit logs
Subscribe to logs
Call a function that emit logs
Call the Fork(parentHash common.Hash) to the block before the last event was emitted
The logs subscription will not yield any removed logs event.
System information
Geth version:
1.14.8
Expected behaviour
When the simulated backend
Fork(parentHash common.Hash)
is called, the necessary removed logs event should be emitted has it would on non-simulated backend.On the old simulated backend (before #28202 was merged) we were using
(bc *BlockChain) InsertChain(chain types.Blocks)
to simulate chain reorgs under similar conditions, and did not face this issue. However, in the new simulated backend we don't have access anymore to theblockchain
(it's not exported) and can only use theFork
function.Note that the
Fork
function call theBlockChain.SetHead(head uint64)
function which may be the source of the issue.Actual behaviour
Removed logs event are not emitted.
Steps to reproduce the behaviour
Create a simulated backend Deploy a contract that can emit logs Subscribe to logs Call a function that emit logs Call the
Fork(parentHash common.Hash)
to the block before the last event was emitted The logs subscription will not yield any removed logs event.