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

finalization_vote.py is floating #1092

Closed
cmihai opened this issue May 10, 2019 · 2 comments · Fixed by #1082
Closed

finalization_vote.py is floating #1092

cmihai opened this issue May 10, 2019 · 2 comments · Fixed by #1082
Labels
floating test A test that sometimes but not always fails

Comments

@cmihai
Copy link
Member

cmihai commented May 10, 2019

finalization_vote.py failed, Duration: 11 s
stdout:
2019-05-10T10:00:00.195000Z TestFramework (INFO): Initializing test directory /tmp/test_runner_U⋮_🏃_20190510_094946/finalization_vote_87
2019-05-10T10:00:00.195000Z TestFramework (INFO): Debug file at /tmp/test_runner_U⋮_🏃_20190510_094946/finalization_vote_87/node0/regtest/debug.log
Starting node 0 with args: 
Starting node 1 with args: -validating=1
Starting node 2 with args: -validating=1
Starting node 3 with args: -validating=1
2019-05-10T10:00:04.937000Z TestFramework (INFO): Finalizers voted after first block of new epoch
2019-05-10T10:00:07.906000Z TestFramework (INFO): Finalizers voted on a configured block number
2019-05-10T10:00:09.390000Z TestFramework (INFO): Finalizers voted after configured block number
2019-05-10T10:00:09.485000Z TestFramework (INFO): Tested outdated and invalid vote votes
2019-05-10T10:00:10.733000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/home/travis/build/dtr-org/unit-e/build/unit-e-x86_64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 203, in main
    self.run_test()
  File "/home/travis/build/dtr-org/unit-e/build/unit-e-x86_64-unknown-linux-gnu/test/functional/finalization_vote.py", line 170, in run_test
    self.wait_for_vote_and_disconnect(finalizer=finalizer3, node=node0)
  File "/home/travis/build/dtr-org/unit-e/build/unit-e-x86_64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 480, in wait_for_vote_and_disconnect
    assert_equal(len(new_txs), 1)
  File "/home/travis/build/dtr-org/unit-e/build/unit-e-x86_64-unknown-linux-gnu/test/functional/test_framework/util.py", line 42, in assert_equal
    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
AssertionError: not(2 == 1)
2019-05-10T10:00:10.785000Z TestFramework (INFO): Stopping nodes
2019-05-10T10:00:11.048000Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_U⋮_🏃_20190510_094946/finalization_vote_87
2019-05-10T10:00:11.048000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_U⋮_🏃_20190510_094946/finalization_vote_87/test_framework.log
2019-05-10T10:00:11.052000Z TestFramework (ERROR): Hint: Call /home/travis/build/dtr-org/unit-e/build/unit-e-x86_64-unknown-linux-gnu/test/functional/combine_logs.py '/tmp/test_runner_U⋮_🏃_20190510_094946/finalization_vote_87' to consolidate all logs

Full log: log.txt

@cmihai cmihai added the floating test A test that sometimes but not always fails label May 10, 2019
@dtr-org dtr-org deleted a comment from mergeable bot May 10, 2019
@dtr-org dtr-org deleted a comment from mergeable bot May 10, 2019
@frolosofsky
Copy link
Member

It is supposed to be fixed in #1082. @kostyantyn ?

@kostyantyn
Copy link
Member

@cmihai @frolosofsky I'll adjust the code in #1082 to fix the issue

kostyantyn pushed a commit that referenced this issue May 15, 2019
When we have two consecutive justifications, finalize the latest one instead of the previous one.

**Rationale**
Let's say we have these two consecutive justified links.
```
                J
source epoch ------- target hash                                          
|                              |
e2[101, .., 150] e3[151, ... 200] e4[201, ... 250]
                 |                              |
                 source epoch ------- target hash                                          
                                 J
``` 
In Casper the finalized epoch would be e4 and in our case it's e3. However, we proved in [feature_fork_choice_forked_finalize_epoch.py](https://github.com/dtr-org/unit-e/blob/master/test/functional/feature_fork_choice_forked_finalize_epoch.py) that reorging e4, in this case, is not possible anymore as it will revert finalization for e3. Because of that we introduced  `FinalizationState::GetCheckpointHeightAfterFinalizedEpoch` as a point of "not going back". However, if we count e4 as finalized, we can drop this extra entity. Moreover, we used to have such a convention and we changed but as it turned out wasn't a good idea.

**Aditional fix**
`CalculateWithdrawAmount` was broken as it didn't correctly take reward into account which led to a shrunk amount over time. We didn't have tests to catch it. Now we have `finalizationstate_calculate_withdraw_amount_tests.cpp` test that tests this part and shows that the amount is properly increasing. 

However the `finalization_withdraw.py` still shows that after withdraw the balance is not larger than the initial deposit (it's actually equal to initial deposit - fee). The reason is that the reward for finalizers is not implemented and I'll continue working on it in the following PR.

Resolves #1092

Signed-off-by: Kostiantyn Stepaniuk <[email protected]>
@dtr-org dtr-org deleted a comment from mergeable bot May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
floating test A test that sometimes but not always fails
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants