Repository navigation
dbft: forbid watch-only nodes to request missing transactions - #169
Conversation
Explicitly ask the user not to modify the list of transactions and the map of missing hashes got from (PrepareRequest).Transactions(). Modification will lead to improper library functioning since dBFT relies on the same map in (*Context).hasAllTransactions(). Ref. bane-labs/go-ethereum#655 (comment). Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
07ac261 to
a4ecd4b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #169 +/- ##
==========================================
- Coverage 62.11% 62.09% -0.02%
==========================================
Files 32 32
Lines 1560 1562 +2
==========================================
+ Hits 969 970 +1
- Misses 590 591 +1
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@roman-khimov if we'd like to preserve the old behaviour (backup node is not able to construct block in case if some transactions are missing) then the first commit is enough. On the other hand, if all transactions are present in the watch-only's mempool then it's able to advance state machine and move forward with it's own local block construction (according to usages of Line 70 in baa1d86 From that point, watch-only may be allowed to process missing transactions the same way as proper CN nodes. If so, then I'd suggest to replace this condition: Lines 176 to 180 in baa1d86 by the following one: if !(d.IsBackup() || d.Context.WatchOnly()) || d.NotAcceptingPayloadsDueToViewChanging() ||
!d.RequestSentOrReceived() || d.ResponseSent() || d.PreCommitSent() ||
d.CommitSent() || d.BlockSent() || d.hasAllTransactions() {
return
}
Lines 61 to 63 in baa1d86 But still, it's a library behaviour change. Implemented in the second commit, ACK? |
b63219f to
ba151aa
Compare
roman-khimov
left a comment
There was a problem hiding this comment.
I'd say that watch-only shouldn't request for missing transactions. It'll be almost irrelevant with Iara anyway and I'd expect watch-only to be passive, not actively trying to create a block (even though it can). Practically watch-only is two cases:
- committee node that has a key, but is not a validator
- some monitoring node running for fun
Both can just log things happening, but both don't need to construct/check a block. And not doing it seems simpler.
5d428ee to
3d573a4
Compare
Don't modify processMissingTx itself, all callers aimed to decide by themselves if they need to ask for a missing tx. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
3d573a4 to
63e6948
Compare
|
Now watch-only node is not allowed neither process nor request missing transactions, so if something is missing then it'll stuck at the intermediate consensus state until block is received through the network. |
|
Just for the record, C# watch-only node requests missing transactions: https://github.com/neo-project/neo-node/blob/ccd6a4bb09bae3efc4c2a4b86043b3415ad6cbd9/plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs#L177, so we'll have a difference in behaviour. |
(PrepareRequest).Transactions(). Modification will lead to improper library functioning since dBFT relies on the same map in(*Context).hasAllTransactions(). Ref. consensus: migrate to extended PrepareRequest format bane-labs/go-ethereum#655 (comment).