Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0 nitpicks #78

Merged
merged 3 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyth-agent"
version = "2.0.0"
version = "2.0.1"
edition = "2021"

[[bin]]
Expand Down
4 changes: 4 additions & 0 deletions config/config.sample.pythnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ key_store.mapping_key = "AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"
# Pythnet accumulator key
key_store.accumulator_key = "7Vbmv1jt4vyuqBZcpYPpnVhrqVe5e6ZPb6JxDcffRHUM"

# IMPORTANT: Exporter batch size must be decreased to 7 to support
# larger accumulator transactions, when accumulator_key is set.
exporter.max_batch_size = 7

# Duration of the interval at which to publish updates
exporter.publish_interval_duration = "400ms"

Expand Down
153 changes: 81 additions & 72 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,83 +23,23 @@ wss_url = "wss://api.pythtest.pyth.network"
# non-existent file path, the system expects a keypair to be loaded
# via the remote keypair loader. If the path is valid, the remote
# keypair loading is disabled.
key_store.publish_keypair = "/path/to/keypair.json"
key_store.publish_keypair_path = "/path/to/keypair.json"

# Public key of the oracle program
key_store.program_key = "RelevantOracleProgramAddress"

# Public key of the root mapping account
key_store.mapping_key = "RelevantOracleMappingAddress"

# Optional public key of the accumulator program (if provided)
key_store.accumulator_key = "RelevantOracleAccumulatorAddress"
### Optional fields of primary/secondary network config ###

### Optional fields ###

# [metrics_server]
#
# Where to serve the quick-access dashboard and metrics. Metrics live under "/metrics"
# NOTE: non-loopback addresses must be used carefully, making sure the
# connection is not exposed for unauthorized access.
# bind_address = "127.0.0.1:8888"

# [remote_keypair_loader}
# Where to serve the remote keypair loading endpoint, under "/primary/load_keypair" and "/secondary/load_keypair"
# NOTE: non-loopback addresses must be used carefully, making sure the
# connection is not exposed for unauthorized access.
# bind_address = "127.0.0.1:9001"

# How much whole SOL must a keypair hold to be considered valid for use on a given network. Disabled with 0
# primary_min_keypair_balance_sol = 1
# secondary_min_keypair_balance_sol = 1


# Channel capacities. These refer to async messaging channels
# internally used by the agent's subroutines

# Capacity of the channel used to broadcast shutdown events to all
# components
# channel_capacities.shutdown = 10000

# Capacity of the channel used to send updates from the primary Oracle
# to the Global Store
# channel_capacities.primary_oracle_updates = 10000

# Capacity of the channel used to send updates from the secondary
# Oracle to the Global Store
# channel_capacities.secondary_oracle_updates = 10000

# Capacity of the channel the Pythd API Adapter uses to send lookup
# requests to the Global Store
# channel_capacities.global_store_lookup = 10000

# Capacity of the channel the Pythd API Adapter uses to communicate
# with the Local Store
# channel_capacities.local_store_lookup = 10000

# Capacity of the channel on which the Local Store receives messages
# channel_capacities.local_store = 10000

# Capacity of the channel on which the Pythd API Adapter receives
# messages
# channel_capacities.pythd_adapter = 10000

# Capacity of the slog logging channel. Adjust this value if you see
# complaints about channel capacity from slog
# channel_capacities.logger_buffer = 10000


# Relative path to publisher identity keypair
# w.r.t. `key_store.root_path`. When the specified file is not found
# on startup, the relevant primary/secondary network will expect a
# remote-loaded keypair. See remote_keypair_loader options for
# details.
# key_store.publish_keypair_path = "publish_key_pair.json" # I exist, remote loading disabled
# key_store.publish_keypair_path = "none" # I do not exist, remote loading activated for the network

# Relative path to accumulator message buffer program ID. Setting this
# Pubkey of accumulator message buffer program ID. Setting this
Copy link
Contributor Author

@drozdziak1 drozdziak1 Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The older ordering of these options made additional exporter.* and oracle.* options fall under the remote_keypair_loader section. This means that if someone were to uncomment all config options and sections, they would not end up with a correct config.

With this change, every config section is clearly marked and additional {primary|secondary}_network options exist in the correct spot, still under [primary_network]

# value enables accumulator support on publishing transactions.
# key_store.accumulator_key_path = <not set by default>
# key_store.accumulator_key = <not set by default>
#
# IMPORTANT: When publishing with accumulator_key defined,
# max_batch_size must be decreased to 7
# exporter.max_batch_size = 7

# The interval with which to poll account information.
# oracle.poll_interval_duration = "2m"
Expand Down Expand Up @@ -148,13 +88,82 @@ key_store.accumulator_key = "RelevantOracleAccumulatorAddress"
# a value at least as large as (number of products published / number of products in a batch).
# exporter.transaction_monitor.max_transactions = "100"

### Optional config sections ###

# Configuration for the optional secondary network this agent will publish data to. In most cases this should be a Solana endpoint. The options correspond to the ones in primary_network
# [secondary_network]
## Metrics server section ##

# Configuration for the JRPC API
[pythd_adapter]
# [metrics_server]
#
# Where to serve the quick-access dashboard and metrics. Metrics live under "/metrics"
# NOTE: non-loopback addresses must be used carefully, making sure the
# connection is not exposed for unauthorized access.
# bind_address = "127.0.0.1:8888"

## Remote keypair loader section. ##

# [remote_keypair_loader}
# Where to serve the remote keypair loading endpoint, under
# "/primary/load_keypair" and "/secondary/load_keypair".
#
# NOTE: non-loopback addresses must be used carefully, making sure the
# connection is not exposed for unauthorized access.
# bind_address = "127.0.0.1:9001"

# How much whole SOL must a keypair hold to be considered valid for
# use on a given network. Disabled with 0.
# primary_min_keypair_balance_sol = 1
# secondary_min_keypair_balance_sol = 1


## Channel capacities section. ##

# These refer to async messaging channels
# internally used by the agent's subroutines

# [channel_capacities]
# Capacity of the channel used to broadcast shutdown events to all
# components
# shutdown = 10000

# Capacity of the channel used to send updates from the primary Oracle
# to the Global Store
# primary_oracle_updates = 10000

# Capacity of the channel used to send updates from the secondary
# Oracle to the Global Store
# secondary_oracle_updates = 10000

# Capacity of the channel the Pythd API Adapter uses to send lookup
# requests to the Global Store
# global_store_lookup = 10000

# Capacity of the channel the Pythd API Adapter uses to communicate
# with the Local Store
# local_store_lookup = 10000

# Capacity of the channel on which the Local Store receives messages
# local_store = 10000

# Capacity of the channel on which the Pythd API Adapter receives
# messages
# pythd_adapter = 10000

# Capacity of the slog logging channel. Adjust this value if you see
# complaints about channel capacity from slog
# logger_buffer = 10000


## JRPC API config section. ##

# [pythd_adapter]
# The duration of the interval at which `notify_price_sched` notifications will be sent.
# Note that this doesn't affect the rate at which transactions are published:
# this is soley a backwards-compatibility API feature.
# notify_price_sched_interval_duration = "1s"

## Optional secondary network section ##

# Configuration for the optional secondary network this agent will
# publish data to. In most cases this should be a Solana endpoint. The
# options correspond to the ones in primary_network
# [secondary_network]
4 changes: 2 additions & 2 deletions src/agent/solana/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ impl Oracle {
info!(
self.logger,
"updated publisher permissions";
"new" => format!("{:?}", new_publishers.difference(&previous_publishers).collect::<HashSet<_>>()),
"total" => new_publishers.len(),
"new_publishers" => format!("{:?}", new_publishers.difference(&previous_publishers).collect::<HashSet<_>>()),
"total_publishers" => new_publishers.len(),
);

// Update the data with the new data structs
Expand Down
Loading