Skip to content

feat: Bevy frontend integration#11

Open
U0001F3A2 wants to merge 35 commits into0xwonj:developfrom
U0001F3A2:bevy
Open

feat: Bevy frontend integration#11
U0001F3A2 wants to merge 35 commits into0xwonj:developfrom
U0001F3A2:bevy

Conversation

@U0001F3A2
Copy link

integrates Bevy frontend for zkDungeon

0xwonj added 30 commits October 27, 2025 14:01
refactor(client): refactor client architecture
- Move core → frontend/core
- Move cli → frontend/cli
- Move sui → blockchain/sui
- Create blockchain/core with traits and types
- Update workspace Cargo.toml
- Rename crates: client-frontend-*, client-blockchain-*
- Update all import paths from client_core to client_frontend_core
- Create FrontendConfig in client-frontend-core (UI-specific)
- Simplify RuntimeConfig in client-bootstrap (runtime-only)
- Update RuntimeBuilder to use RuntimeConfig
- Update CliApp to use separate RuntimeConfig and FrontendConfig
- Clean separation: bootstrap handles runtime, frontend-core handles UI
- Create SuiBlockchainClient implementing BlockchainClient trait
- Create SuiConfig with BlockchainConfig trait
- Add SuiNetwork enum (Mainnet, Testnet, Local)
- Implement ProofSubmitter, SessionManager traits for Sui
- Update exports in client-blockchain-sui
- Placeholder implementations (TODO: full Sui SDK integration)
- Create lib.rs with public exports (CliApp, CliAppBuilder, CliConfig)
- Extract logging setup to logging.rs module (reusable)
- Remove [[bin]] section from Cargo.toml (now library crate)
- Keep main.rs temporarily (will be deleted in Phase 5)
- Re-export RuntimeConfig and FrontendConfig for convenience
- Create dungeon-client binary crate at crates/client/
- Feature flags: frontend-cli, blockchain-sui, zkvm-*
- Delete old main.rs from CLI crate
- Update justfile commands to use new binary
  - just run [backend] - CLI only
  - just run-sui [backend] - CLI + Sui blockchain
- Add workspace member for dungeon-client binary
- Composable architecture: mix and match frontends + blockchains
Refactor blockchain abstraction into a clean 3-layer architecture:
- Layer 0: BlockchainTransport (pure infrastructure, no game knowledge)
- Layer 1: SessionManager, ProofSubmitter, StateVerifier (game domain)
- Layer 2: GameBlockchain (composite trait)

Changes:
- Consolidate all traits into single traits.rs file
- Define clear error types per layer (TransportError, SessionError, ProofError, StateError)
- Update types.rs with layered type definitions
- Add feature flags to blockchain-core for zk backend propagation
- Update workspace dependencies (client-frontend-cli with default-features = false)
- Fix import paths (EffectVisibility, FrontendApp trait)

Benefits:
- Clear separation of concerns (infrastructure vs game logic)
- Easy to implement new blockchains (implement 3 traits + composite)
- Follows same pattern as zk::Prover
- Simpler codebase (1 file vs 6 files)
Apply comprehensive feature management best practices following Tokio/Serde patterns:

Changes:
- Set resolver = "2" in workspace (already present, confirmed)
- Add default-features = false to ALL internal crate dependencies in workspace
- Remove default features from all library crates (zk, runtime, client-bootstrap, client-frontend-cli)
- Keep default features only in binary crate (dungeon-client)
- Update blockchain-core mock implementation to match new trait system
- Add Hash trait to SessionId for HashMap compatibility
- Add comprehensive documentation comments to feature sections

Architecture:
- Library crates: default = [] (no defaults)
- Binary crate: default = ["frontend-cli", "zkvm-stub"] (explicit selection)
- Feature propagation: binary → frontend-cli → bootstrap → runtime → zk

Benefits:
- Eliminates feature flag conflicts in workspace builds
- Follows Rust ecosystem best practices (tokio, serde, bevy patterns)
- Explicit feature control at workspace level
- Prevents "multiple zkVM backend" errors
- Cleaner dependency resolution with resolver v2

Testing:
- ✅ Binary builds: cargo build -p dungeon-client --features "frontend-cli,zkvm-stub"
- ✅ Workspace builds: cargo build --workspace --features stub
- ✅ Just commands: just build stub, just lint stub, just test stub
@U0001F3A2 U0001F3A2 changed the base branch from main to develop February 15, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants