Skip to content

Commit

Permalink
Fix test_api_consistency (#683)
Browse files Browse the repository at this point in the history
* Contributor: denver-s, Effort=0.5h
* Reviewer: jdsika, Effort=0h
  • Loading branch information
denver-s committed Nov 1, 2023
1 parent dd3378b commit d4fd27a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/tzstats/tzstats_reward_provider_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from log_config import main_logger, verbose_logger
from tzstats.tzstats_api_constants import (
idx_n_baking_rights,
idx_income_expected_income,
idx_income_total_income,
idx_income_lost_accusation_fees,
idx_income_lost_accusation_rewards,
Expand Down Expand Up @@ -123,8 +124,8 @@ def get_rewards_for_cycle(self, cycle):
root["offline_losses"] = int(
MUTEZ_PER_TEZ
* (
float(resp[idx_income_missed_baking_income])
+ float(resp[idx_income_missed_endorsing_income])
float(resp[idx_income_expected_income])
- float(resp[idx_income_total_income])
)
)

Expand Down
4 changes: 3 additions & 1 deletion tests/integration/test_api_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ def test_get_rewards_for_cycle_map(
assert rewards_tzkt.equivocation_losses == rewards_tzstats.equivocation_losses

# Check offline_losses
assert rewards_tzkt.offline_losses == rewards_tzstats.offline_losses
assert rewards_tzkt.offline_losses == pytest.approx(
rewards_tzstats.offline_losses, 60000
)

# Check potential_endorsement_rewards
# TODO: tzstats total_active_stake does not match rpc and tzkt exactly thus the approximation
Expand Down

0 comments on commit d4fd27a

Please sign in to comment.