-
Notifications
You must be signed in to change notification settings - Fork 513
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
Changes in Endorser Protocol #1134
Merged
andrewwhitehead
merged 11 commits into
openwallet-foundation:main
from
HarshMultani-AyanWorks:main
May 11, 2021
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
adf8256
Merge pull request #2 from hyperledger/main
HarshMultani-AyanWorks d9d90a1
Code to allow endorser to write the transaction to ledger, and code t…
HarshMultani-AyanWorks 6fbfbbd
Fixed Merge Conflicts
HarshMultani-AyanWorks a22c0b6
Resolved Merged Conflicts
HarshMultani-AyanWorks 33370b2
Merge branch 'main' of https://github.com/hyperledger/aries-cloudagen…
HarshMultani-AyanWorks 8d0b6f8
Merge branch 'hyperledger-main' into main
HarshMultani-AyanWorks 7871340
Fixed Integration tests and coded unit tests for messages and hanler …
HarshMultani-AyanWorks 978c18a
Fixed Unit tests for routes and manager (Endorser Protocol)
HarshMultani-AyanWorks 21246d4
Merge pull request #4 from hyperledger/main
HarshMultani-AyanWorks 17c0548
Fixed order of Imports
HarshMultani-AyanWorks 8130e52
Merge branch 'main' into main
ianco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...dagent/protocols/endorse_transaction/v1_0/handlers/transaction_acknowledgement_handler.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Transaction acknowledgement message handler.""" | ||
|
||
from .....messaging.base_handler import ( | ||
BaseHandler, | ||
BaseResponder, | ||
HandlerException, | ||
RequestContext, | ||
) | ||
|
||
from ..manager import TransactionManager, TransactionManagerError | ||
from ..messages.transaction_acknowledgement import TransactionAcknowledgement | ||
|
||
|
||
class TransactionAcknowledgementHandler(BaseHandler): | ||
"""Message handler class for Acknowledging transaction.""" | ||
|
||
async def handle(self, context: RequestContext, responder: BaseResponder): | ||
""" | ||
Handle transaction acknowledgement message. | ||
|
||
Args: | ||
context: Request context | ||
responder: Responder callback | ||
""" | ||
|
||
self._logger.debug( | ||
f"TransactionAcknowledgementHandler called with context {context}" | ||
) | ||
assert isinstance(context.message, TransactionAcknowledgement) | ||
|
||
if not context.connection_ready: | ||
raise HandlerException("No connection established") | ||
|
||
profile_session = await context.session() | ||
mgr = TransactionManager(profile_session) | ||
try: | ||
await mgr.receive_transaction_acknowledgement( | ||
context.message, context.connection_record.connection_id | ||
) | ||
except TransactionManagerError: | ||
self._logger.exception("Error receiving transaction acknowledgement") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
aries_cloudagent/protocols/endorse_transaction/v1_0/messages/transaction_acknowledgement.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""Represents a transaction acknowledgement message.""" | ||
|
||
from marshmallow import EXCLUDE, fields | ||
|
||
from .....messaging.valid import UUIDFour | ||
from .....messaging.ack.message import Ack, AckSchema | ||
|
||
from ..message_types import TRANSACTION_ACKNOWLEDGEMENT, PROTOCOL_PACKAGE | ||
|
||
HANDLER_CLASS = ( | ||
f"{PROTOCOL_PACKAGE}.handlers" | ||
".transaction_acknowledgement_handler.TransactionAcknowledgementHandler" | ||
) | ||
|
||
|
||
class TransactionAcknowledgement(Ack): | ||
"""Class representing a transaction acknowledgement message.""" | ||
|
||
class Meta: | ||
"""Metadata for a transaction acknowledgement message.""" | ||
|
||
handler_class = HANDLER_CLASS | ||
message_type = TRANSACTION_ACKNOWLEDGEMENT | ||
schema_class = "TransactionAcknowledgementSchema" | ||
|
||
def __init__( | ||
self, | ||
*, | ||
thread_id: str = None, | ||
**kwargs, | ||
): | ||
""" | ||
Initialize a transaction acknowledgement object. | ||
|
||
Args: | ||
thread_id: Thread id of transaction record | ||
""" | ||
super().__init__(**kwargs) | ||
self.thread_id = thread_id | ||
|
||
|
||
class TransactionAcknowledgementSchema(AckSchema): | ||
"""Transaction Acknowledgement schema class.""" | ||
|
||
class Meta: | ||
"""Transaction Acknowledgement metadata.""" | ||
|
||
model_class = TransactionAcknowledgement | ||
unknown = EXCLUDE | ||
|
||
thread_id = fields.Str(required=True, example=UUIDFour.EXAMPLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So this would be:
It would be around this many imports that adding another one starts to risk duplication, if they're out of order.