Open kayabaNerve opened 4 years ago
Because we update the Epochs before performing State manipulation, this should be a firm 2 complete Checkpoint periods for both.
When we update the codebase with this functionality, I'd like to make these integer constants. They're currently hardcoded, and I have a feeling this will make it much harder to change.
This was meant to be included in the original issue; when a TX defaults, we can't verify it when it finalizes. We MUST verify it after the checkpoint after it finalizes.
To provide context:
The reason Locked Merit exists is so if a Transaction, which is still pending, is considered verified, and then a dated Merit Holder appears and votes for a competitor, the competitor doesn't gain anything. It's primarily a way to make instant verification much safer, though it does have important impacts for Checkpoints as well, hence its timing.
The fact transactions can be indefinitely delayed from finalizing, via being brought up in Epochs, quickly breaks down these safety benefits, and make defining consensus much harder.
If a Merit Holder verifies a Transaction, once its archived, it'll be at least 5 more Blocks before their Merit is Locked. If a locked Merit Holder verifies a Transaction, they'll become unlocked after at least 5 more Blocks.
A Transaction takes 6 Blocks to verify so it always has a Checkpoint attached. After these 6 Blocks have been completed, I don't see any further value to bring up. This means a Transaction at max exists for 11 blocks. In order for Locked Merit to maintain its value at aiding instant Verifications, we need to require two complete Checkpoint periods before unlocking.
Unfortunately, the same applies in reverse to locking, somewhat. Instead of requiring one complete Checkpoint period to lock, we need to require two, OR implement advanced tracking of the state and make a lot of smaller decisions about edge cases. I rather just extend the Checkpoint periods for each. As a side note, depending on order of operations, one of these may need an extra Block added.
Once this is done, Consensus only needs to count Merit which is Unlocked at time of verifying the Transaction (or turned into Pending Merit at least one Block before).
As of right now, the discussion on #183, which spawned this issue, has Epochs using the raw Merit value. It should use the Unlocked Merit value, as this provides certainty around that.