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-2297, INDY-2302: Allow multiple active TAAs, change GET_TAA's reply format #1424

Merged
merged 24 commits into from
Dec 19, 2019

Conversation

Toktar
Copy link
Contributor

@Toktar Toktar commented Dec 5, 2019

No description provided.

TODO:
- Choose versions mechanism in the write_request_manager
- Add TAA validations for other requests

Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 5, 2019

This pull request introduces 2 alerts when merging 142f296 into 956cc45 - view on LGTM.com

new alerts:

  • 1 for Unused local variable
  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Dec 5, 2019

This pull request introduces 2 alerts when merging 3c6877c into 956cc45 - view on LGTM.com

new alerts:

  • 1 for Unused local variable
  • 1 for Unused import

Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 5, 2019

This pull request introduces 3 alerts when merging 8e92c92 into 956cc45 - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 5, 2019

This pull request introduces 3 alerts when merging b088222 into 956cc45 - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Unused local variable

Copy link
Member

@skhoroshavin skhoroshavin left a comment

Choose a reason for hiding this comment

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

I might be missing something, but - is there old TAA request handler, did I miss it somehow?

plenum/common/txn_util.py Outdated Show resolved Hide resolved
plenum/common/constants.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Dec 6, 2019

This pull request introduces 3 alerts when merging 91b7aae into fc5d8c0 - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 6, 2019

This pull request introduces 3 alerts when merging 1644abe into 8340342 - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Unused local variable

Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
@Toktar Toktar changed the title INDY-2297, INDY-2302: Allow multiple active TAAs, change GET_TAA's reply format [ci skip][INDY-2297, INDY-2302]: Allow multiple active TAAs, change GET_TAA's reply format Dec 16, 2019
@lgtm-com
Copy link

lgtm-com bot commented Dec 16, 2019

This pull request introduces 20 alerts when merging 01e8f50 into beb45f9 - view on LGTM.com

new alerts:

  • 19 for Unused import
  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2019

This pull request introduces 22 alerts when merging 115cd81 into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 1 for Unused local variable

@Toktar Toktar changed the title [ci skip][INDY-2297, INDY-2302]: Allow multiple active TAAs, change GET_TAA's reply format INDY-2297, INDY-2302: Allow multiple active TAAs, change GET_TAA's reply format Dec 17, 2019
@Toktar
Copy link
Contributor Author

Toktar commented Dec 17, 2019

test this please

@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2019

This pull request introduces 22 alerts when merging 9aa1ea5 into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 1 for Unused local variable

Copy link
Member

@skhoroshavin skhoroshavin left a comment

Choose a reason for hiding this comment

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

Code review part 1

plenum/common/constants.py Outdated Show resolved Hide resolved
plenum/server/batch_handlers/audit_batch_handler.py Outdated Show resolved Hide resolved
plenum/test/audit_ledger/helper.py Outdated Show resolved Hide resolved
plenum/test/audit_ledger/helper.py Outdated Show resolved Hide resolved
plenum/test/input_validation/test_client_taa_disable_op.py Outdated Show resolved Hide resolved
plenum/server/request_handlers/base_taa_handler.py Outdated Show resolved Hide resolved

class BaseTAAHandler(WriteRequestHandler, metaclass=ABCMeta):

def _update_txn_author_agreement(self, digest, seq_no, txn_time, text=None, version=None, retired=None):
Copy link
Member

Choose a reason for hiding this comment

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

This function looks a bit overcomplicated due to usage in very different scenarios. Probably it makes sense to split it into:

  • create_txn_author_agreement (which writes to all keys)
  • update_txn_author_agreement (which updates just key containing data)

plenum/server/request_managers/write_request_manager.py Outdated Show resolved Hide resolved
Andrew Nikitin and others added 3 commits December 17, 2019 16:48
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
[INDY-2302] Fix getting the latest taa digest
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2019

This pull request introduces 22 alerts when merging 59f2722 into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 1 for Unused local variable

plenum/test/req_handler/test_request_manager.py Outdated Show resolved Hide resolved
state_value[TXN_AUTHOR_AGREEMENT_TIMESTAMP] = None if retired else taa_txn_time

# Set a TAA
txn_author_agreement_handler.update_state(taa_txn, None, taa_request)
Copy link
Member

Choose a reason for hiding this comment

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

I think it is better to:

  • move preparation stage (writing TAA to state) to helper function
  • add case when we have more than one TAA in ledger when TAA_DISABLE is processed (and check that all of TAAs are disable)
  • add case when we send another TAA to ledger after sending TAA_DISABLE and make sure that all previously disabled TAAs stay disabled

plenum/test/txn_author_agreement/helper.py Outdated Show resolved Hide resolved
match='Transaction author agreement is already disabled'
):
sdk_send_txn_author_agreement_disable(looper, sdk_pool_handle, sdk_wallet_trustee)
assert get_txn_author_agreement() is None
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as in similar unit-like tests - having more cases would be very nice

@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2019

This pull request introduces 22 alerts when merging 7e5ef8d into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 1 for Unused local variable

Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2019

This pull request introduces 22 alerts when merging d4acabd into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 1 for Unused local variable

Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 18, 2019

This pull request introduces 22 alerts when merging ef899e3 into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 1 for Unused local variable

Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 18, 2019

This pull request introduces 23 alerts when merging d62d67b into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 2 for Unused local variable

Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 18, 2019

This pull request introduces 23 alerts when merging cf0527b into beb45f9 - view on LGTM.com

new alerts:

  • 21 for Unused import
  • 2 for Unused local variable

@Toktar
Copy link
Contributor Author

Toktar commented Dec 18, 2019

Test this please

Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 19, 2019

This pull request introduces 19 alerts when merging 0d981e6 into beb45f9 - view on LGTM.com

new alerts:

  • 17 for Unused import
  • 2 for Unused local variable

raise LogicError(
"Txn Author Agreement digest is not defined: version {}, seq_no {}, txn_time {}"
.format(taa[TXN_AUTHOR_AGREEMENT_VERSION], taa_seq_no, taa_txn_time)
if not self.get_taa_data():
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to get uncommitted TAA here, as committed is not guaranteed to be the same on all the nodes. So, if there is a request with accepted TAA sent right after this TAA is added to the ledger, there is a chance that it may be handled differently by nodes.

Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 19, 2019

This pull request introduces 19 alerts when merging 2d83217 into beb45f9 - view on LGTM.com

new alerts:

  • 17 for Unused import
  • 2 for Unused local variable

@Toktar Toktar merged commit 9df777f into hyperledger:master Dec 19, 2019
else:
raise InvalidClientTaaAcceptanceError(
request.identifier, request.reqId,
"Incorrect Txn Author Agreement(digest={}) in the request".format(r_taa_a_digest)
Copy link
Contributor

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 say:
Accepted Txn Author Agreement (digest={}) is not found on the ledger. Please make sure that an existing Agreement is accepted.".format(r_taa_a_digest)

"Txn Author Agreement acceptance digest is invalid or non-latest:"
" provided {}, expected {}"
.format(r_taa_a_digest, taa_digest)
"Txn Author Agreement is retired: version {}, seq_no {}, txn_time {}"
Copy link
Contributor

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 say:
Accepted Txn Author Agreement with version={} and digest={} is retired on {}. Please accept an active Agreement.

)

retired = taa.get(TXN_AUTHOR_AGREEMENT_RETIRED)
if retired and retired < req_pp_time:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be <=?

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

3 participants