Skip to content

Removed on-chain events are not removed from database #561

@darcher-framework

Description

@darcher-framework

Description

Smart contract events like submitting a new proposal or voting can be removed due to chain reorganization.
However, in the periodical syncing task with blockchain, the DApp does not consider and handle the case when a previous emitted event is then removed.

This bug affects various functionalities including submitting new proposal, voting, processing a proposal and so on.

Reproduce Steps

One reproduce example is given below.

  1. submit a new proposal by sending a transaction
  2. mine a block and execute the transaction
  3. at this time, the DApp has noticed the new proposal event and add it to database
  4. chain reorganization happens, where the previous event is removed
  5. the proposal record is still in Database and is shown to users.
  6. Then if the user tries to vote, it will get the error, which means the proposal does not exist and the vote transaction will always fail.
    image

Expected Behaviour

The events removed by chain reorganization should also be removed from database of DApp, making the DApp consistent with data stored in smart contracts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions