Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zoneconcierge: subscribe to checkpointing/epoching's hooks, and add a new hooks #200

Merged
merged 3 commits into from
Nov 14, 2022

Conversation

SebastianElvis
Copy link
Member

@SebastianElvis SebastianElvis commented Nov 14, 2022

Partially fixes BM-276

In order to know the last BTC-finalised CZ header/fork, the ZoneConcierge module needs to get notifications upon an epoch has ended and upon an epoch is finalised. To this end, PR makes the ZoneConcierge module to subscribe hooks of epoching and checkpointing modules.

Specifically, this PR

  • adds a new hook AfterRawCheckpointFinalized for checkpointing. It is invoked upon an epoch's checkpoint is finalised.
  • makes the ZoneConcierge module to subscribe hooks of epoching and checkpointing modules. It will make use of AfterEpochEnds and AfterRawCheckpointFinalized to get notifictaions upon an epoch has ended and finalised, respectively.

As a byproduct, this PR also replaces the direct invocation of ApplyMatureUnbonding with the hook-based invocation, where the epoching module subscribes to checkpointing's hooks.

Future works

This is in preparation for making the ZoneConcierge to maintain the last BTC-finalised CZ headers/forks. The planned implementation is as follows:

  • ZoneConcierge maintains a KVStore where the key is chainID || epochNumber and the value is the last ChainInfo of this epoch.
  • Upon an epoch ends, ZoneConcierge records the current ChainInfo with the current epochNumber for each CZ.
  • Upon an epoch has finalised, ZoneConcierge finds the corresponding ChainInfo, and updates it to the chain info index.

Copy link
Contributor

@gitferry gitferry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@SebastianElvis SebastianElvis merged commit 0bf8f76 into dev Nov 14, 2022
@SebastianElvis SebastianElvis deleted the zoneconcierge-btc-finalised-header branch November 14, 2022 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants