synapseweb3 / forcerelay

Apache License 2.0
10 stars 8 forks source link

refator: refator some code of Ckb4Ibc endpoint, solved some fatal bugs #364

Closed ashuralyk closed 10 months ago

ashuralyk commented 10 months ago

background

there are so many bugs in Axon and CKB endpoints which can stop relaying packet events or just miss some of them, to unwrap, here are some reasons make this case happen:

  1. monitor of CKB endpoint always fetches first 5 packet events in the response data of ckb-indexer, so the packet event beyonds 5th won't process
  2. query_* methods both in Axon and CKB endpoints isn't working well (CKB is worse), and Hermes uses them to indicate wether the counterparty has handled the unhandled packet events
  3. the WriteAck packet cell in CKB endpoint should be consumed in the next time of creating new RecvPacket cell, if not do this, WriteAck packet cell is accumulating and consuming relayer's CKB capacity
  4. Axon endpoint should replay recent packet events, because some of them may not be relayed to CKB
  5. at the same time, there can be over two type of packets share the same sequence, for example, SendPacket packet with sequence 14 and WriteAck packet with sequence 14 too, this could cause query issue
  6. currently, forcerelay is doing better than before

change logs

  1. Axon endpoint supports replaying recent packet events
  2. CKB endpoint will fetch IBC events through ckb-indexer in a loop process
  3. packet related query_* methods are refactored in CKB endpoint
  4. CKB endpoint supports consuming useless WriteAck packet cells
  5. CKB endpoint searches single packet cell using a limit of packet status
  6. ckb contracts has updated

related PRs

ashuralyk commented 10 months ago

Is the contract version changed?

no, I'll fix it

ashuralyk commented 10 months ago

workflow_dispatch test

https://github.com/synapseweb3/forcerelay/actions/runs/6717007105/job/18254104374

I doubt this workflow quotes toml in main branch, I check it later

currently, it's ok https://github.com/synapseweb3/forcerelay/actions/runs/6720166618/job/18263158005?pr=364