Page MenuHomePhabricator

[avalanche] Let the peermanager select whether a conflicting proof should be preferred
AbandonedPublic

Authored by Fabien on Sep 30 2021, 11:50.

Details

Reviewers
None
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Summary

The algorithm used to select whether a conflicting proof should be preferred over the others can be split in 2 categories:

If the proof master key is the same, then consider the replacement to be legit: after D10140 the proof needs to be signed by the proof master key owner. In this case the sequence number can be used to determine if the proof is to be replaced.

In the event the proof master is different, things are different. After D10151 it becomes possible to participate to a pooled proof by signing somebody else's (here the pool) master public key with the stake key. This lets the user the possibility to stake its utxo in a pool, and at the same time generate a conflicting proof with another master pubkey he owns. In order to prevent an adversarial user from maliciously generate such conflicting proofs and invalidate the whole pool, if the master public key from the conflicting proof mistmatch the current one, it is required to stake more coins in order to take precedence. If the amount is the same, then the lowest number of stakes is used (which means the utxos have more coins in average), and finally the proofid in case of equality.

Note that the latter case will only become useful once the staked coins are locked, which is not implemented yet. In the meantime a user can just move the coins to invalidate the proof. The algorithm accounts for the future case in order to not be a breaking change in the future.

Ref T1854.

Depends on D10221.

Test Plan
ninja check-avalanche-peermanager_tests

Diff Detail

Repository
rABC Bitcoin ABC
Branch
avalanche_peermanager_accept_proof
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16824
Build 33491: Build Diffbuild-without-wallet · lint-circular-dependencies · build-debug · build-diff · build-clang · build-clang-tidy
Build 33490: arc lint + arc unit