Module: monitor

Description

The monitor module defines hooks that are executed based on events occurring in other modules within the Babylon chain.

The functions executed in this module are as follows:

  • updateBtcLightClientHeightForEpoch — This function is called when an epoch ends. It stores the current Babylon chain block height in the store, using the epoch number as the key.

  • updateBtcLightClientHeightForCheckpoint — This function is called within the MsgInsertBTCSpvProof message handler of the btccheckpoint module when a sufficient number of BLS signatures have been verified for a specific checkpoint. It stores the current Babylon block height in the store, using the checkpoint hash as the key.

  • removeCheckpointRecord — This function is called when a checkpoint is deemed invalid within the btccheckpoint module and is subsequently deleted. It removes all previously recorded data stored using the updateBtcLightClientHeightForCheckpoint function.

Test coverage

The x/monitor package has moderate test coverage (56.0%), with the keeper module slightly higher (62.5%), while the types module is mostly untested (1.2%).

ok      github.com/babylonlabs-io/babylon/x/monitor     2.163s  coverage: 56.0% of statements
ok      github.com/babylonlabs-io/babylon/x/monitor/keeper      2.755s  coverage: 62.5% of statements
ok      github.com/babylonlabs-io/babylon/x/monitor/types       1.028s  coverage: 1.2% of statements
Zellic © 2025Back to top ↑