Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulated backend Fork & blockchain SetHead don't emit removed logs event #30448

Open
dahu33 opened this issue Sep 17, 2024 · 1 comment · May be fixed by #30465
Open

Simulated backend Fork & blockchain SetHead don't emit removed logs event #30448

dahu33 opened this issue Sep 17, 2024 · 1 comment · May be fixed by #30465
Labels

Comments

@dahu33
Copy link
Contributor

dahu33 commented Sep 17, 2024

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 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.

@holiman
Copy link
Contributor

holiman commented Sep 19, 2024

Triage discussion, simulated_beaon.go Fork(..) method

	return c.eth.BlockChain().SetHead(parent.NumberU64())

Should invoke SetCanonical instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants