Open
Conversation
refactor(client): refactor client architecture
…orker (build broken)
…ch and to enable verifying on Sui contract
- 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
Walrus Haulout Hackathon
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
integrates Bevy frontend for zkDungeon