Discrepency between tzstats and tzkt
Closed this issue · 8 comments
Hi all,
I wanted to point out that the test in TRD to compared the rewards between tzstats and tzkt fails since the transition happend.
tezos-reward-distributor-organization/tezos-reward-distributor#667
Test: test_get_rewards_for_cycle_map
Maybe you could investigate here?
Best regards
Carlo
Hey! If you are asking us to recheck some data indexed by tzkt, it would help if you tell what particular data should be rechecked, for what baker, and for what cycle.
These are the two simulated TRD payouts I generated with tzkt and tzstats data for cycle 592. They differ in the range starting 0.00x tez. I don’t know which one is correct. Can you make sense of the data?
Tezberry Pie - tz1KwafrdmM8RwxUMxdbbtWyZuKLWSPVxe9u
I've rechecked the rewards data on tzkt, related to your case, and can confirm that the data is correct.
Also, I've checked TRD's calculation (that is out of scope of tzkt's repo, though) and can confirm that it's correct as well.
Could it be related to something like floating point multiplications or are the differences too high for that? Otherwise this goes back to tzstats.
Thank you very much!
Nah, it doesn't look like a rounding issue. It's likely due to differences in the input data used in calculations. I'd suggest to check the inputs first ;)
Not sure if it matters, but tzkt stakingBalance
differs from the RPC response (RPC: 68614313834, tzkt 68600691658). This is an index 15 snapshot so maybe there is some magic and the RPC lies to us. Can you shed some light on this from what you found out when implementing the rights selection algo?
rpc
https://rpc.tzstats.com/chains/main/blocks/3219456/context/delegates/tz1KwafrdmM8RwxUMxdbbtWyZuKLWSPVxe9u
tzstats
https://api.tzstats.com/explorer/bakers/tz1KwafrdmM8RwxUMxdbbtWyZuKLWSPVxe9u/snapshot/592
tzkt
https://api.tzkt.io/v1/rewards/split/tz1KwafrdmM8RwxUMxdbbtWyZuKLWSPVxe9u/592
Yeah, that's a matter of how RPC works. We described that problem here: https://baking-bad.org/blog/2020/06/11/we-were-calculating-staking-balances-wrong/#why-is-rpc-approach-wrong almost 3 years ago, and it still exists :)
I can demonstrate it on a different baker, that doesn't have a deposit limit:
rpc staking balance: /chains/main/blocks/3219456/context/delegates/tz1irJKkXS2DBWkU1NnmFQx1c1L7pbGg4yhk
98995516450421
rpc staking balance snapshot: /chains/main/blocks/3219456/context/raw/json/cycle/592/selected_stake_distribution
98968744120533
tzkt staking balance snapshot: https://api.tzkt.io/v1/rewards/bakers/tz1irJKkXS2DBWkU1NnmFQx1c1L7pbGg4yhk/592
98968744120533
Closing as resolved