-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INDY-1983] Tracking PP first validation time to check their obsolescences #1155
[INDY-1983] Tracking PP first validation time to check their obsolescences #1155
Conversation
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
plenum/server/replica.py
Outdated
@@ -1049,11 +1057,17 @@ def process_three_phase_msg(self, msg: ThreePhaseMsg, sender: str): | |||
""" | |||
sender = self.generateName(sender, self.instId) | |||
|
|||
pp_key = (msg, sender) if isinstance(msg, PrePrepare) else None | |||
if pp_key and (pp_key not in self.pre_prepare_tss): | |||
self.pre_prepare_tss[pp_key] = self.utc_epoch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to use self.get_time_for_3pc_batch
for better unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -2650,7 +2672,7 @@ def process_requested_prepare(self, prepare: Prepare, sender: str): | |||
def process_requested_commit(self, commit: Commit, sender: str): | |||
return self._process_requested_three_phase_msg(commit, sender, self.requested_commits) | |||
|
|||
def is_pre_prepare_time_correct(self, pp: PrePrepare) -> bool: | |||
def is_pre_prepare_time_correct(self, pp: PrePrepare, sender: str) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to cover this by unit tests. See, for example, test_replica_freshness.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
…-1983-ts-container-for-pp Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
@@ -165,6 +167,16 @@ class PrePrepare(MessageBase): | |||
) | |||
typename = PREPREPARE | |||
|
|||
def _post_process(self, input_as_dict: Dict) -> Dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to make PrePrepare hashable
# Dictionary: | ||
# key: Tuple[pp.viewNo, pp.seqNo] | ||
# value: Dict[PrePrepare, Tuple[sender, timestamp]] | ||
self.pre_prepare_tss = defaultdict(dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to have a dict of dict and store pre-prepares there?
I think just a simple Dict[(pp.viewNo, pp.seqNo), timestamp] is enough, isn't it?
If this is because of duplicate PrePrepares for the same 3PC key, then this is invalid PrePrepare, which is validated with PP_CHECK_DUPLICATE raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dict[(pp.viewNo, pp.seqNo), timestamp] won't work since:
- the same PrePrepare might come multiple times (e.g. for PP that includes not finalized requests, or missed previous PP or with bad timestamps), but we need to set timestamp only first time
- (pp.viewNo, pp.seqNo) might be the same for multiple different PPs (different senders, or single malicious one)
plenum/test/node_catchup_with_3pc/test_pp_obsolescence_check_fail_for_delayed.py
Outdated
Show resolved
Hide resolved
|
||
# Now delayed 3PC messages reach lagging node, so any transactions missed during | ||
# catch up can be ordered, ensure that all nodes will have same data after that | ||
ensure_all_nodes_have_same_data(looper, txnPoolNodeSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assume that all PPs will be rejected for the lagging node, don't we? If so, how the lagging node may have the same data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By requesting PP missed for Commits/Prepares
plenum/test/node_catchup_with_3pc/test_pp_obsolescence_check_fail_for_delayed.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
…-1983-ts-container-for-pp
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
…-1983-ts-container-for-pp
_fields = {} | ||
|
||
|
||
class FakePrePrepare(FakeMessageBase, PrePrepare): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need FakePrePrepare here? Why don't use just PrePrepare?
tconf.ACCEPTABLE_DEVIATION_PREPREPARE_SECS = old_value | ||
|
||
|
||
# TODO INDY-2047: this test should actually fail once the bug is fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the test will fail after INDY-2047 is fixed?
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
…-1983-ts-container-for-pp Signed-off-by: Andrey Kononykhin <andkononykhin@gmail.com>
No description provided.