zoneconcierge: subscribe to checkpointing/epoching's hooks, and add a new hooks #200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
AfterRawCheckpointFinalized
for checkpointing. It is invoked upon an epoch's checkpoint is finalised.AfterEpochEnds
andAfterRawCheckpointFinalized
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:
chainID || epochNumber
and the value is the lastChainInfo
of this epoch.ChainInfo
with the currentepochNumber
for each CZ.ChainInfo
, and updates it to the chain info index.