Skip to content

Conversation

@marcus290
Copy link
Contributor

@marcus290 marcus290 commented Dec 17, 2018

Currently cfund-proposal-state-accept fails in the last assert statement here:

# Wait for the proposal to expire
while int(time.time()) <= int(self.nodes[0].getproposal(proposalid0)["expiresOn"]):
    time.sleep(1)

blocks=slow_gen(self.nodes[0], 1)

assert(self.nodes[0].getproposal(proposalid0)["status"] == "expired waiting for end of voting period")

self.nodes[0].invalidateblock(blocks[-1])
assert(self.nodes[0].getproposal(proposalid0)["status"] == "accepted")

The code loops in 1s increments while checking for a proposal's deadline before generating 1 block and asserting the status. I think an additional block may sometimes be generated between the deadline and assert, so there are actually two blocks generated with status: "expired waiting for end of voting period" hence invalidating only one block will fail assert(self.nodes[0].getproposal(proposalid0)["status"] == "accepted") sometimes.

This PR:

  • turns off staking consistently in all cfund rpc tests
  • comments out console print statements for test output readability

Verifying this fix is hard because the test fails only sometimes. I tested locally and the revised test passed 20/20 times. I will look at this issue again if the test fails again.

@marcus290
Copy link
Contributor Author

Currently this test fails in Travis builds sometimes but not always.

I tried running it locally and the test fails about 2/30 times.

The test fails at line 158, assert(self.nodes[0].getproposal(proposalid0)["status"] == "accepted"), which is testing the status of a proposal which has just expired and changed from status: "accepted" to status: "expired waiting for end of voting period" then the block is invalidated (supposedly reverting the proposal status to accepted).

Checking with print statements, when the test fails, the proposal status is "expired waiting for end of voting period".

I think the issue could be caused by:

  • some problem with invalidateblock(); or
  • the status was changed >1 block beforehand, so invalidating 1 block is not enough to revert the status

@marcus290 marcus290 changed the title Testing cfund-proposal-state-accept.py in Travis - DON'T MERGE Turns off staking in cfund-proposal-state-accept.py and other cfund tests Dec 19, 2018
@aguycalled
Copy link
Member

have you tried printing getinfo() to check the block height?

@marcus290
Copy link
Contributor Author

good idea. I will try and rerun the tests

@marcus290
Copy link
Contributor Author

I re-ran the test 15 times and the block height is inconsistent by about ±1 block when staking is on. Indeed in some cases, there are 2 blocks with status: "expired waiting for end of voting period" before we call invalidateblock().

With staking off, the block height is consistent, which should fix this test failing.

@aguycalled aguycalled merged commit 6f157e4 into navcoin:master Dec 19, 2018
@matt-auckland matt-auckland added this to the 4.5.2 milestone Jan 31, 2019
aguycalled pushed a commit to skreener/navcoin-core that referenced this pull request Feb 3, 2019
…ests (navcoin#376)

* adds assert after try blocks and checks for preq creation during new state

* fixes update of PENDING_VOTING_PREQ state

* adds test to check accepted preq stay accepted

* assigns cycle number variable based on cfundstats

* adds print statements to debug in travis

* adds staking(false) to all cfund tests, also comments out print statements

* removes print statments
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.

3 participants