Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9924ebc
feat: add Redis-based configuration storage with seed
nahimterrazas Jan 22, 2026
9f36213
up
nahimterrazas Jan 22, 2026
b012cf0
fix
nahimterrazas Jan 23, 2026
ee0f8b9
feat: implement admin authentication with wallet signatures and nonce…
nahimterrazas Jan 26, 2026
d2f29a2
feat: implement admin authentication with wallet signatures and nonce…
nahimterrazas Jan 26, 2026
c6c434a
feat: add admin API endpoints for nonce generation and token manageme…
nahimterrazas Jan 26, 2026
1cf161a
feat: add admin API endpoints for nonce generation and token manageme…
nahimterrazas Jan 26, 2026
2bce254
Merge branch 'main' into 268-siwe-admin-auth-module
nahimterrazas Jan 26, 2026
d8508d9
fix nonce
nahimterrazas Jan 26, 2026
7172e22
Enhance admin authentication error handling and add AdminActionHashEr…
nahimterrazas Jan 26, 2026
e35991b
feat: Refine nonce generation documentation and enhance admin authori…
nahimterrazas Jan 26, 2026
92d69aa
fix
nahimterrazas Jan 26, 2026
a6bdfa4
feat: Add admin configuration support and enhance API with admin auth…
nahimterrazas Jan 27, 2026
511686e
feat: Add admin configuration support and enhance API with admin auth…
nahimterrazas Jan 27, 2026
85a0427
refactor: Update nonce store implementation to support multiple stora…
nahimterrazas Jan 27, 2026
2b4f45f
refactor: Update nonce store implementation to support multiple stora…
nahimterrazas Jan 27, 2026
79cd4ad
refactor: Enhance configuration storage with new StorageConfigStore i…
nahimterrazas Jan 28, 2026
29bbda5
fix
nahimterrazas Jan 28, 2026
31fef84
fix review
nahimterrazas Jan 28, 2026
f61cca6
fix review
nahimterrazas Jan 28, 2026
bd4f2c8
refactor: Replace ConfigStoreConfig and NonceStoreConfig with unified…
nahimterrazas Jan 28, 2026
92a2ed7
refactor: Replace ConfigStoreConfig and NonceStoreConfig with unified…
nahimterrazas Jan 28, 2026
a0c1632
refactor: Update StorageFactory and NonceResponse types for improved …
nahimterrazas Jan 28, 2026
2665540
feat: Introduce OperatorConfig for enhanced runtime configuration man…
nahimterrazas Jan 28, 2026
2fa2328
refactor: Improve code readability and consistency in configuration h…
nahimterrazas Jan 28, 2026
6f10662
feat: Implement shared configuration with hot reload support for Solv…
nahimterrazas Jan 28, 2026
4a5d779
feat: Implement shared configuration with hot reload support for Solv…
nahimterrazas Jan 28, 2026
3fda524
feat: Add health check endpoint and storage readiness verification fo…
nahimterrazas Jan 29, 2026
a745216
feat: Add health check endpoint and storage readiness verification fo…
nahimterrazas Jan 29, 2026
029a346
feat: tests
nahimterrazas Jan 29, 2026
39e0fde
feat: tests
nahimterrazas Jan 29, 2026
ebf4333
feat: Add gas buffer configuration and update fee management in admin…
nahimterrazas Jan 30, 2026
99f7fa4
feat: Introduce gas buffer configuration in SolverConfig and update r…
nahimterrazas Jan 30, 2026
f25ae52
feat: Integrate alloy-signer for signature recovery in admin authenti…
nahimterrazas Jan 30, 2026
6a01cf3
tests
nahimterrazas Jan 30, 2026
ac30a72
fix types improves
nahimterrazas Jan 30, 2026
937ae8d
feat: Enhance storage readiness checks and health endpoint to support…
nahimterrazas Jan 30, 2026
2f3e35b
feat: Enhance storage readiness checks and health endpoint to support…
nahimterrazas Jan 30, 2026
300a715
feat: Update storage configuration to use solver_id as Redis key pref…
nahimterrazas Jan 30, 2026
8f59fc8
feat: Update storage configuration to use solver_id as Redis key pref…
nahimterrazas Jan 30, 2026
fd97f29
feat: Add file-based storage support and enhance readiness checks for…
nahimterrazas Feb 2, 2026
c47768b
feat: Add file-based storage support and enhance readiness checks for…
nahimterrazas Feb 2, 2026
d37bc3c
adding tests
nahimterrazas Feb 2, 2026
39f35e7
adding tests
nahimterrazas Feb 2, 2026
aa9089e
feat: Add file-based storage support and enhance readiness checks for…
nahimterrazas Feb 2, 2026
2f0f3d5
feat: Add file-based storage support and enhance readiness checks for…
nahimterrazas Feb 2, 2026
f9cfba7
Merge branch 'main' into 268-siwe-admin-auth-module
nahimterrazas Feb 2, 2026
0ebfd86
feat: fix
nahimterrazas Feb 2, 2026
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
3 changes: 3 additions & 0 deletions Cargo.lock

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

89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ The solver provides a REST API for interacting with the system and submitting of

- **Orders API**: [`api-spec/orders-api.yaml`](api-spec/orders-api.yaml) - Submit and track cross-chain intent orders
- **Tokens API**: [`api-spec/tokens-api.yaml`](api-spec/tokens-api.yaml) - Query supported tokens and networks
- **Admin API**: [`docs/openapi-admin.json`](docs/openapi-admin.json) - Wallet-based admin operations (EIP-712 signed)
Comment thread
nahimterrazas marked this conversation as resolved.

### API Flows

Expand Down Expand Up @@ -527,6 +528,85 @@ sequenceDiagram
- **GET `/api/v1/tokens/{chain_id}`** - Get supported tokens for a specific chain
- Returns network configuration including settler addresses and token list

#### Health

- **GET `/health`** - Health check endpoint
- Returns solver health status including Redis connectivity and persistence info
- Response:
```json
{
"status": "healthy",
"redis": {
"connected": true,
"persistence_enabled": true,
"rdb_enabled": true,
"aof_enabled": false
},
"solver_id": "my-solver",
"version": "0.1.0"
}
```
- Status codes: `200 OK` (healthy), `503 Service Unavailable` (unhealthy)

#### Admin API (Wallet-Based Authentication)

The admin API enables authorized wallet addresses to perform administrative operations using EIP-712 signed messages. This provides secure, decentralized admin access without shared secrets.

**Setup:** Configure admin addresses in your seed overrides or TOML config:

```json
{
"admin": {
"enabled": true,
"domain": "solver.example.com",
"chain_id": 1,
"admin_addresses": ["0xYourAdminWalletAddress"]
}
}
```

**Endpoints:**

- **GET `/api/v1/admin/nonce`** - Get a nonce for signing admin actions
- Response:
```json
{
"nonce": "1706184000123456",
"expiresIn": 300,
"domain": "solver.example.com",
"chainId": 1
}
```

- **GET `/api/v1/admin/types`** - Get EIP-712 type definitions for client-side signing
- Returns domain and type definitions for all admin actions (AddToken, RemoveToken, etc.)

- **POST `/api/v1/admin/tokens`** - Add a new token to a network
- Request body:
```json
{
"signature": "0x...",
"contents": {
"chainId": 10,
"symbol": "USDC",
"tokenAddress": "0x...",
"decimals": 6,
"nonce": 1706184000123456,
"deadline": 1706184300
}
}
```
- The signature must be an EIP-712 typed data signature from an authorized admin
- Changes are hot-reloaded immediately (no restart required)

**Admin Action Flow:**

1. Call `GET /api/v1/admin/nonce` to get a fresh nonce
2. Call `GET /api/v1/admin/types` to get EIP-712 type definitions
3. Construct the typed data with the nonce and a deadline
4. Sign with your admin wallet (EIP-712)
5. Submit the signed action to the appropriate endpoint

### Example Usage

```bash
Expand Down Expand Up @@ -592,6 +672,15 @@ curl http://localhost:3000/api/v1/tokens/31338

# Get all supported tokens
curl http://localhost:3000/api/v1/tokens

# Health check
curl http://localhost:3000/health

# Admin: Get nonce for signing
curl http://localhost:3000/api/v1/admin/nonce

# Admin: Get EIP-712 types for signing
curl http://localhost:3000/api/v1/admin/types
```

The API server is enabled by default on port 3000 when the solver is running. You can disable it or change the port in the configuration file.
Expand Down
8 changes: 6 additions & 2 deletions config/seed-overrides-testnet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"solver_id": "oif-solver-testnet",
"networks": [
{
"chain_id": 11155420,
Expand All @@ -21,5 +20,10 @@
}
]
}
]
],
"admin": {
"enabled": true,
"domain": "localhost",
"admin_addresses": ["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"]
}
}
3 changes: 3 additions & 0 deletions crates/solver-config/src/builders/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct ConfigBuilder {
solver_id: String,
monitoring_timeout_seconds: u64,
min_profitability_pct: Decimal,
gas_buffer_bps: u32,
storage_primary: String,
storage_cleanup_interval_seconds: u64,
min_confirmations: u64,
Expand All @@ -42,6 +43,7 @@ impl ConfigBuilder {
solver_id: "test-solver".to_string(),
monitoring_timeout_seconds: 60,
min_profitability_pct: Decimal::ZERO,
gas_buffer_bps: 1000, // 10% default
storage_primary: "memory".to_string(),
storage_cleanup_interval_seconds: 60,
min_confirmations: 1,
Expand Down Expand Up @@ -125,6 +127,7 @@ impl ConfigBuilder {
solver: SolverConfig {
id: self.solver_id,
min_profitability_pct: self.min_profitability_pct,
gas_buffer_bps: self.gas_buffer_bps,
monitoring_timeout_seconds: self.monitoring_timeout_seconds,
},
networks: self.networks.unwrap_or_default(),
Expand Down
8 changes: 8 additions & 0 deletions crates/solver-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ pub struct SolverConfig {
pub id: String,
/// Minimum profitability percentage required to execute orders.
pub min_profitability_pct: Decimal,
/// Gas buffer in basis points (e.g., 1000 = 10%).
/// Applied as safety margin on gas cost estimates.
#[serde(default = "default_gas_buffer_bps")]
pub gas_buffer_bps: u32,
/// Timeout in seconds for monitoring transactions.
/// Defaults to 28800 seconds (8 hours) if not specified.
#[serde(default = "default_monitoring_timeout_seconds")]
Expand Down Expand Up @@ -283,6 +287,10 @@ pub struct PricingConfig {
pub implementations: HashMap<String, toml::Value>,
}

fn default_gas_buffer_bps() -> u32 {
1000 // 10%
}

/// Gas configuration mapping flow identifiers to gas unit overrides.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct GasConfig {
Expand Down
Loading