Skip to content

bug: events delayed/skipped on testnet #271

@UrAvgDeveloper

Description

@UrAvgDeveloper

Events not stored after successfully handling the block

I encountered an issue while using the Infura JSON RPC service on test-net 1. In block 883642, certain events were emitted, and the block was successfully handled by the checkpoint. However, even after receiving confirmation that the checkpoint had successfully processed the block (with a log stating "block handled successfully"), the event information was not added to the database. It's important to note that the same events were successfully logged both before and after this particular block. This is important to note that this only happens for the latest blocks after the indexer has synced completely.

I suspect that the delay in adding the events to the database could be due to a synchronization issue, even though the checkpoint had fully synced to the specified block number. This delay might be related to how Infura processes data from the blockchain network.

When I attempt to re-run the process from the beginning, it syncs perfectly, indicating that the issue is not consistent. To address this problem, I would like to understand what might be causing the delay in adding events to the database despite a successful checkpoint and how to mitigate this issue. Is there a specific configuration, setting, or best practice that should be followed when using Infura JSON RPC to ensure consistent event handling and database updates in cases like this?

Helpful resources

Checkpoint config:

{
  "network_node_url": "https://starknet-goerli.infura.io/v3/<key>",
  "sources": [
    {
      "contract": "0x0761298ceec8306112ba3341d71088dba09944bb371e9cf5f191b7fae9fe19ed",
      "abi": "MarketManager",
      "start": 882020,
      "events": [
        {
          "name": "CreateMarket",
          "fn": "handleCreateMarket"
        },
        {
          "name": "ModifyPosition",
          "fn": "handleModifyPosition"
        },
        {
          "name": "CreateOrder",
          "fn": "handleCreateOrder"
        },
        {
          "name": "CollectOrder",
          "fn": "handleCollectOrder"
        },
        {
          "name": "Swap",
          "fn": "handleSwap"
        },
        {
          "name": "MultiSwap",
          "fn": "handleMultiSwap"
        },
        {
          "name": "ChangeProtocolShare",
          "fn": "handleChangeProtocolShare"
        }
      ]
    }
}

Txn whose event was skipped: https://testnet.starkscan.co/tx/0x0540fb9335da64af27a3eb789c139c7106671f5bc6073c4791a1316f430c4575

events that were supposed to be recorded:

  • CreateOrder
  • ModifyPosition

Versions used:

"@snapshot-labs/checkpoint": "^v0.1.0-beta.13",
"@snapshot-labs/sx": "^0.1.0-beta.13",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🗒️ Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions