Browse Source

refactor(config): update configuration for price update service and remove unused fields

Daniel Chew 8 months ago
parent
commit
61dcfe1517
2 changed files with 15 additions and 45 deletions
  1. 0 7
      apps/argus/config.sample.yaml
  2. 15 38
      apps/argus/src/config.rs

+ 0 - 7
apps/argus/config.sample.yaml

@@ -4,7 +4,6 @@ chains:
     contract_addr: 0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a
 
     # Keeper configuration for the chain
-    reveal_delay_blocks: 0
     gas_limit: 500000
 
     # Multiplier for the priority fee estimate, as a percentage (i.e., 100 = no change).
@@ -44,12 +43,6 @@ chains:
     # blocks after 5 blocks, then again after 10 blocks, and finally after 20 blocks.
     block_delays: [5, 10, 20]
 
-    # Historical commitments -- delete this block for local development purposes
-    commitments:
-      # prettier-ignore
-      - seed: [219,125,217,197,234,88,208,120,21,181,172,143,239,102,41,233,167,212,237,106,37,255,184,165,238,121,230,155,116,158,173,48]
-        chain_length: 10000
-        original_commitment_sequence_number: 104
 provider:
   uri: http://localhost:8080/
   chain_length: 100000

+ 15 - 38
apps/argus/src/config.rs

@@ -1,8 +1,5 @@
 use {
-    crate::{
-        api::ChainId,
-        chain::reader::{BlockNumber, BlockStatus},
-    },
+    crate::{api::ChainId, chain::reader::BlockStatus},
     anyhow::{anyhow, Result},
     clap::{crate_authors, crate_description, crate_name, crate_version, Args, Parser},
     ethers::types::Address,
@@ -35,26 +32,26 @@ const DEFAULT_HERMES_BASE_URL: &str = "https://hermes.pyth.network";
 #[command(version = crate_version!())]
 #[allow(clippy::large_enum_variant)]
 pub enum Options {
-    /// Run the Randomness Service.
+    /// Run the Price Update Service.
     Run(RunOptions),
 
-    /// Register a new provider with the Pyth Random oracle.
+    /// Register a new provider with the Pyth Pulse contract.
     RegisterProvider(RegisterProviderOptions),
 
     /// Set up the provider for all the provided chains.
     /// It registers, re-registers, or updates provider config on chain.
     SetupProvider(SetupProviderOptions),
 
-    /// Request a random number from the contract.
+    /// Request a price update from the contract.
     RequestRandomness(RequestRandomnessOptions),
 
-    /// Inspect recent requests and find unfulfilled requests with callback.
+    /// Inspect recent requests and find unfulfilled price update requests.
     Inspect(InspectOptions),
 
-    /// Generate a random number by running the entire protocol end-to-end
+    /// Generate a price update by running the entire protocol end-to-end
     Generate(GenerateOptions),
 
-    /// Get the status of a pending request for a random number.
+    /// Get the status of a pending request for a price update.
     GetRequest(GetRequestOptions),
 
     /// Withdraw any of the provider's accumulated fees from the contract.
@@ -115,15 +112,9 @@ pub struct EthereumConfig {
     /// URL of a Geth RPC wss endpoint to use for subscribing to blockchain events.
     pub geth_rpc_wss: Option<String>,
 
-    /// Address of a Pyth Randomness contract to interact with.
+    /// Address of a Pyth Pulse contract to interact with.
     pub contract_addr: Address,
 
-    /// reveal_delay_blocks - The difference between the block number with the
-    /// confirmed_block_status(see below) and the block number of a request to
-    /// Entropy should be greater than `reveal_delay_blocks` for Fortuna to reveal
-    /// its commitment.
-    pub reveal_delay_blocks: BlockNumber,
-
     /// The BlockStatus of the block that is considered confirmed.
     /// For example, Finalized, Safe, Latest
     #[serde(default)]
@@ -133,7 +124,7 @@ pub struct EthereumConfig {
     #[serde(default)]
     pub legacy_tx: bool,
 
-    /// The gas limit to use for entropy callback transactions.
+    /// The gas limit to use for price update callback transactions.
     pub gas_limit: u64,
 
     /// The percentage multiplier to apply to priority fee estimates (100 = no change, e.g. 150 = 150% of base fee)
@@ -173,9 +164,6 @@ pub struct EthereumConfig {
     #[serde(default)]
     pub fee: u128,
 
-    /// Historical commitments made by the provider.
-    pub commitments: Option<Vec<Commitment>>,
-
     /// Maximum number of hashes to record in a request.
     /// This should be set according to the maximum gas limit the provider supports for callbacks.
     pub max_num_hashes: Option<u32>,
@@ -273,34 +261,23 @@ impl EscalationPolicyConfig {
     }
 }
 
-/// A commitment that the provider used to generate random numbers at some point in the past.
-/// These historical commitments need to be stored in the configuration to support transition points where
-/// the commitment changes. In theory, this information is stored on the blockchain, but unfortunately it
-/// is hard to retrieve from there.
-#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
-pub struct Commitment {
-    pub seed: [u8; 32],
-    pub chain_length: u64,
-    pub original_commitment_sequence_number: u64,
-}
-
 /// Configuration values that are common to a single provider (and shared across chains).
 #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
 pub struct ProviderConfig {
-    /// The URI where clients can retrieve random values from this provider,
-    /// i.e., wherever fortuna for this provider will be hosted.
+    /// The URI where clients can retrieve price updates from this provider,
+    /// i.e., wherever Argus for this provider will be hosted.
     pub uri: String,
 
     /// The public key of the provider whose requests the server will respond to.
     pub address: Address,
 
-    /// The provider's private key, which is required to register, update the commitment,
+    /// The provider's private key, which is required to register, update provider information,
     /// or claim fees. This argument *will not* be loaded for commands that do not need
     /// the private key (e.g., running the server).
     pub private_key: SecretString,
 
     /// The provider's secret which is a 64-char hex string.
-    /// The secret is used for generating new hash chains
+    /// The secret is used for authentication purposes.
     pub secret: SecretString,
 
     /// The length of the hash chain to generate.
@@ -323,9 +300,9 @@ fn default_chain_sample_interval() -> u64 {
 /// Configuration values for the keeper service that are shared across chains.
 #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
 pub struct KeeperConfig {
-    /// If provided, the keeper will run alongside the Fortuna API service.
+    /// If provided, the keeper will run alongside the Argus API service.
     /// The private key is a 20-byte (40 char) hex encoded Ethereum private key.
-    /// This key is required to submit transactions for entropy callback requests.
+    /// This key is required to submit transactions for price update callback requests.
     /// This key *does not need to be a registered provider*. In particular, production deployments
     /// should ensure this is a different key in order to reduce the severity of security breaches.
     pub private_key: SecretString,