Skip to content

Race condition #10

Closed
Closed
@LogvinovLeon

Description

@LogvinovLeon

Blockstream fetches the logs by block number. If between the block request and log request block reorg happens - it'll leed to a wrong log history and possibly skipped events.
B (2) C (2)
\ ....... /
A (1)

Let's say someone does reconcileBlock with block B.
Blockstream requests logs from block 2. It gets logs from block C cause the reorg happened. Then another reorg happenes and some block mined on top of A is the new head. Blockstream will not request logs from B cause it missed the first reorg. User will never receive those logs.

On the first sight - it involves perfect timings of reorgs and two reorgs which seems to be impractical, but if we claim that it's a 'reliable' block stream - than this should not happen.

The solution will be to request logs by hash not by number. Unfortunately nodes don't support that.
We should either ask nodes to support that or support returning logs as part of getBlock request. It already has a boolean flag to return transactions. Might as well include logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrefactor requiredFixing this issue requires significant design or architectural changes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions