From a2c1e71d073a63c3c8171061f1f5c2627f230dbc Mon Sep 17 00:00:00 2001 From: David Vilela Date: Tue, 3 Dec 2024 13:11:28 +0100 Subject: [PATCH] fix: checkpoint logging --- packages/valory/skills/staking_abci/behaviours.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/valory/skills/staking_abci/behaviours.py b/packages/valory/skills/staking_abci/behaviours.py index c244353e..59e887a9 100644 --- a/packages/valory/skills/staking_abci/behaviours.py +++ b/packages/valory/skills/staking_abci/behaviours.py @@ -208,8 +208,11 @@ def is_checkpoint_callable(self, staking_contract_address) -> Generator[None, No epoch_end = yield from self.get_epoch_end(staking_contract_address) if not epoch_end: + self.context.logger.error(f"Could not get the epoch end for contract {staking_contract_address}") return False + self.context.logger.info(f"Epoch end for contract {staking_contract_address} is {epoch_end.strftime('%Y-%m-%d %H:%M:%S')}") + # If the epoch end is in the past, the epoch has ended and # no one has called the checkpoint return epoch_end < self._get_utc_time() @@ -356,14 +359,10 @@ def get_checkpoint_hash(self) -> Generator[None, None, Optional[str]]: for staking_contract_address in self.params.staking_contract_addresses: - # Check if there is some service staked on this contract - # services_staked = yield from self.get_staked_services(staking_contract_address) - # if not services_staked: - # continue - # Check if this checkpoint needs to be called is_checkpoint_callable = yield from self.is_checkpoint_callable(staking_contract_address) if not is_checkpoint_callable: + self.context.logger.info(f"Checkpoint is not callable for contract {staking_contract_address}") continue # Use the contract api to interact with the staking contract @@ -398,6 +397,10 @@ def get_checkpoint_hash(self) -> Generator[None, None, Optional[str]]: "data": data_bytes, } ) + self.context.logger.info(f"Added checkpoint call for contract {staking_contract_address}") + + if not multi_send_txs: + return None # Multisend call contract_api_msg = yield from self.get_contract_api_response(