Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences in reward amount between db-sync and Yoroi/Daedalus #689

Closed
tmazhuan opened this issue Jul 12, 2021 · 5 comments
Closed

Differences in reward amount between db-sync and Yoroi/Daedalus #689

tmazhuan opened this issue Jul 12, 2021 · 5 comments

Comments

@tmazhuan
Copy link

tmazhuan commented Jul 12, 2021

Hi all,
when querying the db-sync rewards table i get reward amounts which are slightly different to the amounts which i see in the Yoroi Wallet or also on PoolTool (i'm aware that the amounts displayed on pooltool are rounded, but the difference is more than just a rounding issue). The rewards in db-sync are on average around 40'000 lovelace lower in db-sync
The following query is used:

select reward.epoch_no, pool_hash.view as delegated_pool, reward.amount as lovelace
    from reward inner join stake_address on reward.addr_id = stake_address.id
    inner join pool_hash on reward.pool_id = pool_hash.id
    where stake_address.view = 'stake1uyymg75pvgxr6fl0zx9lcw2wl7te484prt7snt3nzmlh69s6wwpaq'
    order by epoch_no asc ;

This results in:

 epoch_no |                      delegated_pool                      | lovelace  
----------+----------------------------------------------------------+-----------
      261 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 243730004
      262 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 211680044
      263 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 224387114
      264 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 222135184
      265 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 375804851
      266 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 388454084
      267 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 425211856
      268 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 401498634
      269 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 333041627
      270 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 343757509
      271 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 366989671
      272 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 348822853
      274 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 383099886
      275 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 394408577

For the same address the rewards from yoroi are:

Epoch | lovelace
261 | 261000000
262 | 262000000
263 | 263000000
264 | 264000000
265 | 265000000
266 | 266000000
267 | 267000000
268 | 268000000
269 | 269000000
270 | 270000000
271 | 271000000
272 | 272000000
273 | 393481181
274 | 383147421
275 | 394457147

When looking at another address i see the same issue. For example the address stake1uymsgwktlset8f0rx7mf07j025jg63p8wlgtux5rx6t9rdgwteesu shows the similar differences. Interesting here is, that the differences only start to show in epoch 235. Epoch 234 and before seem to be in line.

Another issue i saw is that at least in my db-sync database the reward for epoch 273 are missing (for both addresses above).

Thanks for checking this issue!

@erikd
Copy link
Contributor

erikd commented Jul 13, 2021

Those Yoroi rewards are werid. All the ones for epochs 261 to 272 are of an even number of ADA (there are zero Lovelace).

@erikd
Copy link
Contributor

erikd commented Jul 13, 2021

My database is not yet fully synced but even for the bits that I do have, I get different results:

select reward.epoch_no, pool_hash.view as delegated_pool, reward.amount as lovelace
    from reward inner join stake_address on reward.addr_id = stake_address.id
    inner join pool_hash on reward.pool_id = pool_hash.id
    where stake_address.view = 'stake1uyymg75pvgxr6fl0zx9lcw2wl7te484prt7snt3nzmlh69s6wwpaq'
    order by epoch_no asc ;
 epoch_no |                      delegated_pool                      | lovelace  
----------+----------------------------------------------------------+-----------
      261 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 243760521
      262 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 211706555
      263 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 224415164
      264 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 222162943
      265 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 375851816
      266 | pool1a4qtpgce7cu6wzc79fx7qrc3938hkl2gf8c2h5jugvm2gnu86l7 | 388502524
(6 rows)

What version of db-sync are you using (and preferable the git hash as well)? And did you sync this yourself or use a snapshot?

@tmazhuan
Copy link
Author

tmazhuan commented Jul 13, 2021

Sorry, there was a copy-paste mistake when i copied the Yoroi Rewards. Here is the correct table:

Epoch | lovelace
261 | 243760521
262 | 211706555
263 | 224415164
264 | 222162943
265 | 375851816
266 | 388502524
267 | 425264873
268 | 401548737
269 | 333083297
270 | 343800468
271 | 367035296
272 | 348866000
273 | 393481181
274 | 383147421
275 | 394457147

It seems that your database shows the correct values. So there has to be some issue with mine.

The db-sync version i'm running is

thomasm@pop-os:~/src/cardano-db-sync$ db-sync-node/bin/cardano-db-sync --version
cardano-db-sync 9.0.0 - linux-x86_64 - ghc-8.10
git revision f300c630a89c08ed70a746676043e8f466cf5c5c

The cardano-node version is:

thomasm@pop-os:~/src/cardano-node$ cardano-node --version
cardano-node 1.27.0 - linux-x86_64 - ghc-8.10
git rev 8fe46140a52810b6ca456be01d652ca08fe730bf

I synced myself. The computer i run both components on is not 100% up and running. From time to time it is switch off for hours and even days (not sure if this is relevant).

Is there anything i can do to resync/update my state?

@erikd
Copy link
Contributor

erikd commented Jul 13, 2021

db-sync version 10.0.0 was released just recently. Please try that.

There is a known issue that can cause incomplete database entries (specifically the reward table) if db-sync is stopped and restarted. This will be fixed, but is broken in 10.0.0 and is probably broken in 9.0.0.

Is there anything i can do to resync/update my state?

If the current state is busted, unfortunately the only remedy is resyncing from scratch.

@erikd
Copy link
Contributor

erikd commented Jul 17, 2021

Can this be closed?

@erikd erikd closed this as completed Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants