iotaledger / iota-core

Apache License 2.0
60 stars 12 forks source link

TipManager: how to deal and (possibly) include invalid blocks (aka. very dirty Tangle) #90

Closed karimodm closed 8 months ago

piotrm50 commented 9 months ago

Let's think about this again after the recent changes to the tipmanager.

jonastheis commented 8 months ago

I think we're currently not including invalid blocks or invalid transactions to the TipManager as these are discarded when the invalidity is established, i.e. before reaching the TipManager. The TipManager as such does not need to worry about invalid blocks.

Invalid blocks

Invalid transactions

Open questions

piotrm50 commented 8 months ago

Blocks are marked as invalid if their transaction is orphaned and the orphaned slot is below the block's slotcommitment slot.

Is that correct though? If transaction is invalid we still book the block carrying that transaction. Why should it be otherwise if the transaction is orphaned when we try to book the block? Shouldn't we treat it the same as an invalid transaction in this case?

A transaction is orphaned when:

This also seems prone to race conditions, because if one node orphans the transaction, evicts it and then processes a new attachment of that transaction, it would not mark the block as invalid and would successfully attach the transaction to the mempool (as it already forgot about the orphaned version). However if a node evicts slightly later and sees the same block, it would not add a fresh attachments to the mempool (because it still has the orphaned version), and would mark the block (and it's whole future cone) as invalid.

piotrm50 commented 8 months ago

Created more specific issues for the above open questions. Closing this one as the core question seems to be clear and not a problem.