leapdao/leap-node

Event sync fails for older events

Closed this issue · 4 comments

Bounty

Preface

By design, if you start a fresh node syncing with the existing network (e.g. testnet), the node will:
a. read and keep all the bridge events from the very beginning
b. get tx data from the seed node and apply transactions one by one. For most of the transaction types bridge events will be required (e.g. Exit, Deposit etc)

The node evolves, ABI for the bridge contracts changes and if event definition is changed in the ABI, the node can no longer read the older events of this type.

Problem

We have this situation with the Exit transactions right now on the testnet: on a block 10091 exit was started, but the node cannot read this event anymore. Because of that Exit tx is being rejected by the node and we have a consensus failure.

To reproduce, start a fresh sync for leap-testnet.json config.

Scope

  • change the event handler and bridgeState event sync to support older ABI version:
    • keep a height → ABI mapping for older ABIs. Keep only those required to resync mainnet and testnet.
    • Handle events e.g. by querying raw events and then parsing them using the right ABI. Feel free to use other solutions if they are faster and/or easier.

Deliverables

  • fixed node. You should be able to resync both testnet and mainnet from the beginning (unless other problem prevents this)
  • unit tests

Reviewer checklist

  • review the code for logical correctness, inefficiencies and style (TBD)
  • ensure unit tests are passing
  • ensure code coverage is not reduced
  • make sure you ran the updated node against the testnet from the start and all the blocks are processed without consensus errors
  • make sure you ran the updated node against the mainnet from the start and all the blocks are processed without consensus errors

Gain for the project

working resync

Publicly visible delivery

  • small writeup for a blog (dev update)?

Roles

bounty gardener: @troggy / 35 DAI
bounty worker: @sunify / 85%
bounty reviewer: name / 15%

@troggy i would like to take this :-)

@sunify awesome! Go for it 👍