Page MenuHomePhabricator

[avalanche] Test framework: don't assume the p2p avaproof messages are using the legacy format
ClosedPublic

Authored by Fabien on Mar 2 2022, 10:50.

Details

Summary

This is continuing the work from D11117 to remove the test framework assumptions about the proof format. This diff attempts to deserialize the p2p messages with the new format, and fallback to the legacy format if it fails. This makes the event callback work with both the new and legacy formats, and the test can still check the type match expectation if needed. The correct fallback handling is demonstrated by the tests still passing.

Test Plan
ninja check-functional-extended

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Mar 2 2022, 10:50
This revision is now accepted and ready to land.Mar 2 2022, 11:17

Note that this assumes that a msg_avaproof instance is only used once, or at the very least is always reused with the same proof type, which seems like a reasonable assumption. It would fail if someone tried something crazy like deserializing a LegacyAvalancheProof first, then an AvalancheProof second because self.proof is not reset.