Jayant Krishnamurthy 2 роки тому
батько
коміт
1564364420
2 змінених файлів з 25 додано та 0 видалено
  1. 11 0
      price_pusher/src/aptos/aptos.ts
  2. 14 0
      price_pusher/src/sui/sui.ts

+ 11 - 0
price_pusher/src/aptos/aptos.ts

@@ -69,6 +69,17 @@ export class AptosPriceListener extends ChainPriceListener {
 
 // Derivation path for aptos accounts
 export const APTOS_ACCOUNT_HD_PATH = "m/44'/637'/0'/0'/0'";
+
+/**
+ * The `AptosPricePusher` is designed for high-throughput of price updates.
+ * Achieving this property requires sacrificing some nice-to-have features of other
+ * pusher implementations that can reduce cost when running multiple pushers. Specifically,
+ * this implementation does not use `update_price_feeds_if_necssary` and simulate the transaction
+ * before submission.
+ *
+ * If multiple instances of this pusher are running in parallel, both of them will
+ * land all of their pushed updates on-chain.
+ */
 export class AptosPricePusher implements IPricePusher {
   // The last sequence number that has a transaction submitted.
   private lastSequenceNumber: number | undefined;

+ 14 - 0
price_pusher/src/sui/sui.ts

@@ -91,6 +91,20 @@ export class SuiPriceListener extends ChainPriceListener {
   }
 }
 
+/**
+ * The `SuiPricePusher` is designed for high-throughput of price updates.
+ * Achieving this property requires sacrificing some nice-to-have features of other
+ * pusher implementations that can reduce cost when running multiple pushers. It also requires
+ * jumping through some Sui-specific hoops in order to maximize parallelism.
+ *
+ * The two main design features are:
+ * 1. This implementation does not use `update_price_feeds_if_necssary` and simulate the transaction
+ *    before submission. If multiple instances of this pusher are running in parallel, all of them will
+ *    land all of their pushed updates on-chain.
+ * 2. The pusher will split the Coin balance in the provided account into a pool of different Coin objects.
+ *    Each transaction will be allocated a Coin object from this pool as needed. This process enables the
+ *    transactions to avoid referencing the same owned objects, which allows them to be processed in parallel.
+ */
 export class SuiPricePusher implements IPricePusher {
   constructor(
     private readonly signer: RawSigner,