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

diffRewardMap error for test that transfers funds from treasury to stake address using MIR certificate #981

Closed
ArturWieczorek opened this issue Dec 13, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@ArturWieczorek
Copy link
Contributor

OS:
Your OS: Linux Mint 20.2 Cinnamon
Linux Kernel: 5.4.0-90-generic

Machine Specs:
Processor: AMD Ryzen 9 3900X 12-Core Processor × 12
RAM: 32 GB

Versions
The db-sync version : 32e69cd7010686bc7438473e4c4c48511058a31d on master

PostgreSQL version: 12.8

Build/Install Method
The method you use to build or install cardano-db-sync:
cardano-db-syncwas built with nix using official instruction docs.

Run method
The method you used to run cardano-db-sync (eg Nix/Docker/systemd/none):

PGPASSFILE=config/pgpass db-sync-node/bin/cardano-db-sync --config config/config.yaml --socket-path ../cardano-node/state-node/node.socket --schema-dir schema/ --state-dir ledger-state/qa_cluster

Additional context
This was discovered during our nighlty tests. Error happened during a test that transfers funds from treasury to stake address using MIR certificate. This was for commit: 32e69cd on master however the validate.hs https://github.com/input-output-hk/cardano-db-sync/blob/master/cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Validate.hs has not been changed in 20 days so this can happen for version 12.0.0 of db-sync too.

The test: https://github.com/input-output-hk/cardano-node-tests/blob/master/cardano_node_tests/tests/test_governance.py#L602

Problem Report

diffRewardMap error for test that transfers funds from treasury to stake address using MIR certificate.

[db-sync-node:Error:1048] [2021-12-11 03:18:24.61 UTC] diffRewardMap:
[db-sync-node:Error:1048] [2021-12-11 03:18:24.61 UTC]   e011b1685a333acb205662f6f21a89668c21b3cb189e5ffc4b647e6c63: [(RwdTreasury,DbLovelace 50000000),(RwdTreasury,DbLovelace 50000000)] /= [(RwdTreasury,Coin 50000000)]
@ArturWieczorek ArturWieczorek added the bug Something isn't working label Dec 13, 2021
@erikd
Copy link
Contributor

erikd commented Dec 15, 2021

@ArturWieczorek What era does that transfer happen in? Are you sure there were not two transfers in that epoch?

@ArturWieczorek
Copy link
Contributor Author

ArturWieczorek commented Dec 15, 2021

@erikd It happens in Alonzo era.

This is one test https://github.com/input-output-hk/cardano-node-tests/blob/master/cardano_node_tests/tests/test_mir_certs.py#L429 but it is parametrized:

@pytest.mark.parametrize("fund_src", (RESERVES, TREASURY))

so in effect there are two test "instances", one sends funds from the reserves pot to stake address and the other one from treasury pot to stake address.

I asked about two transfers @mkoura and have some details from him:

Because of the locking mechanism tests cannot run at the same time on single cluster instance. It cannot run in single epoch either, because in one epoch the MIR cert is submitted, then the test waits for another epoch and checks the transfer. So the MIR certs cannot be submitted in the same epoch. Every MIR tests wait for another epoch to check the effect, so it cannot be side effect of other test either.

erikd pushed a commit that referenced this issue Feb 4, 2022
erikd pushed a commit that referenced this issue Feb 4, 2022
erikd pushed a commit that referenced this issue Feb 4, 2022
If a rollback is required across the point where rewards are inserted,
rewards may need to be reinserted. This is done using by inserting each
rewards and silently discarding any error if the record is already there.

Unfortunately detecting if a record is already there fails for null-able
fields and MIR reward payments have a NULL `pool_id` field because the
reward was not related to a pool.

This fix just does a manual test for all `reward` table entries with `NULL`
for the `pool_id` and checks that the record is absent before trying to
insert it.

Closes: #981
@erikd erikd closed this as completed in de10faa Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants