# Workspace Setup Guide for Atlas Ecosystem
This guide helps you set up a coordinated workspace for all Atlas crates.
## Recommended Workspace Structure
Create a workspace to manage all Atlas crates together:
### Step 1: Create Workspace Root
```bash
cd "/Users/salestools/Engineering/Atlas Chain"
```
Create a `Cargo.toml` at the root level:
```toml
[workspace]
members = [
"atlas-program-runtime-3.0.0",
"atlas-sbpf",
"atlas-svm-callback-3.0.0",
"atlas-svm-feature-set-3.0.0",
"atlas-svm-log-collector-3.0.0",
"atlas-svm-measure-3.0.0",
"atlas-svm-timings-3.0.0",
"atlas-svm-transaction-3.0.0",
"atlas-svm-type-overrides-3.0.0",
"atlas-transaction-context-3.0.0",
"atlas-stake-interface-2.0.1",
# Add atlas-sdk-master components as needed
]
[workspace.package]
version = "3.0.1"
authors = ["Atlas Maintainers <maintainers@atlas.com>"]
repository = "https://github.com/anza-xyz/agave"
homepage = "https://atlas.com/"
license = "Apache-2.0"
edition = "2021"
[workspace.dependencies]
# Standard crates
base64 = "0.21"
bincode = "1.3"
itertools = "0.10"
log = "0.4"
percentage = "0.1"
rand = "0.8"
serde = "1.0"
thiserror = "1.0"
test-case = "3.3"
assert_matches = "1.5"
# Atlas crates - define versions here
atlas-program-runtime = { path = "atlas-program-runtime-3.0.0" }
atlas-sbpf = { path = "atlas-sbpf" }
atlas-svm-callback = { path = "atlas-svm-callback-3.0.0" }
atlas-svm-feature-set = { path = "atlas-svm-feature-set-3.0.0" }
atlas-svm-log-collector = { path = "atlas-svm-log-collector-3.0.0" }
atlas-svm-measure = { path = "atlas-svm-measure-3.0.0" }
atlas-svm-timings = { path = "atlas-svm-timings-3.0.0" }
atlas-svm-transaction = { path = "atlas-svm-transaction-3.0.0" }
atlas-svm-type-overrides = { path = "atlas-svm-type-overrides-3.0.0" }
atlas-transaction-context = { path = "atlas-transaction-context-3.0.0" }
atlas-stake-interface = { path = "atlas-stake-interface-2.0.1" }
```
### Step 2: Update Individual Crate Cargo.toml Files
Each crate should use workspace dependencies. Update your `atlas-program-runtime-3.0.0/Cargo.toml`:
```toml
[package]
name = "atlas-program-runtime"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }
description = "Atlas program runtime"
documentation = "https://docs.rs/atlas-program-runtime"
[dependencies]
base64 = { workspace = true }
bincode = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
percentage = { workspace = true }
rand = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
atlas-sbpf = { workspace = true, features = ["jit"] }
atlas-svm-callback = { workspace = true }
atlas-svm-feature-set = { workspace = true }
# ... etc
```
### Step 3: Build the Workspace
```bash
cargo build --workspace
```
### Step 4: Test All Crates
```bash
cargo test --workspace
```
## Publishing Strategy
When ready to publish to crates.io, follow this order:
### Phase 1: Foundation Crates (No Dependencies)
1. `atlas-program-error`
2. `atlas-sanitize`
3. `atlas-atomic-u64`
4. `atlas-msg`
5. `atlas-define-syscall`
### Phase 2: Core Types
1. `atlas-hash`
2. `atlas-pubkey`
3. `atlas-signature`
4. `atlas-account`
5. `atlas-instruction`
### Phase 3: System Interfaces
1. `atlas-system-interface`
2. `atlas-stake-interface`
3. `atlas-loader-v3-interface`
### Phase 4: SVM Components
1. `atlas-svm-feature-set`
2. `atlas-svm-log-collector`
3. `atlas-svm-measure`
4. `atlas-svm-timings`
5. `atlas-svm-type-overrides`
6. `atlas-svm-transaction`
7. `atlas-svm-callback`
### Phase 5: Runtime Components
1. `atlas-transaction-context`
2. `atlas-sbpf`
3. `atlas-program-runtime` ← This crate
### Publishing Commands
```bash
# For each crate in order:
cd atlas-xxx
cargo publish --dry-run # Test first
cargo publish # Publish for real
# Wait for crates.io to index (usually 5-10 minutes)
# Then proceed to the next crate
```
## Troubleshooting
### Path Not Found Errors
If you get path errors, check:
1. All referenced crates exist in the workspace
2. Paths in `Cargo.toml` match actual directory structure
3. You're running commands from the workspace root
### Version Conflicts
If versions conflict:
1. Check `[workspace.dependencies]` section
2. Ensure all crates use `{ workspace = true }`
3. Run `cargo update` to sync versions
### Build Failures
If builds fail:
1. Build dependencies first: `cargo build -p atlas-sbpf`
2. Check for API incompatibilities
3. Ensure all Atlas renames are complete
## Tips
- Use `cargo tree` to visualize dependencies
- Use `cargo check --workspace` for fast iteration
- Use `cargo clippy --workspace` for linting
- Keep a build log of successful workspace builds
## Next Steps
1. Complete the workspace setup
2. Verify all crates build successfully
3. Run the full test suite
4. Document any remaining issues
5. Plan the coordinated crates.io release