olas-operate-middleware 0.10.10__py3-none-any.whl → 0.10.12__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: olas-operate-middleware
3
- Version: 0.10.10
3
+ Version: 0.10.12
4
4
  Summary:
5
5
  Author: David Vilela
6
6
  Author-email: dvilelaf@gmail.com
@@ -15,14 +15,14 @@ Requires-Dist: clea (==0.1.0rc4)
15
15
  Requires-Dist: cytoolz (==0.12.3)
16
16
  Requires-Dist: deepdiff (>=8.0.1,<9.0.0)
17
17
  Requires-Dist: docker (==6.1.2)
18
- Requires-Dist: eth-abi (==5.1.0)
18
+ Requires-Dist: eth-abi (==4.0.0)
19
19
  Requires-Dist: eth-account (==0.8.0)
20
20
  Requires-Dist: eth-hash (==0.7.0)
21
21
  Requires-Dist: eth-keyfile (==0.6.1)
22
22
  Requires-Dist: eth-keys (==0.4.0)
23
23
  Requires-Dist: eth-rlp (==0.3.0)
24
24
  Requires-Dist: eth-typing (==3.5.2)
25
- Requires-Dist: eth-utils (==2.3.1)
25
+ Requires-Dist: eth-utils (==2.2.0)
26
26
  Requires-Dist: fastapi (==0.110.3)
27
27
  Requires-Dist: frozenlist (==1.4.1)
28
28
  Requires-Dist: halo (==0.0.31)
@@ -7,7 +7,7 @@ operate/bridge/providers/native_bridge_provider.py,sha256=gG8bSyxUoAVEF6_J9tn1qK
7
7
  operate/bridge/providers/provider.py,sha256=i54RL7m4wMSADM_D_V_quQump_ipPTmByUc-c-AOLPQ,19687
8
8
  operate/bridge/providers/relay_provider.py,sha256=L7D-PKepsuBadarJmrNneZk0bsrh88u05uD6_2MSss4,17341
9
9
  operate/cli.py,sha256=REHgtFvaSs7jm7B0K1tPkEKco7Bmd06KQvYAQstFPyw,55783
10
- operate/constants.py,sha256=ilmLiv0H_xKZyfqmfEdqMci-TlLQyNPp9rrxxqtkqFI,2992
10
+ operate/constants.py,sha256=p_kYu4YyMnoZKHVrhhSjJlCCjWxRdSIzWfvQQeO8Ud4,3030
11
11
  operate/data/README.md,sha256=jGPyZTvg2LCGdllvmYxmFMkkkiXb6YWatbqIkcX3kv4,879
12
12
  operate/data/__init__.py,sha256=ttC51Yqk9c4ehpIgs1Qbe7aJvzkrbbdZ1ClaCxJYByE,864
13
13
  operate/data/contracts/__init__.py,sha256=_th54_WvL0ibGy-b6St0Ne9DX-fyjsh-tNOKDn-cWrg,809
@@ -58,7 +58,7 @@ operate/data/contracts/uniswap_v2_erc20/contract.yaml,sha256=XUdz-XtKtmZgLfItbO8
58
58
  operate/data/contracts/uniswap_v2_erc20/tests/__init__.py,sha256=3Arw8dsCsJz6hVOl0t9UjFASHXbV9yp3hw6x4HqgXpU,847
59
59
  operate/data/contracts/uniswap_v2_erc20/tests/test_contract.py,sha256=FzZbw9OTcr_yvjOXpk9YcO-K40eyDARyybcfSHDg2Ps,13392
60
60
  operate/keys.py,sha256=mPZ2KZujPjHZ1RNVD2vkLzK_3q6J32o9q0WCB6Raxs4,5237
61
- operate/ledger/__init__.py,sha256=s8GEcV-VtKdBQb9DqW7uf-tj_NpFNn13aNHCh0eqfaQ,3037
61
+ operate/ledger/__init__.py,sha256=hGTrWaPBRCodIFYUKVzfx_t_kpDa7SYyFjat8OhNRqA,3026
62
62
  operate/ledger/profiles.py,sha256=LaYPyz-1Cy-KRRuXk60W0ZXQJ2cwoWmDxYrL_psIdKo,11993
63
63
  operate/migration.py,sha256=mh921s8FG48XMfDu63ojrdhU7j_RZsdl5E2BvxsbkWE,16937
64
64
  operate/operate_http/__init__.py,sha256=dxCIVSUos23M4R-PFZZG6k5QrOlEiK0SxhCYSFNxh7U,4711
@@ -78,10 +78,10 @@ operate/resource.py,sha256=E59oIVqf6B6nN4LTmf_o2iCgLFAogTLPjm_cK6kMVxg,6305
78
78
  operate/services/__init__.py,sha256=isrThS-Ccu5Sc15JZgkN4uTAVaSg-NwUUSDeTyJEqLk,855
79
79
  operate/services/agent_runner.py,sha256=6tJePUJmlRxlIugT2fDaCJHSrQlDnl1t9pbg3-7EmCQ,7560
80
80
  operate/services/deployment_runner.py,sha256=Su73o7cdH6fkQfj468K77J04a_TWiokJwbMyVQ25xko,27067
81
- operate/services/health_checker.py,sha256=2KSEDxG3YmGolUDU--648ny0UJpTAAKvxkcr_VZQv-I,9654
82
- operate/services/manage.py,sha256=KFRaBLLkZNNtGSZ0ayC4z07HsJhyIVg4b6X5G-hxceE,118105
81
+ operate/services/health_checker.py,sha256=MuGZ0pQ7zyJVbNU9FJR5gR8zTE7z7kCH1h5Ampv9IC0,9837
82
+ operate/services/manage.py,sha256=5yUZPOFZYHVBV8KSZfGQf9JGsoTFZgfaCUsYbQdPlSw,118137
83
83
  operate/services/protocol.py,sha256=FoJmHz5nukI01-VYtReMsIl3JT5RgZZSLX-mf9EXQ90,62903
84
- operate/services/service.py,sha256=ZbkTryuK3kBkdvhxd9QDyXRxRFsGGG9WZqbLGOUPloc,39301
84
+ operate/services/service.py,sha256=1gjBu3yzwFKX54xEeyRZ_NzRjuYk_gpfWzS8JWTQ2xs,39319
85
85
  operate/services/utils/__init__.py,sha256=TvioaZ1mfTRUSCtrQoLNAp4WMVXyqEJqFJM4PxSQCRU,24
86
86
  operate/services/utils/mech.py,sha256=W2x4dqodivNKXjWU-Brp40QhoUHsIMyNAO7-caMoR0Q,3821
87
87
  operate/services/utils/tendermint.py,sha256=3h9nDb2Z89T0RwUr_AaVjqtymQmsu3u6DAVCfL_k1U0,25591
@@ -91,8 +91,8 @@ operate/utils/ssl.py,sha256=O5DrDoZD4T4qQuHP8GLwWUVxQ-1qXeefGp6uDJiF2lM,4308
91
91
  operate/wallet/__init__.py,sha256=NGiozD3XhvkBi7_FaOWQ8x1thZPK4uGpokJaeDY_o2w,813
92
92
  operate/wallet/master.py,sha256=jLFLcRgO6ADok2DigpK59PFJ4mnc_0H9a4RRioYzlvw,30811
93
93
  operate/wallet/wallet_recovery_manager.py,sha256=sXEZyvFMePxQKf9NJg4HT90mPg4-7ZcTbvggMnKKzhA,7795
94
- olas_operate_middleware-0.10.10.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
95
- olas_operate_middleware-0.10.10.dist-info/METADATA,sha256=ws4V3q2GY0du3aYLhO2xg6iMwIDcjiWT7wTykSUXHGA,2036
96
- olas_operate_middleware-0.10.10.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
97
- olas_operate_middleware-0.10.10.dist-info/entry_points.txt,sha256=dM1g2I7ODApKQFcgl5J4NGA7pfBTo6qsUTXM-j2OLlw,44
98
- olas_operate_middleware-0.10.10.dist-info/RECORD,,
94
+ olas_operate_middleware-0.10.12.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
95
+ olas_operate_middleware-0.10.12.dist-info/METADATA,sha256=hckT7Sd5e7xDjE38VbjWsuB068kkU1o5qDF7NzZSn6s,2036
96
+ olas_operate_middleware-0.10.12.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
97
+ olas_operate_middleware-0.10.12.dist-info/entry_points.txt,sha256=dM1g2I7ODApKQFcgl5J4NGA7pfBTo6qsUTXM-j2OLlw,44
98
+ olas_operate_middleware-0.10.12.dist-info/RECORD,,
operate/constants.py CHANGED
@@ -32,6 +32,7 @@ DEPLOYMENT_DIR = "deployment"
32
32
  DEPLOYMENT_JSON = "deployment.json"
33
33
  CONFIG_JSON = "config.json"
34
34
  USER_JSON = "user.json"
35
+ HEALTHCHECK_JSON = "healthcheck.json"
35
36
 
36
37
  AGENT_PERSISTENT_STORAGE_DIR = "persistent_data"
37
38
  AGENT_PERSISTENT_STORAGE_ENV_VAR = "STORE_PATH"
@@ -40,8 +40,8 @@ ARBITRUM_ONE_RPC = os.environ.get("ARBITRUM_ONE_RPC", "https://arb1.arbitrum.io/
40
40
  BASE_RPC = os.environ.get("BASE_RPC", "https://mainnet.base.org")
41
41
  CELO_RPC = os.environ.get("CELO_RPC", "https://forno.celo.org")
42
42
  ETHEREUM_RPC = os.environ.get("ETHEREUM_RPC", "https://ethereum.publicnode.com")
43
- GNOSIS_RPC = os.environ.get("GNOSIS_RPC", "https://rpc-gate.autonolas.tech/gnosis-rpc/")
44
- MODE_RPC = os.environ.get("MODE_RPC", "https://mainnet.mode.network/")
43
+ GNOSIS_RPC = os.environ.get("GNOSIS_RPC", "https://gnosis-rpc.publicnode.com")
44
+ MODE_RPC = os.environ.get("MODE_RPC", "https://mainnet.mode.network")
45
45
  OPTIMISM_RPC = os.environ.get("OPTIMISM_RPC", "https://mainnet.optimism.io")
46
46
  POLYGON_RPC = os.environ.get("POLYGON_RPC", "https://polygon-rpc.com")
47
47
  SOLANA_RPC = os.environ.get("SOLANA_RPC", "https://api.mainnet-beta.solana.com")
@@ -29,7 +29,7 @@ from traceback import print_exc
29
29
 
30
30
  import aiohttp # type: ignore
31
31
 
32
- from operate.constants import HEALTH_CHECK_URL
32
+ from operate.constants import HEALTHCHECK_JSON, HEALTH_CHECK_URL
33
33
  from operate.services.manage import ServiceManager # type: ignore
34
34
 
35
35
 
@@ -107,12 +107,14 @@ class HealthChecker:
107
107
  response_json = await resp.json()
108
108
 
109
109
  if service_path:
110
- healthcheck_json_path = service_path / "healthcheck.json"
110
+ healthcheck_json_path = service_path / HEALTHCHECK_JSON
111
111
  healthcheck_json_path.write_text(
112
112
  json.dumps(response_json, indent=2), encoding="utf-8"
113
113
  )
114
114
 
115
- return response_json.get("is_transitioning_fast", False)
115
+ return response_json.get(
116
+ "is_healthy", response_json.get("is_transitioning_fast", False)
117
+ ) # TODO: remove is_transitioning_fast after all the services start reporting is_healthy
116
118
  except Exception as e: # pylint: disable=broad-except
117
119
  self.logger.error(
118
120
  f"[HEALTH_CHECKER] error {e}. set not healthy!", exc_info=True
@@ -1895,21 +1895,23 @@ class ServiceManager:
1895
1895
  service = self.load(service_config_id=service_config_id)
1896
1896
  chain_config = service.chain_configs[chain]
1897
1897
  ledger_config = chain_config.ledger_config
1898
- staking_program_id = chain_config.chain_data.user_params.staking_program_id
1899
1898
  wallet = self.wallet_manager.load(ledger_config.chain.ledger_type)
1900
1899
  ledger_api = wallet.ledger_api(chain=ledger_config.chain, rpc=ledger_config.rpc)
1901
1900
  self.logger.info(
1902
1901
  f"OLAS Balance on service Safe {chain_config.chain_data.multisig}: "
1903
1902
  f"{get_asset_balance(ledger_api, OLAS[Chain(chain)], chain_config.chain_data.multisig)}"
1904
1903
  )
1904
+ current_staking_program = self._get_current_staking_program(
1905
+ service=service, chain=chain
1906
+ )
1905
1907
  staking_contract = get_staking_contract(
1906
1908
  chain=ledger_config.chain,
1907
- staking_program_id=staking_program_id,
1909
+ staking_program_id=current_staking_program,
1908
1910
  )
1909
1911
  if staking_contract is None:
1910
1912
  raise RuntimeError(
1911
- "No staking contract found for the current staking_program_id: "
1912
- f"{staking_program_id}. Not claiming the rewards."
1913
+ "No staking contract found for the "
1914
+ f"{current_staking_program=}. Not claiming the rewards."
1913
1915
  )
1914
1916
 
1915
1917
  sftxb = self.get_eth_safe_tx_builder(ledger_config=ledger_config)
@@ -1925,15 +1927,18 @@ class ServiceManager:
1925
1927
  .add(
1926
1928
  sftxb.get_claiming_data(
1927
1929
  service_id=chain_config.chain_data.token,
1928
- staking_contract=get_staking_contract(
1929
- chain=ledger_config.chain,
1930
- staking_program_id=staking_program_id,
1931
- ),
1930
+ staking_contract=staking_contract,
1932
1931
  )
1933
1932
  )
1934
1933
  .settle()
1935
1934
  )
1936
1935
 
1936
+ if receipt.status != 1:
1937
+ self.logger.error(
1938
+ f"Failed to claim staking rewards. Tx hash: {receipt.tx_hash}"
1939
+ )
1940
+ return 0
1941
+
1937
1942
  # transfer claimed amount from agents safe to master safe
1938
1943
  # TODO: remove after staking contract directly starts sending the rewards to master safe
1939
1944
  amount_claimed = int(receipt["logs"][0]["data"].hex(), 16)
@@ -2323,8 +2328,8 @@ class ServiceManager:
2323
2328
  await loop.run_in_executor(
2324
2329
  executor,
2325
2330
  self.claim_on_chain_from_safe,
2326
- service_config_id=service_config_id,
2327
- chain=service.home_chain,
2331
+ service_config_id,
2332
+ service.home_chain,
2328
2333
  )
2329
2334
  except Exception: # pylint: disable=broad-except
2330
2335
  logging.info(
@@ -68,6 +68,7 @@ from operate.constants import (
68
68
  CONFIG_JSON,
69
69
  DEPLOYMENT_DIR,
70
70
  DEPLOYMENT_JSON,
71
+ HEALTHCHECK_JSON,
71
72
  )
72
73
  from operate.keys import KeysManager
73
74
  from operate.operate_http.exceptions import NotAllowed
@@ -911,7 +912,7 @@ class Service(LocalResource):
911
912
 
912
913
  def get_latest_healthcheck(self) -> t.Dict:
913
914
  """Return the latest stored healthcheck.json"""
914
- healthcheck_json_path = self.path / "healthcheck.json"
915
+ healthcheck_json_path = self.path / HEALTHCHECK_JSON
915
916
 
916
917
  if not healthcheck_json_path.exists():
917
918
  return {}
@@ -924,7 +925,7 @@ class Service(LocalResource):
924
925
 
925
926
  def remove_latest_healthcheck(self) -> None:
926
927
  """Remove the latest healthcheck.json, if it exists"""
927
- healthcheck_json_path = self.path / "healthcheck.json"
928
+ healthcheck_json_path = self.path / HEALTHCHECK_JSON
928
929
 
929
930
  if healthcheck_json_path.exists():
930
931
  try: