Skip to content
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-1385] Fix last_prepared_sertificate computing #786

Merged
merged 9 commits into from
Jul 4, 2018

Conversation

lampkin-diet
Copy link

For now, last prepared serticate is max 3PC key of quorumed prepares.

Andrew Nikitin added 5 commits June 27, 2018 09:38
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
sdk_wallet_steward):
A, B, C, D = txnPoolNodeSet
for n in [A, B, C]:
# Do not send prepares and prepares for Delta node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepares and pre-prepares

# Do not send prepares and prepares for Delta node
D.nodeIbStasher.delay(pDelay(1000, 0, sender_filter=n.name))
D.nodeIbStasher.delay(ppDelay(1000, 0, sender_filter=n.name))
sdk_send_random_and_check(looper,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need to send 5 requests and override tconf.Max3PCBatchSize?

for n in [A, B, C]:
# Do not send prepares to Delta node
D.nodeIbStasher.delay(pDelay(1000, 0, sender_filter=n.name))
sdk_send_random_and_check(looper,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need to send 5 requests and override tconf.Max3PCBatchSize?

assert D.master_replica.prepares
# There is no quorum for all prepares
for key in D.master_replica.prepares.keys():
assert D.master_replica.prepares.hasQuorum(ThreePhaseKey(*key), quorum) == False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert not ?

yield tconf
tconf.Max3PCBatchSize = old_m


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it the same tests as above?

for key in self.prepares.keys():
if self.prepares.hasQuorum(ThreePhaseKey(*key), quorum):
keys.append(key)
return max_3PC_key(keys) if keys else None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test that we get the maximum value as last prepared

@@ -0,0 +1,31 @@
import pytest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be sufficient to have just unit tests here:
See test/replica/test_api.py

Andrew Nikitin added 2 commits July 3, 2018 11:39
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
@@ -4,6 +4,8 @@
from plenum.test.helper import sdk_send_random_and_check


txnCount = 5

@pytest.fixture(scope="module")
def tconf(tconf):
old_m = tconf.Max3PCBatchSize
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this test unit as well?

@@ -5,6 +5,8 @@
from plenum.test.helper import sdk_send_random_and_check


txnCount = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this test unit as well?

txnRootHash='Hhyw96wihpeG9whMNuyPhUcTV76HiHcYJrepDsjuarYJ',
viewNo=0))
replica.prepares[(0, 2)] = ThreePhaseVotes(voters=('Delta:0',),
msg=Prepare(digest='12a05a12df55d4595807ec6edaf3bc36766feb4ab5479a5b45434a4288c9871b',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a helper method to create a Prepare

Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
@ashcherbakov
Copy link
Contributor

test this please

Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
@ashcherbakov ashcherbakov merged commit 15a95aa into hyperledger:master Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants