Repository navigation
feat(autopilot-svm) PR10: binary wiring and liveness #4755
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
Merged
squadgazzz
merged 38 commits into
main
from
ilya/be-186-pr10-wiring-liveness-devnet-runbook
Aug 25, 2026
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
5c1b874
PR08: seam implementations and a single auction cycle
squadgazzz 760fcae
PR09: settlement observation over execution windows
squadgazzz 875dacf
PR10: binary wiring, liveness, and the metrics server
squadgazzz c71fa72
Reject zero competition parameters at config load and panic when a su…
squadgazzz 1e84f50
Use the shared database pool config in the autopilot
squadgazzz dc194bc
Make the solve budget a wall-clock duration like the EVM autopilot
squadgazzz 25db78c
Merge branch 'ilya/be-184-pr08-seam-implementations-single-auction-cy…
squadgazzz c413b06
Configure the solve deadline as a duration
squadgazzz 6e3eb7b
Carry a wall-clock solve deadline and a settle submission deadline sl…
squadgazzz 8520615
Merge branch 'ilya/be-184-pr08-seam-implementations-single-auction-cy…
squadgazzz 7509fc2
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz fcb2ddd
Drop the auction tip field, the wall-clock deadline removed its last …
squadgazzz 29a1041
Merge branch 'ilya/be-184-pr08-seam-implementations-single-auction-cy…
squadgazzz e30f76f
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz cb6dff6
Keep top-level config keys above the database section in the example
squadgazzz ccde2a0
Merge remote-tracking branch 'origin/main' into ilya/be-185-pr09-sett…
squadgazzz 021a443
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz d8c06b6
Name the window operations after what they do
squadgazzz 9b79c2b
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz 1006c69
Merge remote-tracking branch 'origin/main' into ilya/be-185-pr09-sett…
squadgazzz 81cc46e
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz 64a5999
Trim the Competition doc to essence
squadgazzz 9b8ebef
Write the settlement outcomes as literals
squadgazzz 5348b84
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz bc786bd
State the settlement attribution constraint
squadgazzz 65112e0
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz 6df9bcd
Move the settlement window queries into the db layer
squadgazzz 4e6b299
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz ff84a22
Drop the settlement read the single-query close replaced
squadgazzz ff9b940
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz b7d40da
Fold the settlement window types into one
squadgazzz cf362a0
Connect the crate's tests through one helper
squadgazzz 6330161
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz a115d96
Own the cycle loop and the submission deadline in the run loop
squadgazzz 31614ec
Configure the metrics port and group the on-chain addresses
squadgazzz 4d44bf5
Merge remote-tracking branch 'origin/main' into ilya/be-185-pr09-sett…
squadgazzz b9c8eee
Merge branch 'ilya/be-185-pr09-settlement-observation' into ilya/be-1…
squadgazzz 5661bba
Merge remote-tracking branch 'origin/main' into ilya/be-186-pr10-wiri…
squadgazzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Example configuration for the Solana autopilot. | ||
|
|
||
| # Serves /metrics, /liveness, /ready, and /startup. | ||
| metrics-port = 9586 | ||
| # The pod fails the liveness probe when no auction cycle completed in this | ||
| # time. | ||
| max-auction-age = "5m" | ||
|
|
||
| [database] | ||
| # The Postgres database the indexer writes to. A value like "%DB_WRITE_URL" | ||
| # reads the URL from that environment variable. | ||
| write-url = "postgresql://" | ||
|
|
||
| [rpc] | ||
| # The devnet node. | ||
| endpoint = "https://api.devnet.solana.com" | ||
| request-timeout = "10s" | ||
|
|
||
| [contracts] | ||
| wrapped-native-mint = "So11111111111111111111111111111111111111112" | ||
|
|
||
| [competition] | ||
| max-winners = 1 | ||
| solve-deadline = "6s" | ||
| submission-deadline-slots = 25 | ||
|
|
||
| [[drivers]] | ||
| name = "baseline" | ||
| url = "http://localhost:11088" | ||
|
|
||
| [logging] | ||
| filter = "info,autopilot_svm=debug" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| //! Configuration of the autopilot's endpoints and competition parameters. | ||
|
|
||
| use { | ||
| configs::{database::DatabasePoolConfig, shared::LoggingConfig}, | ||
| serde::Deserialize, | ||
| serde_ext::{deserialize_nonempty_vec, deserialize_solana_pubkey_b58}, | ||
| solana_sdk::pubkey::Pubkey, | ||
| std::{num::NonZero, path::Path, time::Duration}, | ||
| tokio::fs, | ||
| }; | ||
|
|
||
| /// Load the autopilot configuration from a TOML file. | ||
| /// | ||
| /// # Panics | ||
| /// | ||
| /// This function panics if the config is invalid or on I/O errors. | ||
| pub async fn load(path: &Path) -> Config { | ||
| let data = fs::read_to_string(path) | ||
| .await | ||
| .unwrap_or_else(|e| panic!("I/O error while reading {path:?}: {e:?}")); | ||
|
|
||
| toml::de::from_str(&data).unwrap_or_else(|err| { | ||
| if std::env::var("TOML_TRACE_ERROR").is_ok_and(|v| v == "1") { | ||
| panic!("failed to parse TOML config at {path:?}: {err:#?}") | ||
| } else { | ||
| panic!( | ||
| "failed to parse TOML config at: {path:?}. Set TOML_TRACE_ERROR=1 to print \ | ||
| parsing error but this may leak secrets." | ||
| ) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| /// Configuration of the autopilot's endpoints and competition parameters. | ||
| #[derive(Debug, Deserialize)] | ||
| #[serde(rename_all = "kebab-case", deny_unknown_fields)] | ||
| pub struct Config { | ||
| /// Connection configuration for the database the indexer writes to. | ||
| #[serde(default)] | ||
| pub database: DatabasePoolConfig, | ||
| /// JSON-RPC client configuration. | ||
| pub rpc: Rpc, | ||
| /// On-chain addresses the autopilot reads. | ||
| pub contracts: Contracts, | ||
| /// Competition parameters. | ||
| #[serde(default)] | ||
| pub competition: Competition, | ||
| /// Port the metrics and probes server binds to, on every interface. | ||
| #[serde(default = "default_metrics_port")] | ||
| pub metrics_port: u16, | ||
| /// If no auction cycle completed in this time the pod fails the liveness | ||
| /// check. | ||
| #[serde(with = "humantime_serde", default = "default_max_auction_age")] | ||
| pub max_auction_age: Duration, | ||
| /// The driver endpoints participating in every auction. | ||
| #[serde(deserialize_with = "deserialize_nonempty_vec")] | ||
| pub drivers: Vec<Driver>, | ||
| /// Logging configuration. | ||
| #[serde(default)] | ||
| pub logging: LoggingConfig, | ||
| } | ||
|
|
||
| impl Config { | ||
| /// Build the `observe::Config` for the tracing framework from the logging | ||
| /// configuration. | ||
| pub fn observe_config(&self) -> observe::Config { | ||
| observe::Config::new( | ||
| &self.logging.filter, | ||
| self.logging.stderr_threshold, | ||
| self.logging.use_json, | ||
| None, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| const fn default_metrics_port() -> u16 { | ||
| observe::metrics::DEFAULT_METRICS_PORT | ||
| } | ||
|
|
||
| const fn default_max_auction_age() -> Duration { | ||
| Duration::from_mins(5) | ||
| } | ||
|
|
||
| /// JSON-RPC client configuration. | ||
| #[derive(Debug, Deserialize)] | ||
| #[serde(rename_all = "kebab-case", deny_unknown_fields)] | ||
| pub struct Rpc { | ||
| /// HTTP endpoint of the Solana JSON-RPC node. | ||
| pub endpoint: url::Url, | ||
| /// Timeout for a single RPC request. | ||
| #[serde(with = "humantime_serde")] | ||
| pub request_timeout: Duration, | ||
| } | ||
|
|
||
| /// On-chain addresses: programs and mints. | ||
| #[derive(Debug, Deserialize)] | ||
| #[serde(rename_all = "kebab-case", deny_unknown_fields)] | ||
| pub struct Contracts { | ||
| /// The wrapped native token mint (wSOL), the unit scores are denominated | ||
| /// in. | ||
| #[serde(deserialize_with = "deserialize_solana_pubkey_b58")] | ||
| pub wrapped_native_mint: Pubkey, | ||
| } | ||
|
|
||
| /// Competition parameters. | ||
| #[derive(Debug, Deserialize)] | ||
| #[serde(rename_all = "kebab-case", deny_unknown_fields, default)] | ||
| pub struct Competition { | ||
| /// Maximum number of winning solutions per auction. | ||
| pub max_winners: NonZero<usize>, | ||
| /// How long drivers get to answer `/solve`. | ||
| #[serde(with = "humantime_serde")] | ||
| pub solve_deadline: Duration, | ||
| /// Slots a settlement may take after ranking before it counts as late. | ||
| pub submission_deadline_slots: NonZero<u64>, | ||
| } | ||
|
|
||
| impl Default for Competition { | ||
| fn default() -> Self { | ||
| Self { | ||
| max_winners: NonZero::new(1).expect("non-zero literal"), | ||
| // The EVM fast chains run 6s solve deadlines. | ||
| solve_deadline: Duration::from_secs(6), | ||
| submission_deadline_slots: NonZero::new(25).expect("non-zero literal"), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// One driver endpoint. | ||
| #[derive(Debug, Deserialize)] | ||
| #[serde(rename_all = "kebab-case", deny_unknown_fields)] | ||
| pub struct Driver { | ||
| /// Name for logs and metrics. | ||
| pub name: String, | ||
| /// HTTP endpoint of the driver API. | ||
| pub url: url::Url, | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[tokio::test] | ||
| async fn loads_the_example_config() { | ||
| let config = load(std::path::Path::new("example.toml")).await; | ||
| assert_eq!(config.database.write_url.as_str(), "postgresql://"); | ||
| assert_eq!( | ||
| config.contracts.wrapped_native_mint, | ||
| "So11111111111111111111111111111111111111112" | ||
| .parse() | ||
| .unwrap() | ||
| ); | ||
| assert_eq!(config.competition.max_winners.get(), 1); | ||
| assert_eq!(config.competition.solve_deadline, Duration::from_secs(6)); | ||
| assert_eq!(config.competition.submission_deadline_slots.get(), 25); | ||
| assert_eq!(config.max_auction_age, Duration::from_secs(5 * 60)); | ||
| assert_eq!(config.drivers.len(), 1); | ||
| assert_eq!(config.drivers[0].name, "baseline"); | ||
| assert_eq!(config.logging.filter, "info,autopilot_svm=debug"); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #[global_allocator] | ||
| static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; | ||
|
|
||
| #[tokio::main] | ||
| async fn main() { | ||
| autopilot_svm::run::start(std::env::args()).await; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like this could be a
Contractssub struct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably makes sense, since EVM's
Contractsalready mixes both kinds (it holds weth next to the settlement contract), so the mint should be appropriate here too.