mech-client 0.2.17__tar.gz → 0.2.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {mech_client-0.2.17 → mech_client-0.2.19}/PKG-INFO +1 -1
  2. mech_client-0.2.19/mech_client/__init__.py +3 -0
  3. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/__init__.py +1 -1
  4. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/dialogues.py +1 -1
  5. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/message.py +1 -1
  6. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/protocol.yaml +4 -4
  7. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/serialization.py +1 -1
  8. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/p2p_libp2p_client/connection.py +21 -6
  9. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/p2p_libp2p_client/connection.yaml +7 -6
  10. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/interact.py +1 -0
  11. {mech_client-0.2.17 → mech_client-0.2.19}/pyproject.toml +1 -1
  12. mech_client-0.2.17/mech_client/__init__.py +0 -3
  13. {mech_client-0.2.17 → mech_client-0.2.19}/LICENSE +0 -0
  14. {mech_client-0.2.17 → mech_client-0.2.19}/README.md +0 -0
  15. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/acn.py +0 -0
  16. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/cli.py +0 -0
  17. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/configs/mechs.json +0 -0
  18. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/__init__.py +0 -0
  19. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/README.md +0 -0
  20. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/acn.proto +0 -0
  21. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/acn_pb2.py +0 -0
  22. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/custom_types.py +0 -0
  23. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/tests/__init__.py +0 -0
  24. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/tests/test_acn.py +0 -0
  25. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
  26. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
  27. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/README.md +0 -0
  28. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/__init__.py +0 -0
  29. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
  30. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
  31. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
  32. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/message.py +0 -0
  33. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
  34. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/serialization.py +0 -0
  35. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
  36. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
  37. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
  38. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
  39. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/mech_tool_management.py +0 -0
  40. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/prompt_to_ipfs.py +0 -0
  41. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/push_to_ipfs.py +0 -0
  42. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/subgraph.py +0 -0
  43. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/to_png.py +0 -0
  44. {mech_client-0.2.17 → mech_client-0.2.19}/mech_client/wss.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mech-client
3
- Version: 0.2.17
3
+ Version: 0.2.19
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -0,0 +1,3 @@
1
+ """Mech client."""
2
+
3
+ __version__ = "0.2.19"
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # ------------------------------------------------------------------------------
3
3
  #
4
- # Copyright 2023 valory
4
+ # Copyright 2024 valory
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # ------------------------------------------------------------------------------
3
3
  #
4
- # Copyright 2023 valory
4
+ # Copyright 2024 valory
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # ------------------------------------------------------------------------------
3
3
  #
4
- # Copyright 2023 valory
4
+ # Copyright 2024 valory
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -8,13 +8,13 @@ license: Apache-2.0
8
8
  aea_version: '>=1.0.0, <2.0.0'
9
9
  fingerprint:
10
10
  README.md: bafybeie7paijucvzemlfhwfmmhorypwuhzbeimgoitlkokdio5c3ne4pjq
11
- __init__.py: bafybeie6wesz6wnihjwdlbkhso6gtnpa4dkqdseb7susz2qseprlmcccam
11
+ __init__.py: bafybeicqlp4gkeeef5osp6zopjztlgat24nxrzq43cy7wbwxk5omf2sc2m
12
12
  acn.proto: bafybeidkun7o75sxpyk2sixt7dsykgty62f6dnixnes2irbunyamilqsh4
13
13
  acn_pb2.py: bafybeialafz3yomunwa3g5xgrdqwodzl7zg5dncvzuetv7xoew4zhw76ni
14
14
  custom_types.py: bafybeigpueuq6mdeyjyayzv3menkmemutfgfiwlozlpl64t67cfnnom24q
15
- dialogues.py: bafybeih2kwxi34hcrxbb3cmhtpo5k5fc4hlgsb3qnifpyeefou63c4qc2a
16
- message.py: bafybeibkjeytosfqptmqph3xwdcnmokgoen2xw2s44736potgrjr43vlmy
17
- serialization.py: bafybeibbs5uepy6s5jb5eyzdav6i2hejy26zkocqe236kxmoknkqpsi7iu
15
+ dialogues.py: bafybeidjpyk7s3getyfegjdrgrt5blf2yutzqclohaktjehwcj3sqx2ole
16
+ message.py: bafybeiai7kond3rcbtwnr5xgpwzuauf5tusuep6ikopi4cqvp2wa5qfz3e
17
+ serialization.py: bafybeidu7fzixk6sm3iprhph4shbiq5qgvg56lg4yiryfaf3unuqk34bwi
18
18
  tests/__init__.py: bafybeidteufp2npjd77ekcftk5e4gbaquq3gike5nxtk5xfmnusls56keu
19
19
  tests/test_acn.py: bafybeignjgdtlfdnj25hc5necmg7zl3kvngsmzkjgcwfm5qg36liqa63ki
20
20
  tests/test_acn_dialogues.py: bafybeia2kndutaokjpogo4wlb5pf4gkqacvcbngqromf4g4mzu6wyetz7q
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # ------------------------------------------------------------------------------
3
3
  #
4
- # Copyright 2023 valory
4
+ # Copyright 2024 valory
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # ------------------------------------------------------------------------------
3
3
  #
4
- # Copyright 2022-2023 Valory AG
4
+ # Copyright 2022-2024 Valory AG
5
5
  # Copyright 2018-2019 Fetch.AI Limited
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -279,6 +279,7 @@ class P2PLibp2pClientConnection(Connection):
279
279
  connection_id = PUBLIC_ID
280
280
 
281
281
  DEFAULT_CONNECT_RETRIES = 3
282
+ DEFAULT_RESEND_ENVELOPE_RETRY = 1
282
283
  DEFAULT_TLS_CONNECTION_SIGNATURE_TIMEOUT = 5.0
283
284
 
284
285
  def __init__(self, **kwargs: Any) -> None:
@@ -292,6 +293,9 @@ class P2PLibp2pClientConnection(Connection):
292
293
  self.connect_retries = self.configuration.config.get(
293
294
  "connect_retries", self.DEFAULT_CONNECT_RETRIES
294
295
  )
296
+ self.resend_envelope_retry = self.configuration.config.get(
297
+ "resend_envelope_retry", self.DEFAULT_RESEND_ENVELOPE_RETRY
298
+ )
295
299
  ledger_id = self.configuration.config.get("ledger_id", DEFAULT_LEDGER)
296
300
  if ledger_id not in SUPPORTED_LEDGER_IDS:
297
301
  raise ValueError( # pragma: nocover
@@ -386,11 +390,17 @@ class P2PLibp2pClientConnection(Connection):
386
390
  )
387
391
  await asyncio.shield(self.disconnect())
388
392
 
389
- async def _send_envelope_with_node_client(self, envelope: Envelope) -> None:
393
+ async def _send_envelope_with_node_client(
394
+ self, envelope: Envelope, retry_counter: int = 0
395
+ ) -> None:
390
396
  """Send envelope with node client, reconnect and retry on fail."""
391
397
  if not self._node_client: # pragma: nocover
392
398
  raise ValueError("Connection not connected to node!")
393
-
399
+ if retry_counter > self.resend_envelope_retry:
400
+ self.logger.warning(
401
+ f"Dropping envelope {envelope}. It failed after retry. "
402
+ )
403
+ return
394
404
  self._ensure_valid_envelope_for_external_comms(envelope)
395
405
  try:
396
406
  await self._node_client.send_envelope(envelope)
@@ -399,7 +409,7 @@ class P2PLibp2pClientConnection(Connection):
399
409
  "Exception raised on message send. Try reconnect and send again."
400
410
  )
401
411
  await self._perform_connection_to_node()
402
- await self._node_client.send_envelope(envelope)
412
+ await self._send_envelope_with_node_client(envelope, retry_counter + 1)
403
413
 
404
414
  async def connect(self) -> None:
405
415
  """Set up the connection."""
@@ -584,9 +594,14 @@ class P2PLibp2pClientConnection(Connection):
584
594
  envelope = await self._read_envelope_from_node()
585
595
  if self._in_queue is None:
586
596
  raise ValueError("Input queue not initialized.") # pragma: nocover
587
- self._in_queue.put_nowait(envelope)
597
+ self.logger.debug(f"Received envelope: {envelope}")
588
598
  if envelope is None:
589
- break # pragma: no cover
599
+ # give it time to recover
600
+ # twice the amount what we wait for ACK timeouts
601
+ timeout = NodeClient.ACN_ACK_TIMEOUT * 2
602
+ await asyncio.sleep(timeout)
603
+ continue # pragma: no cover
604
+ self._in_queue.put_nowait(envelope)
590
605
 
591
606
 
592
607
  class TCPSocketChannelClientTLS(TCPSocketChannelClient):
@@ -10,14 +10,15 @@ aea_version: '>=1.0.0, <2.0.0'
10
10
  fingerprint:
11
11
  README.md: bafybeiaf5kdnfdc2jifojgniib76zl2c4utnx7ofewc3szqkrxsby62ulu
12
12
  __init__.py: bafybeid2azroxglu6fl7bxdfcsv3j77vyzgpikjnfwpxg73zeb5orez6ju
13
- connection.py: bafybeiauso3ectgdvbhkt5j6wstfev5mnxiuj6hrkczyqgxurnvva3loqm
13
+ connection.py: bafybeihcwyo5nhxmsjxw7qrrvkvp7qu6izbgzgipmmnrpdvc6jtwmw7vgy
14
14
  fingerprint_ignore_patterns: []
15
15
  connections: []
16
16
  protocols:
17
- - valory/acn:1.1.0:bafybeic2pxzfc3voxl2ejhcqyf2ehm4wm5gxvgx7bliloiqi2uppmq6weu
17
+ - valory/acn:1.1.0:bafybeidluaoeakae3exseupaea4i3yvvk5vivyt227xshjlffywwxzcxqe
18
18
  class_name: P2PLibp2pClientConnection
19
19
  config:
20
20
  connect_retries: 3
21
+ resend_envelope_retry: 1
21
22
  ledger_id: cosmos
22
23
  nodes:
23
24
  - uri: acn.staging.autonolas.tech:9005
@@ -29,15 +30,15 @@ cert_requests:
29
30
  - identifier: acn
30
31
  ledger_id: ethereum
31
32
  message_format: '{public_key}'
32
- not_after: '2024-01-01'
33
- not_before: '2023-01-01'
33
+ not_after: '2025-01-01'
34
+ not_before: '2024-01-01'
34
35
  public_key: 02d3a830c9d6ea1ae91936951430dee11f4662f33118b02190693be835359a9d77
35
36
  save_path: .certs/acn_cosmos_9005.txt
36
37
  - identifier: acn
37
38
  ledger_id: ethereum
38
39
  message_format: '{public_key}'
39
- not_after: '2024-01-01'
40
- not_before: '2023-01-01'
40
+ not_after: '2025-01-01'
41
+ not_before: '2024-01-01'
41
42
  public_key: 02e741c62d706e1dcf6986bf37fa74b98681bc32669623ac9ee6ff72488d4f59e8
42
43
  save_path: .certs/acn_cosmos_9006.txt
43
44
  excluded_protocols: []
@@ -455,6 +455,7 @@ def wait_for_data_url( # pylint: disable=too-many-arguments
455
455
  :rtype: Any
456
456
  """
457
457
  loop = asyncio.new_event_loop()
458
+ asyncio.set_event_loop(loop)
458
459
  tasks = []
459
460
 
460
461
  if confirmation_type in (
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mech-client"
3
- version = "0.2.17"
3
+ version = "0.2.19"
4
4
  description = "Basic client to interact with a mech"
5
5
  authors = ["David Minarsch <david.minarsch@googlemail.com>"]
6
6
  readme = "README.md"
@@ -1,3 +0,0 @@
1
- """Mech client."""
2
-
3
- __version__ = "0.2.17"
File without changes
File without changes