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

Prs/fix unittests active transactions.inactive votes cache election start #4409

Conversation

gr0vity-dev
Copy link
Contributor

@gr0vity-dev gr0vity-dev commented Jan 27, 2024

This testcase has 2 different issues.
This is not meant to be a real fix, but a help for further investigation.

Issue 1

[----------] 1 test from active_transactions
[ RUN      ] active_transactions.inactive_votes_cache_election_start
/Users/bl/Dev/Git/nano-node/nano/core_test/active_transactions.cpp:529: Failure
Expected equality of these values:
  0
  node.active.size ()
    Which is: 1
[  FAILED  ] active_transactions.inactive_votes_cache_election_start (5195 ms)

The reason for this failure is because there is a race condition between the block_cemented_callback and the priority scheduler loop. Sometimes the block gets cemented before the priority scheduler loop has started as you can see in the stats log below:

Screenshot 2024-01-26 at 22 03 07

--> I didn't know how to fix it, but added a delay in the block_cemented_callback to show that the error is gone.

Issue 2

[==========] Running 1 test from 1 test suite.
[ RUN      ] active_transactions.inactive_votes_cache_election_start
nano-node/nano/core_test/active_transactions.cpp:534: Failure
Value of: node.active.empty ()
  Actual: false
Expected: true
[  FAILED  ] active_transactions.inactive_votes_cache_election_start (327 ms)

I relaxed the conditions to timely, so the following will apply :

  • when node.ledger.cache.cemented_count is incremented, nano::test::confirmed eventually returns true
  • when nano::test::confirmed returns true for all blocks, node.active.empty ()will eventually return true

gr0vity-dev and others added 3 commits January 26, 2024 22:08
- no guarantee that `nano::test::confirmed` returns true for all blocks immediately after `node.ledger.cache.cemented_count` has been incremented for all the blocks
- no guarantee that `node.active.empty ()` is true directly after `nano::test::confirmed` returns true for all blocks
@gr0vity-dev gr0vity-dev marked this pull request as draft January 27, 2024 20:28
@gr0vity-dev gr0vity-dev closed this Feb 1, 2024
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

Successfully merging this pull request may close these issues.

1 participant