Page MenuHomePhabricator

[avalanche] verify signature on avahello reception

Authored by PiRK on Fri, May 21, 06:53.


Group Reviewers
Restricted Project
rABC819d42939969: [avalanche] verify signature on avahello reception

Verify the peer's signature using his delegated pubkey.
Add functional tests for the AvaHello handshake sequence.
Add a missing return at the end of the AvaHello branch in net_processing.cpp

Depends on D9564

Test Plan

ninja check-functional

Diff Detail

rABC Bitcoin ABC
Lint Not Applicable
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Fri, May 21, 06:53
Fabien added inline comments.
4025 ↗(On Diff #28562)

Out of scope here but at some point we might want a dedicated BCLog::AVALANCHE category

119 ↗(On Diff #28562)

Nit: if this is only use in send_avahello then you can define it there and avoid the leading _ which is not consistent with what is done in the codebase

412 ↗(On Diff #28562)

Style nit: you can use interface.wait_for_disconnect() to test the ban


Simplify TestNode.sendHello. Use waitfordisconnect to check banning behavior (reduces the test fragility if the logging changes)

deadalnix added inline comments.
3939 ↗(On Diff #28612)

This might become very spammy, no? In any case, this doesn't really help with anything because it doesn't have the relevant information to figure out what is going on.

remove logging on successfull signature verification. This makes it a difficult to test the success in the functional test. For the time being, checking that the good p2p interface is still connected after the bad one is disconnected is better than no test at all.

Improve the check that the good interface is still connected, using sync_with_ping. This raises AssertionError if no pong is received in response to ping.

Fabien requested changes to this revision.Mon, May 31, 07:11
Fabien added inline comments.
403 ↗(On Diff #28657)

Please do both: check the node is disconnected AND the reason it is disconnected. Otherwise you're not sure what you are testing, here you are looking for invalid-avahello-signature but you if you get an invalid-delegation the test will still pass.

408 ↗(On Diff #28657)

Move next to the good interface test instead of having it dandling

This revision now requires changes to proceed.Mon, May 31, 07:11

address review:

  • move sync_and_ping next to the corresponding code
  • add test for log message again to verify the reason the node is banned for
This revision is now accepted and ready to land.Mon, May 31, 08:41