-
Notifications
You must be signed in to change notification settings - Fork 1
chore(deps): patch cowprotocol to bleu/cow-rs main (post-alpha.3) #10
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2054584
chore(deps): pull cowprotocol, alloy, redb, reqwest, tracing
brunota20 f85d3d3
runtime: implement cow-api, chain, local-store host backends
brunota20 6f669c6
runtime: multi-module supervisor + block/log event loop
brunota20 62d876e
chore(deps): patch cowprotocol to bleu/cow-rs main (post-alpha.3)
brunota20 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
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 |
|---|---|---|
|
|
@@ -21,3 +21,4 @@ Thumbs.db | |
| # Environment | ||
| .env | ||
| .env.* | ||
| data/ | ||
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,119 @@ | ||||||
| //! Engine-side runtime configuration. | ||||||
| //! | ||||||
| //! Distinct from `nexum.toml` (module manifest): this file describes | ||||||
| //! the *engine*'s I/O wiring — chain RPC endpoints and the on-disk | ||||||
| //! location of the `local-store` database. Both are required for the | ||||||
| //! 0.2 reference engine to do anything other than print stubs. | ||||||
| //! | ||||||
| //! Lookup order: | ||||||
| //! | ||||||
| //! 1. `--engine-config <path>` CLI flag (future), or third positional | ||||||
| //! argument today; | ||||||
| //! 2. `engine.toml` in the current working directory; | ||||||
| //! 3. defaults — no chains configured, `state_dir = ./data`. | ||||||
| //! | ||||||
| //! A missing config is OK for the example module (it only logs); for | ||||||
| //! the cow-api / chain backends it surfaces as `HostError { | ||||||
| //! kind: unsupported }` so guests learn early. | ||||||
|
|
||||||
| use std::collections::BTreeMap; | ||||||
| use std::path::{Path, PathBuf}; | ||||||
|
|
||||||
| use serde::Deserialize; | ||||||
| use tracing::{info, warn}; | ||||||
|
|
||||||
| /// Engine-side configuration loaded from `engine.toml`. | ||||||
| #[derive(Debug, Default, Deserialize)] | ||||||
| pub struct EngineConfig { | ||||||
| #[serde(default)] | ||||||
| pub engine: EngineSection, | ||||||
| /// Per-chain RPC URLs keyed by EVM chain id (decimal in TOML). | ||||||
| /// Used by the `chain::request` host call and as the alloy provider | ||||||
| /// pool seed. | ||||||
| #[serde(default)] | ||||||
| pub chains: BTreeMap<u64, ChainConfig>, | ||||||
| /// Modules the supervisor should boot. Each entry resolves a | ||||||
| /// `(component.wasm, nexum.toml)` pair on the local filesystem | ||||||
| /// for 0.2 — content-addressed resolution (Swarm / OCI / | ||||||
| /// `[[content.sources]]`) lands in 0.3 per | ||||||
| /// `docs/03-module-discovery.md`. | ||||||
| #[serde(default)] | ||||||
| pub modules: Vec<ModuleEntry>, | ||||||
| } | ||||||
|
|
||||||
| /// One `[[modules]]` table from `engine.toml`. | ||||||
| /// | ||||||
| /// Both fields are filesystem paths in 0.2. `manifest` defaults to | ||||||
| /// `nexum.toml` next to `path` if omitted, matching the bundle layout | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same
Suggested change
|
||||||
| /// in `docs/02-modules-events-packaging.md`. | ||||||
| #[derive(Debug, Deserialize)] | ||||||
| pub struct ModuleEntry { | ||||||
| /// Path to the compiled `.wasm` component. | ||||||
| pub path: std::path::PathBuf, | ||||||
| /// Path to the module's `nexum.toml`. Defaults to `<path-parent>/nexum.toml`. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here.
Suggested change
|
||||||
| #[serde(default)] | ||||||
| pub manifest: Option<std::path::PathBuf>, | ||||||
| } | ||||||
|
|
||||||
| #[derive(Debug, Deserialize)] | ||||||
| pub struct EngineSection { | ||||||
| #[serde(default = "default_state_dir")] | ||||||
| pub state_dir: PathBuf, | ||||||
| /// `tracing_subscriber::EnvFilter`-compatible directive. Defaults to | ||||||
| /// `info` when absent; `RUST_LOG` overrides at process start. | ||||||
| #[serde(default = "default_log_level")] | ||||||
| pub log_level: String, | ||||||
| } | ||||||
|
|
||||||
| impl Default for EngineSection { | ||||||
| fn default() -> Self { | ||||||
| Self { | ||||||
| state_dir: default_state_dir(), | ||||||
| log_level: default_log_level(), | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| #[derive(Debug, Deserialize)] | ||||||
| pub struct ChainConfig { | ||||||
| /// JSON-RPC endpoint. `ws://` and `wss://` engage alloy's pubsub | ||||||
| /// transport (required for `eth_subscribe`); `http://` and `https://` | ||||||
| /// engage the HTTP transport (request/response only). | ||||||
| pub rpc_url: String, | ||||||
| } | ||||||
|
|
||||||
| fn default_state_dir() -> PathBuf { | ||||||
| PathBuf::from("./data") | ||||||
| } | ||||||
|
|
||||||
| fn default_log_level() -> String { | ||||||
| "info".to_owned() | ||||||
| } | ||||||
|
|
||||||
| /// Read an engine config from disk, returning defaults if the file is | ||||||
| /// missing. Parse errors propagate. | ||||||
| pub fn load_or_default(path: Option<&Path>) -> anyhow::Result<EngineConfig> { | ||||||
| let path = match path { | ||||||
| Some(p) => p.to_path_buf(), | ||||||
| None => PathBuf::from("engine.toml"), | ||||||
| }; | ||||||
|
|
||||||
| if !path.exists() { | ||||||
| warn!( | ||||||
| path = %path.display(), | ||||||
| "engine.toml not found — running with defaults (no chain RPC endpoints; \ | ||||||
| chain::request and cow_api::submit_order will return Unsupported)" | ||||||
| ); | ||||||
| return Ok(EngineConfig::default()); | ||||||
| } | ||||||
|
|
||||||
| let raw = std::fs::read_to_string(&path)?; | ||||||
| let cfg: EngineConfig = toml::from_str(&raw)?; | ||||||
| info!( | ||||||
| path = %path.display(), | ||||||
| chains = cfg.chains.len(), | ||||||
| state_dir = %cfg.engine.state_dir.display(), | ||||||
| "engine config loaded", | ||||||
| ); | ||||||
| Ok(cfg) | ||||||
| } | ||||||
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.
ADR-0001 (applied in PR #8 following mfw's review) renamed the manifest file from
nexum.tomltomodule.tomlthroughout. These doc strings still reference the old name and will be misleading once the rename lands — rebasing onto PR #8 fixes this automatically.