Sfoglia il codice sorgente

minor review fixes

Mike Rolish 1 mese fa
parent
commit
e1b59b308e

+ 3 - 3
apps/hip-3-pusher/src/pusher/config.py

@@ -1,5 +1,5 @@
 from hyperliquid.utils.constants import MAINNET_API_URL, TESTNET_API_URL
-from pydantic import BaseModel, model_validator
+from pydantic import BaseModel, FilePath, model_validator
 from typing import Optional
 
 STALE_TIMEOUT_SECONDS = 5
@@ -7,7 +7,7 @@ STALE_TIMEOUT_SECONDS = 5
 
 class KMSConfig(BaseModel):
     enable_kms: bool
-    aws_kms_key_id_path: str
+    aws_kms_key_id_path: FilePath
 
 
 class LazerConfig(BaseModel):
@@ -33,7 +33,7 @@ class HyperliquidConfig(BaseModel):
     market_name: str
     market_symbol: str
     use_testnet: bool
-    oracle_pusher_key_path: str
+    oracle_pusher_key_path: FilePath
     publish_interval: float
     enable_publish: bool
 

+ 6 - 2
apps/hip-3-pusher/src/pusher/kms_signer.py

@@ -32,7 +32,11 @@ class KMSSigner:
 
         # AWS client and public key load
         self.client = _init_client()
-        self._load_public_key(config.kms.aws_kms_key_id_path)
+        try:
+            self._load_public_key(config.kms.aws_kms_key_id_path)
+        except Exception as e:
+            logger.exception("Failed to load public key from KMS; it might be incorrectly configured; error: {}", repr(e))
+            exit()
 
     def _load_public_key(self, key_path: str):
         # Fetch public key once so we can derive address and check recovery id
@@ -88,7 +92,7 @@ class KMSSigner:
                     nonce=timestamp,
                 )
             except Exception as e:
-                logger.exception("perp_deploy_set_oracle exception for endpoint: {} error: {}", exchange.base_url, e)
+                logger.exception("perp_deploy_set_oracle exception for endpoint: {} error: {}", exchange.base_url, repr(e))
 
         return None
 

+ 1 - 1
apps/hip-3-pusher/src/pusher/main.py

@@ -62,4 +62,4 @@ if __name__ == "__main__":
     try:
         asyncio.run(main())
     except Exception as e:
-        logger.exception("Uncaught exception, exiting: {}", e)
+        logger.exception("Uncaught exception, exiting; error: {}", repr(e))

+ 2 - 2
apps/hip-3-pusher/src/pusher/publisher.py

@@ -49,7 +49,7 @@ class Publisher:
             try:
                 self.publish()
             except Exception as e:
-                logger.exception("Publisher.publish() exception: {}", e)
+                logger.exception("Publisher.publish() exception: {}", repr(e))
 
     def publish(self):
         oracle_pxs = {}
@@ -98,7 +98,7 @@ class Publisher:
                     external_perp_pxs=external_perp_pxs,
                 )
             except Exception as e:
-                logger.exception("perp_deploy_set_oracle exception for endpoint: {} error: {}", exchange.base_url, e)
+                logger.exception("perp_deploy_set_oracle exception for endpoint: {} error: {}", exchange.base_url, repr(e))
 
         return None