Skip to content

feat(l2): guest program modularization core#6

Merged
Zena-park merged 41 commits intofeat/app-customized-frameworkfrom
pr/zk/01-gp-modularization
Mar 2, 2026
Merged

feat(l2): guest program modularization core#6
Zena-park merged 41 commits intofeat/app-customized-frameworkfrom
pr/zk/01-gp-modularization

Conversation

@Zena-park
Copy link
Copy Markdown
Member

@Zena-park Zena-park commented Mar 1, 2026

Summary

Core infrastructure for guest program modularization in the ZK proving system:

  • GuestProgram trait & implementations: Extensible trait for custom guest programs with bytes-based proving via ProverBackend
  • GuestProgramRegistry + dual-path proving: Registry that routes proving requests to the appropriate guest program, supporting both built-in and dynamically loaded ELFs
  • L1 contracts: programTypeId field and GuestProgramRegistry.sol for on-chain guest program management
  • Guest Program Store platform: Server + client for uploading, browsing, and deploying guest programs
  • SDK & tooling: Scaffold script for new guest program projects, OpenVM ELF integration, SP1 key caching, dynamic programTypeId resolution
  • Custom types: ZK-DEX and Tokamon custom types with SP1 entry points
  • DynamicGuestProgram: Runtime ELF loading with header validation and fuzz-style robustness tests
  • Production hardening: Session storage migration to SQLite, backward compatibility tests, developer guide

Dependencies

This is the first PR in a 4-part stacked PR series (1/4).
Merge order: #6#7#8#9

Test plan

  • Registry integration tests for ZK-DEX and Tokamon
  • prove_with_elf integration tests for exec backend
  • ProofData protocol backward compatibility tests
  • ELF header validation and fuzz-style robustness tests
  • Verify guest program scaffold script generates correct module structure
  • Verify platform server starts and serves client correctly

Design documents for Phase 2 of the ZK optimization plan — making the
guest program a pluggable module for app-specific L2s. Covers current
architecture analysis, target architecture with GuestProgram trait,
implementation phases, and risk analysis.
Define the GuestProgram trait abstraction with backend-agnostic interface
for ELF loading, VK retrieval, and I/O serialization. Implement three
programs: EvmL2GuestProgram (wraps existing monolithic guest program),
ZkDexGuestProgram and TokammonGuestProgram (app-specific stubs).

Add GUEST_PROGRAMS env var support to build.rs for multi-program builds.
Includes 14 unit tests covering all program implementations.
Add backend_name(), execute_with_elf(), prove_with_elf() and their timed
variants to the ProverBackend trait with default NotImplemented fallback.
Implement backend_name() for all five backends (SP1, RISC0, ZisK,
OpenVM, Exec). Exec backend provides full execute_with_elf/prove_with_elf
implementation with rkyv deserialization.

Add BackendType::as_backend_name() for enum-to-string conversion and
BackendError::NotImplemented/Serialization error variants.
Implement GuestProgramRegistry for runtime program lookup by ID with
default program support. Extend ProofData protocol with program_id and
supported_programs fields (backward compatible via serde defaults).

Update Proof Coordinator to dispatch batches with program_id and filter
by prover capabilities. Integrate dual-path proving in the prover main
loop: attempt ELF-based proving via registry, fall back to legacy path.

Includes 5 registry unit tests.
…stry

Upgrade OnChainProposer VK mapping from 2D to 3D (commitHash → programTypeId
→ verifierId → vk) to support multiple guest program types. Add programTypeId
to BatchCommitmentInfo and commitBatch() signature with backward-compatible
default (0 maps to DEFAULT_PROGRAM_TYPE_ID=1).

Add GuestProgramRegistry.sol (UUPS upgradeable) for on-chain program
registration with auto-assigned typeIds (1: EVM-L2, 2-9: official, 10+:
community). Integrate with OnChainProposer via isProgramActive() validation.

Update l1_committer to include programTypeId in commitment calldata.
Add registry deployment and initialization to L1 deployer.
Implement GPTs-style marketplace for guest programs with Express.js
backend and Next.js 15 frontend.

Server: SQLite-backed REST API with Google/Naver/Kakao OAuth, session
auth, program CRUD with approval workflow, ELF/VK upload (SHA-256),
deployment management, admin dashboard API, input validation, and
rate limiting.

Client: 16-route Next.js app with store browsing, creator portal,
deployment configurator with L2 TOML export, admin panel, and
responsive Tailwind CSS UI.
Add new-guest-program.sh that generates boilerplate for custom guest
programs including Rust module, trait implementation, unit tests, and
module registration in programs/mod.rs.
Update Phase 2.1-2.4 and Phase 3 completion status with actual
implementation details, deviations from plan, and test results.

Add new design documents:
- 05: Improvements proposal for future optimization
- 06: App-specific templates (ZK-DEX, Tokamon) design
- 07: Multi-role platform architecture (Guest Program Store)
Centralize OpenVM ELF binary into the guest-program crate with
cfg-gated ZKVM_OPENVM_PROGRAM_ELF constant, matching the existing
SP1/ZisK pattern. Remove local include_bytes! from the OpenVM backend
and add ELF lookup test for the OpenVM backend.
Add SHA-256 based caching for client.setup(elf) in prove_with_elf to
avoid re-running the expensive setup on every call. The cache uses a
static Mutex<HashMap<[u8;32], (PK, VK)>> keyed by the ELF digest.
Legacy prove_with_stdin path remains unchanged.
Add 5 tests covering the ELF-based execution path: backend name check,
invalid rkyv input returns Serialization error, and empty input returns
error for both execute_with_elf and prove_with_elf.
Replace hardcoded program_type_id=1 in l1_committer with a storage-
backed lookup. Add store_program_id_by_batch / get_program_id_by_batch
to the storage API (in-memory + SQL), persist program_id in
proof_coordinator on proof submission, and resolve it in
send_commitment via resolve_program_type_id(). Falls back to "evm-l2"
(type_id=1) when no program_id is stored for backward compatibility.
Update three design documents to reflect the completed stabilization
work (S1-S4): SP1 setup caching, prove_with_elf tests, OpenVM ELF
registry integration, and dynamic programTypeId.

- 03-implementation-phases: add S1-S4 section, update test count
  (19→25), update dependency diagram and remaining work table
- 04-risk-analysis: mark R6 as resolved, R8 as mitigated with
  ELF hash caching implementation
- 05-improvements-proposal: mark §1.4, §2.4, §3.3, §5.3 as
  resolved, update status and remaining work priorities
Add serialize_raw(&ProgramInput) -> Result<Vec<u8>> to ProverBackend
trait with default rkyv implementation. All backends now call
serialize_raw() inside serialize_input() instead of duplicating
rkyv::to_bytes. prover.rs prove_batch() uses backend.serialize_raw()
instead of inline rkyv call. Removes direct rkyv imports from SP1,
RISC0, OpenVM, and ZisK backends.

Also fixes OpenVM import bug: ZKVM_OPENVM_ZKVM_OPENVM_PROGRAM_ELF
(doubled prefix) -> ZKVM_OPENVM_PROGRAM_ELF.
Verify that pre-modularization JSON (without supported_programs and
program_id fields) correctly deserializes via serde defaults. Tests
cover BatchRequest, BatchResponse, and ProofSubmit variants in both
old-format and new-format roundtrip scenarios. Adds serde_json as
dev-dependency to ethrex-l2-common.
Update improvements proposal: serialize_raw() standardization (§2.3)
resolved, multi-ELF build tool already implemented. Reorganize
remaining work list from 10 to 8 items.
Restructure ZK-DEX guest program from flat file to module directory
with dedicated types, execution, and trait implementation files.

- Define DexProgramInput, DexTransfer, DexProgramOutput with rkyv
- Implement chained keccak-256 state transition model
- Validate empty batch, zero amount, and self-transfer
- Add 10 tests covering execution, serialization, and error cases
Restructure Tokamon guest program from flat file to module directory
with dedicated types, execution, and trait implementation files.

- Define ActionType enum, GameAction, TokammonProgramInput/Output with rkyv
- Implement chained keccak-256 state transition with payload validation
- Validate empty batch, short CreateSpot/Battle payloads
- Add 11 tests covering execution, serialization, and error cases
Create dedicated SP1 guest binaries for each custom program:
- bin/sp1-zk-dex/: reads DexProgramInput, executes transfers, commits output
- bin/sp1-tokamon/: reads TokammonProgramInput, executes game actions, commits output

Build infrastructure updates:
- Make program modules public for cross-crate access
- Add ZKVM_SP1_ZK_DEX_ELF and ZKVM_SP1_TOKAMON_ELF constants in lib.rs
- Add build_sp1_zk_dex() and build_sp1_tokamon() in build.rs
- Wire GUEST_PROGRAMS=zk-dex,tokamon to trigger SP1 builds
- Update GuestProgram::elf() to return SP1 ELFs
- Add per-program Makefile targets (sp1-zk-dex, sp1-tokamon)
The new-guest-program.sh now creates:
- Module directory with types.rs, execution.rs, and mod.rs
- SP1 binary directory with Cargo.toml and main.rs entry point
- 8 unit tests (trait, execution, rkyv roundtrip, output encoding)
- Auto-assigns program_type_id and registers in mod.rs

Fixed macOS bash 3 compatibility (PascalCase via awk, no bash 4 features).
Add 9 integration tests using real GuestProgram implementations:
- Verify 3 programs registered with correct IDs and type IDs
- Verify unique type IDs across all programs
- Cross-crate execution: ZK-DEX transfers and Tokamon game actions
- Output encoding length verification (72 bytes ZK-DEX, 88 bytes Tokamon)
- rkyv serialization roundtrip for both program input types
Replace the volatile in-memory session Map with persistent SQLite storage:
- Add sessions table with user_id FK and ON DELETE CASCADE
- Create db/sessions.js with CRUD operations and TTL validation
- Update auth middleware to use SQLite session lookups
- Add hourly cleanup interval for expired sessions

Sessions now survive server restarts and are automatically cleaned up
when the associated user is deleted.
Add validate_elf() method to GuestProgram trait with default impl:
- Checks ELF magic number, class (32/64-bit), and RISC-V machine type
- Backend-aware class expectations (SP1/RISC0/OpenVM=32-bit, ZisK=64-bit)
- New GuestProgramError::InvalidElf variant

Add 12 tests:
- 9 ELF validation tests (valid, too short, bad magic, wrong class, etc.)
- 3 fuzz-style property tests ensuring serialize_input, encode_output,
  and validate_elf never panic on arbitrary byte inputs
Implement DynamicGuestProgram that loads ELF binaries from the
filesystem at runtime, eliminating the need to recompile the prover
when adding or updating guest programs.

- Builder API: elf_from_file(), elf_from_bytes(), vk_from_file(), vk_from_bytes()
- from_dir(): auto-scans <dir>/<backend>/elf for known backends
- ELF header validation on load (skip_validation() to disable)
- Implements GuestProgram trait for Arc<dyn GuestProgram> registry use
- 15 tests covering builder, file I/O, directory scan, validation
Add 08-developer-guide.md covering quick start (scaffold script),
step-by-step manual creation, dynamic ELF loading, GuestProgram trait
reference, testing checklist, and existing programs reference.

Update 05-improvements-proposal.md to mark dynamic ELF loading and
developer guide as completed — all planned tasks are now done.
Seven production hardening tasks for the guest program modularization:

1. Resource Limits — ResourceLimits struct with max_input_bytes and
   max_proving_duration, enforced in prove_batch()
2. L1 Public Input Dispatcher — publicValuesHash for custom programs
   (programTypeId > 1) in OnChainProposer commit/verify flow
3. Cross-language encoding tests — byte layout verification for L2,
   ZK-DEX, Tokamon, and L1 output encodings
4. Guest Program versioning — version() and elf_hash() methods on
   GuestProgram trait
5. Runtime config — TOML-based ProgramsConfig for filtering active
   programs without recompilation
6. ProofData backward compat tests — roundtrip and edge case coverage
7. zkVM integration test scaffolding — ignored SP1/RISC0 tests for CI

Also includes Korean translation of the developer guide.
@Zena-park Zena-park requested a review from jason-h23 March 1, 2026 11:40
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 1, 2026

🤖 Kimi Code Review

⚠️ Review failed: KIMI_API_KEY secret is not set


Automated review by Kimi (Moonshot AI)

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request lays the foundational infrastructure for modularizing guest programs within the ZK proving system. It introduces a flexible GuestProgram trait, a registry for dynamic program selection, and extends L1 contracts to support program-specific verification. Additionally, it delivers a full-fledged platform for managing and deploying these modular guest programs, complete with developer tools and robust testing.

Highlights

  • GuestProgram trait & implementations: Introduced an extensible trait for custom guest programs, enabling bytes-based proving via ProverBackend.
  • GuestProgramRegistry + dual-path proving: Implemented a registry that routes proving requests to the appropriate guest program, supporting both built-in and dynamically loaded ELFs.
  • L1 contracts: Added a programTypeId field and GuestProgramRegistry.sol for on-chain guest program management.
  • Guest Program Store platform: Developed a server and client for uploading, browsing, and deploying guest programs.
  • SDK & tooling: Provided a scaffold script for new guest program projects, OpenVM ELF integration, SP1 key caching, and dynamic programTypeId resolution.
  • Custom types: Integrated ZK-DEX and Tokamon custom types with SP1 entry points.
  • DynamicGuestProgram: Enabled runtime ELF loading with header validation and fuzz-style robustness tests.
  • Production hardening: Migrated session storage to SQLite, ensured backward compatibility, and created a developer guide.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Cargo.lock
    • Added sha2, tempfile, serde_json, and toml dependencies.
  • Cargo.toml
    • Added toml dependency.
  • cmd/ethrex/build_l2.rs
    • Included GuestProgramRegistry.sol in the L2 contract compilation process.
  • cmd/ethrex/l2/deployer.rs
    • Added constants for GuestProgramRegistry bytecode and initializer signatures.
    • Extended ContractAddresses to include guest_program_registry_address.
    • Implemented deployment and initialization logic for the GuestProgramRegistry contract.
  • crates/guest-program/Cargo.toml
    • Added sha2 and tempfile dependencies.
  • crates/guest-program/Makefile
    • Introduced new targets for sp1-zk-dex, sp1-tokamon, and l2-all.
    • Added handling for the PROGRAMS environment variable to select guest programs for building.
  • crates/guest-program/bin/sp1-tokamon/Cargo.toml
    • Added a new Cargo.toml file for the Tokamon SP1 guest program.
  • crates/guest-program/bin/sp1-tokamon/src/main.rs
    • Added the main entry point for the Tokamon SP1 guest program.
  • crates/guest-program/bin/sp1-zk-dex/Cargo.toml
    • Added a new Cargo.toml file for the ZK-DEX SP1 guest program.
  • crates/guest-program/bin/sp1-zk-dex/src/main.rs
    • Added the main entry point for the ZK-DEX SP1 guest program.
  • crates/guest-program/build.rs
    • Modified to build specific guest programs based on the GUEST_PROGRAMS environment variable.
    • Added build targets for zk-dex and tokamon guest programs.
  • crates/guest-program/src/l1/output.rs
    • Added a test to verify the L1 output encoding layout.
  • crates/guest-program/src/l2/output.rs
    • Added tests to verify the L2 output encoding layout and handling of variable-length fields.
  • crates/guest-program/src/lib.rs
    • Added new modules for programs and traits.
    • Included new ELF constants for ZK-DEX and Tokamon guest programs.
  • crates/guest-program/src/programs/dynamic.rs
    • Added a new file implementing DynamicGuestProgram for runtime ELF loading with validation.
  • crates/guest-program/src/programs/evm_l2.rs
    • Added a new file wrapping the existing EVM-L2 logic as a GuestProgram implementation.
  • crates/guest-program/src/programs/mod.rs
    • Added a new module for guest programs, including re-exports for DynamicGuestProgram, EvmL2GuestProgram, TokammonGuestProgram, and ZkDexGuestProgram.
  • crates/guest-program/src/programs/tokamon/execution.rs
    • Added a new file containing the execution logic for Tokamon game actions.
  • crates/guest-program/src/programs/tokamon/mod.rs
    • Added a new file implementing the GuestProgram trait for the Tokamon program.
  • crates/guest-program/src/programs/tokamon/types.rs
    • Added a new file defining Tokamon game action types, input, and output structures.
  • crates/guest-program/src/programs/zk_dex/execution.rs
    • Added a new file containing the execution logic for ZK-DEX token transfers.
  • crates/guest-program/src/programs/zk_dex/mod.rs
    • Added a new file implementing the GuestProgram trait for the ZK-DEX program.
  • crates/guest-program/src/programs/zk_dex/types.rs
    • Added a new file defining ZK-DEX transfer types, input, and output structures.
  • crates/guest-program/src/traits.rs
    • Added a new file defining the GuestProgram trait, ResourceLimits, GuestProgramError, and ELF header validation utilities.
  • crates/l2/common/Cargo.toml
    • Added serde_json as a development dependency.
  • crates/l2/common/src/prover.rs
    • Extended the ProofData enum with supported_programs and program_id fields to support modularization.
    • Added builder functions for BatchRequest and BatchResponse with program support.
    • Implemented backward compatibility for ProofSubmit with a default program ID.
  • crates/l2/contracts/src/l1/GuestProgramRegistry.sol
    • Added a new Solidity contract for managing guest program registrations on L1.
  • crates/l2/contracts/src/l1/OnChainProposer.sol
    • Updated the verification key mapping to a 3D structure (commitHash, programTypeId, verifierId).
    • Added GUEST_PROGRAM_REGISTRY address and DEFAULT_PROGRAM_TYPE_ID constant.
    • Modified commitBatch and verifyBatch functions to utilize programTypeId for program-specific logic and registry validation.
    • Introduced a new upgradeVerificationKey function for generic VK upgrades.
  • crates/l2/contracts/src/l1/Timelock.sol
    • Updated the verifyBatch function signature to include customPublicValues.
  • crates/l2/contracts/src/l1/based/OnChainProposer.sol
    • Applied similar updates to the based version of OnChainProposer.sol for 3D VK mapping and programTypeId handling.
  • crates/l2/contracts/src/l1/based/interfaces/IOnChainProposer.sol
    • Updated commitBatch and verifyBatch function signatures to reflect programTypeId and publicValuesHash.
  • crates/l2/contracts/src/l1/interfaces/IGuestProgramRegistry.sol
    • Added a new interface for the GuestProgramRegistry.sol contract.
  • crates/l2/contracts/src/l1/interfaces/IOnChainProposer.sol
    • Updated the VerificationKeyUpgraded event and added a new upgradeVerificationKey function signature.
  • crates/l2/contracts/src/l1/interfaces/ITimelock.sol
    • Updated the verifyBatch function signature to include customPublicValues.
  • crates/l2/prover/Cargo.toml
    • Added sha2 and toml dependencies.
    • Added tempfile as a development dependency.
  • crates/l2/prover/programs.example.toml
    • Added an example TOML configuration file for guest programs.
  • crates/l2/prover/src/backend/error.rs
    • Added ResourceLimitExceeded error variant and a corresponding constructor.
  • crates/l2/prover/src/backend/exec.rs
    • Implemented execute_with_elf and prove_with_elf methods for ExecBackend.
    • Added tests for ExecBackend's ELF-based execution and serialization.
  • crates/l2/prover/src/backend/mod.rs
    • Extended the ProverBackend trait with backend_name, execute_with_elf, and prove_with_elf methods.
    • Added as_backend_name method to BackendType enum.
  • crates/l2/prover/src/backend/openvm.rs
    • Updated OpenVmBackend to use the ZKVM_OPENVM_PROGRAM_ELF constant for ELF binaries.
  • crates/l2/prover/src/backend/risc0.rs
    • Implemented execute_with_elf and prove_with_elf methods for Risc0Backend.
  • crates/l2/prover/src/backend/sp1.rs
    • Implemented execute_with_elf and prove_with_elf methods for Sp1Backend.
    • Added ELF key caching mechanism to avoid redundant client.setup(elf) calls.
  • crates/l2/prover/src/backend/zisk.rs
    • Updated serialize_input to use the new serialize_raw method.
  • crates/l2/prover/src/config.rs
    • Added programs_config_path to ProverConfig for dynamic program loading.
  • crates/l2/prover/src/lib.rs
    • Added new modules for programs_config and registry.
  • crates/l2/prover/src/programs_config.rs
    • Added a new file defining ProgramsConfig for loading guest program settings from TOML files.
  • crates/l2/prover/src/prover.rs
    • Refactored start_prover to initialize and use GuestProgramRegistry.
    • Implemented prove_batch with dual-path logic for registry-based or legacy proving.
    • Updated request_new_input and submit_proof to handle program_id and supported_programs.
  • crates/l2/prover/src/registry.rs
    • Added a new file implementing GuestProgramRegistry for managing GuestProgram instances.
  • crates/l2/prover/tests/zkvm_integration.rs
    • Added a new file for zkVM integration tests, including checks for SP1 and RISC0 ELF availability for various guest programs.
  • crates/l2/sequencer/l1_committer.rs
    • Updated COMMIT_FUNCTION_SIGNATUREs to include uint8 for programTypeId and bytes32 for publicValuesHash.
    • Added logic to resolve program_type_id from storage and include public_values_hash in calldata.
  • crates/l2/sequencer/l1_proof_sender.rs
    • Updated VERIFY_FUNCTION_SIGNATURE and calldata to include customPublicValues.
  • crates/l2/sequencer/proof_coordinator.rs
    • Updated handle_request to process supported_programs from provers and filter batches accordingly.
    • Updated handle_submit to store the program_id along with the proof.
  • crates/l2/storage/src/api.rs
    • Added store_program_id_by_batch and get_program_id_by_batch methods to the StoreEngineRollup trait.
  • crates/l2/storage/src/store.rs
    • Implemented store_program_id_by_batch and get_program_id_by_batch for the Store struct.
  • crates/l2/storage/src/store_db/in_memory.rs
    • Added program_id_by_batch field to StoreInner and implemented corresponding trait methods.
  • crates/l2/storage/src/store_db/sql.rs
    • Updated DB_SCHEMA to include the batch_program_id table.
    • Implemented store_program_id_by_batch and get_program_id_by_batch using SQL operations.
  • crates/l2/tee/quote-gen/src/sender.rs
    • Updated BatchRequest to include supported_programs for compatibility.
  • platform/client/.env.local.example
    • Added new example environment variables for API server URL and OAuth client IDs.
  • platform/client/.gitignore
    • Added new gitignore entries for Next.js build artifacts and environment files.
  • platform/client/app/admin/page.tsx
    • Added a new page for the admin dashboard, displaying platform statistics and program management.
  • platform/client/app/admin/programs/[id]/page.tsx
    • Added a new page for detailed admin view of a program, including creator info and approval/rejection actions.
  • platform/client/app/admin/users/page.tsx
    • Added a new page for admin user management, allowing role changes and suspension/activation.
  • platform/client/app/auth/callback/kakao/page.tsx
    • Added a new page to handle Kakao OAuth callback and login.
  • platform/client/app/auth/callback/naver/page.tsx
    • Added a new page to handle Naver OAuth callback and login.
  • platform/client/app/creator/[id]/page.tsx
    • Added a new page for creators to view and edit their program details, including ELF and VK uploads.
  • platform/client/app/creator/new/page.tsx
    • Added a new page for creators to register new guest programs.
  • platform/client/app/creator/page.tsx
    • Added a new page for creators to list and manage their own guest programs.
  • platform/client/app/deployments/[id]/page.tsx
    • Added a new page for detailed deployment management, including configuration editing and TOML export.
  • platform/client/app/deployments/page.tsx
    • Added a new page to list user's deployments.
  • platform/client/app/globals.css
    • Added a new global CSS file for Tailwind CSS imports.
  • platform/client/app/layout.tsx
    • Added a new root layout file for the Next.js application, including providers and navigation.
  • platform/client/app/login/page.tsx
    • Added a new login page with email/password and social login options.
  • platform/client/app/page.tsx
    • Added a new home page for the Guest Program Store, featuring program listings and architecture overview.
  • platform/client/app/profile/page.tsx
    • Added a new profile page for users to manage their account and view program/deployment summaries.
  • platform/client/app/signup/page.tsx
    • Added a new signup page with email/password and social signup options.
  • platform/client/app/store/[id]/page.tsx
    • Added a new page for detailed program view in the store, including a 'Use This Program' modal.
  • platform/client/app/store/page.tsx
    • Added a new page for browsing the Guest Program Store with search and category filters.
  • platform/client/components/auth-provider.tsx
    • Added a new React context provider for authentication state management.
  • platform/client/components/nav.tsx
    • Added a new navigation component with dynamic links based on user authentication and role.
  • platform/client/components/providers.tsx
    • Added a new component to wrap the application with necessary context providers.
  • platform/client/components/social-login-buttons.tsx
    • Added new components for Google, Naver, and Kakao social login buttons.
  • platform/client/lib/api.ts
    • Added a new API client library for interacting with the platform backend.
  • platform/client/lib/types.ts
    • Added new TypeScript type definitions for User, Program, and Deployment entities.
  • platform/client/next-env.d.ts
    • Added a new Next.js environment declaration file.
  • platform/client/next.config.ts
    • Added a new Next.js configuration file.
  • platform/client/package-lock.json
    • Added a new package-lock.json file for client dependencies.
  • platform/client/package.json
    • Added a new package.json file for client dependencies.
  • platform/client/postcss.config.mjs
    • Added a new PostCSS configuration file for Tailwind CSS.
  • platform/client/tsconfig.json
    • Added a new TypeScript configuration file for the client.
  • platform/server/.env.example
    • Added a new example environment file for server configuration.
  • platform/server/.gitignore
    • Added new gitignore entries for server-side artifacts.
  • platform/server/db/db.js
    • Added a new database utility file for SQLite connection and migrations.
  • platform/server/db/deployments.js
    • Added a new database module for managing deployments.
  • platform/server/db/programs.js
    • Added a new database module for managing guest programs.
  • platform/server/db/schema.sql
    • Added a new SQL schema file for the platform database.
  • platform/server/db/sessions.js
    • Added a new database module for managing user sessions.
  • platform/server/db/users.js
    • Added a new database module for managing users.
  • platform/server/lib/google-auth.js
    • Added a new utility file for Google OAuth authentication.
  • platform/server/lib/kakao-auth.js
    • Added a new utility file for Kakao OAuth authentication.
  • platform/server/lib/naver-auth.js
    • Added a new utility file for Naver OAuth authentication.
  • platform/server/lib/validate.js
    • Added a new utility file for input validation helpers.
  • platform/server/middleware/auth.js
    • Added a new middleware file for authentication and authorization.
  • platform/server/package-lock.json
    • Added a new package-lock.json file for server dependencies.
  • platform/server/package.json
    • Added a new package.json file for server dependencies.
  • platform/server/routes/admin.js
    • Added a new Express router for admin-specific API endpoints.
  • platform/server/routes/auth.js
    • Added a new Express router for authentication API endpoints.
  • platform/server/routes/deployments.js
    • Added a new Express router for deployment management API endpoints.
  • platform/server/routes/programs.js
    • Added a new Express router for program management API endpoints, including file uploads.
  • platform/server/routes/store.js
    • Added a new Express router for public Guest Program Store API endpoints.
  • platform/server/server.js
    • Added a new Express server entry point with middleware, routes, and health checks.
  • scripts/new-guest-program.sh
    • Added a new scaffold script for generating new guest program modules.
  • tokamak-notes/guest-program-modularization/00-overview.md
    • Added a new document providing an overview of guest program modularization.
  • tokamak-notes/guest-program-modularization/01-current-architecture.md
    • Added a new document analyzing the current architecture and identifying coupling points.
  • tokamak-notes/guest-program-modularization/02-target-architecture.md
    • Added a new document designing the target architecture for modular guest programs.
  • tokamak-notes/guest-program-modularization/03-implementation-phases.md
    • Added a new document detailing the implementation phases for modularization.
  • tokamak-notes/guest-program-modularization/04-risk-analysis.md
    • Added a new document analyzing risks and mitigation strategies for the modularization project.
  • tokamak-notes/guest-program-modularization/05-improvements-proposal.md
    • Added a new document proposing improvements and refinements to the modularization design.
  • tokamak-notes/guest-program-modularization/06-app-specific-templates.md
    • Added a new document outlining app-specific guest program templates for ZK-DEX and Tokamon.
  • tokamak-notes/guest-program-modularization/07-multi-role-platform.md
    • Added a new document detailing the multi-role platform architecture for the Guest Program Store.
  • tokamak-notes/guest-program-modularization/08-developer-guide-ko.md
    • Added a new Korean developer guide for creating guest programs.
  • tokamak-notes/guest-program-modularization/08-developer-guide.md
    • Added a new English developer guide for creating guest programs.
Activity
  • The pull request is the first in a series of four, indicating a foundational set of changes.
  • The test plan includes completed integration tests for registry functionality with ZK-DEX and Tokamon, prove_with_elf for the exec backend, proof data protocol backward compatibility, and ELF header validation with fuzz-style robustness tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Zena-park Zena-park changed the title feat(zk): Guest Program Modularization Core feat(l2): guest program modularization core Mar 1, 2026
…ock.commitBatch

The IOnChainProposer.commitBatch interface expects 11 parameters but
Timelock.commitBatch was only passing 9, missing programTypeId and
publicValuesHash. This caused the Solidity compilation to fail.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is a massive and impressive pull request that introduces a foundational change to modularize guest programs. The core of the change is the GuestProgram trait, which successfully abstracts away the specifics of each program, and the corresponding refactoring of the ProverBackend to be guest-agnostic. The introduction of a 3D verification key mapping in the L1 contracts to support multiple program types is well-thought-out, and the backward compatibility considerations using #[serde(default)] and default program IDs are excellent.

The addition of the full-stack "Guest Program Store" platform is a significant feature that greatly enhances the developer experience. The code is well-structured, and the inclusion of extensive tests, including backward compatibility and fuzz-style robustness tests, is commendable.

My review includes a few suggestions to improve maintainability in the build script, enhance on-chain error reporting for better debuggability, and improve the portability of the new scaffolding script. Overall, this is a high-quality contribution that sets a strong foundation for future expansion.

…d clippy lints

- Add missing programTypeId and publicValuesHash params to ITimelock.commitBatch
- Update all Cargo.lock files (sp1, risc0, zisk, openvm, tee, tooling, sp1-zk-dex, sp1-tokamon)
- Add clippy allow attributes for test modules in exec.rs, programs_config.rs, registry.rs
Add @Custom:oz-upgrades-unsafe-allow state-variable-type-change to both
OnChainProposer contracts. The verificationKeys mapping was intentionally
changed from 2D to 3D to support programTypeId, and this is a fresh
deployment on tokamak-dev (not an in-place upgrade from main).
…rade

Replace the invalid @Custom:oz-upgrades-unsafe-allow state-variable-type-change
annotation with @Custom:oz-retyped-from, which is the correct OpenZeppelin
annotation for intentional storage variable type changes. This tells the
upgradeability checker that the mapping change from 2D to 3D was intentional.
- Add clippy allow for expect/unwrap in zkvm_integration test modules
- Collapse nested if-let patterns in prover.rs (collapsible_if)
- Add missing programs_config_path field in ProverConfig construction
When GUEST_PROGRAMS doesn't include zk-dex or tokamon, the build.rs
now creates empty placeholder ELF files so that include_bytes! in
lib.rs doesn't fail during cargo check in CI.
…al impl

Clippy's `derivable_impls` lint flags the manual `Default` implementation
since all fields are `Option` types that default to `None`.  Use derive
instead.
The Lint L2 CI job runs clippy with `-D clippy::panic` and
`-D clippy::expect_used` even on test code.  Add the standard
`#[allow(...)]` block to the test module.
After initialize(), the OnChainProposer owner is set to the Timelock
contract via __Ownable_init(). The deployer's subsequent call to
setGuestProgramRegistry() reverted because the deployer is not the
owner. Fix by accepting guestProgramRegistry as a parameter in
initialize() and setting it before ownership transfer.

- Add guestProgramRegistry parameter to initialize() in both
  based and non-based OnChainProposer contracts
- Update deployer.rs to pass registry address in initialize calldata
- Remove separate setGuestProgramRegistry() call from deployer
- Remove unused SET_GUEST_PROGRAM_REGISTRY_SIGNATURE constant
Remove the uniswap-swap job and its references from the all-tests
aggregator. This test is not relevant to the Tokamak L2 and adds
unnecessary CI time.
@Zena-park Zena-park changed the base branch from tokamak-dev to feat/app-customized-framework March 2, 2026 23:29
@Zena-park Zena-park removed the request for review from jason-h23 March 2, 2026 23:32
@Zena-park Zena-park merged commit c953873 into feat/app-customized-framework Mar 2, 2026
62 checks passed
Zena-park added a commit that referenced this pull request Mar 16, 2026
…ntainability

- CORS: restrict origin to Tauri dev/prod allowlist (Copilot #1)
- open-url: use execFile with arg arrays instead of shell exec (Copilot #2)
- fs browse: restrict path traversal to home directory (Copilot #3)
- test-e2e-fork: move RPC URL to SEPOLIA_RPC_URL env var (Copilot #4)
- docker-remote: clear timeout on stream close, close stream on timeout (Copilot #5)
- docker-remote: add shell quoting (q()) and assertSafeName for all
  interpolated shell args to prevent injection (Copilot #6-8)
- genesis.rs: add ChainConfig::validate() for pre-startup checks (Copilot #9)
- listings.js: use named params (@id, @name, ...) instead of 30
  positional ? args for upsertListing (Gemini #1)
Zena-park added a commit that referenced this pull request Mar 17, 2026
- Return 503 instead of {exists:false} on check endpoint errors (#1)
- Sanitize all error messages — log internally, return generic to client (#2,#3,#4,#5)
- Add serverless rate limit limitation comment (#6)
- Add console.warn to all empty catch blocks in github-pr.ts (#9,#10,#11)
- Note: params as Promise is correct for Next.js 15 (#7,#8)
Zena-park added a commit that referenced this pull request Mar 17, 2026
* feat(platform): add appchain registry API routes to Next.js client

Port Express server appchain-registry endpoints to Next.js API routes
for Vercel deployment:
- GET /api/appchain-registry/check/[l1ChainId]/[stackType]/[identityAddress]
- POST /api/appchain-registry/submit
- GET /api/appchain-registry/status/[prNumber]

Shared logic in lib/appchain-registry.ts and lib/github-pr.ts.

* fix: address PR #67 code review feedback

- Return 503 instead of {exists:false} on check endpoint errors (#1)
- Sanitize all error messages — log internally, return generic to client (#2,#3,#4,#5)
- Add serverless rate limit limitation comment (#6)
- Add console.warn to all empty catch blocks in github-pr.ts (#9,#10,#11)
- Note: params as Promise is correct for Next.js 15 (#7,#8)

* fix: address additional Copilot PR #67 review feedback

- Add AbortSignal.timeout(15s) to all GitHub API fetch calls
- Fix authHeaders error message to list both accepted env vars
- Distinguish RPC errors (502) from permission denied (403) in ownership check
- Add typeof validation for metadata.signedBy
- Add unit test suggestion acknowledged (future work)
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.

1 participant