Page MenuHomePhabricator

[avalanche] Fix the abc_p2p_proof_inventory test
ClosedPublic

Authored by Fabien on Jun 18 2021, 06:33.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABCdca56be2c6bd: [avalanche] Fix the abc_p2p_proof_inventory test
Summary

The test can fail under some condition because it waits for a proof to
become orphaned by waiting for the proof to be known by the node then
asserting its orphan state. But the proof is already known valid before
this call, so it is possible that the assertion fails because the proof
has not be oprhaned yet.
This diff fixes the test by waiting for the proof to turn orphan.

Ref T1611.

Test Plan
ninja check-functional

Diff Detail

Repository
rABC Bitcoin ABC
Branch
fix_p2p_proof_inventory
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16034
Build 31963: Build Diffbuild-without-wallet · build-debug · build-clang-tidy · build-diff · build-clang
Build 31962: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Jun 18 2021, 06:33
deadalnix requested changes to this revision.Jun 18 2021, 15:26
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
test/functional/test_framework/avatools.py
142 ↗(On Diff #28949)

bool args are generally a smell. in this case you get around it by using named arguments, which is good, but that means you should put it at the end.

151 ↗(On Diff #28949)

This will wait forever in case of failure.

If the proof has the wrong state, then it must be an error right away. If some event is supposed to trigger a state change, like a reorg, then the proper way to handle this is to wait on the reorg to happen, then check for the proof.

This revision now requires changes to proceed.Jun 18 2021, 15:26
Fabien planned changes to this revision.Jun 21 2021, 07:45
Fabien added inline comments.
test/functional/test_framework/avatools.py
151 ↗(On Diff #28949)

That makes sense but it defeats my use case, which is to wait for a proof to turn orphan while being already known by the node.
I will do the fix a bit differently because wait_for_proof is not exactly what I need, and update this one to only do the code simplification as a follow-up.

Fabien edited the summary of this revision. (Show Details)

Only fix the test by waiting for the proof to turn orphan

deadalnix added inline comments.
test/functional/abc_p2p_proof_inventory.py
288

You could use a lambda, the current code is highly redundant.

This revision is now accepted and ready to land.Jun 23 2021, 14:00