Skip to content

Commit

Permalink
fix: checkpoint logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dvilelaf committed Dec 3, 2024
1 parent a9c508c commit a2c1e71
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/valory/skills/staking_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit a2c1e71

Please sign in to comment.