Skip to content

CLI: Add preprocessing flags and program analysis integration #9

@Mikerah

Description

@Mikerah

Overview

Add preprocessing configuration flags to the Stoffel CLI and integrate with automatic program analysis.

Tasks

Step 1: Default Behavior (Program-Aware)

  • When stoffel dev compiles a program, analyze bytecode automatically
  • Display calculated preprocessing values in output
  • Use calculated values by default for MPC execution

Step 2: Override Flags

  • Add --preprocessing flag for presets (minimal/standard/production)
  • Add --beaver-triples flag for explicit triple count
  • Add --random-shares flag for explicit share count
  • Override flags take precedence over automatic analysis

Step 3: Configuration Persistence

  • Extend MpcConfig struct with optional preprocessing section
  • Update Stoffel.toml schema to include [mpc.preprocessing]
  • CLI flags override config file, config file overrides automatic analysis

Step 4: Template Updates

  • Update stoffel init templates to NOT specify explicit preprocessing
  • Add comments explaining automatic behavior
  • Show how to override if needed

Files to Modify

  • src/main.rs (CLI flags, program analysis integration)
  • src/init.rs (config struct, templates)
  • src/templates/rust/main.rs (remove hardcoded values)
  • src/templates/stoffel.toml.template (add preprocessing section)

New CLI Syntax

# Automatic (default)
stoffel dev  # Analyzes program, calculates preprocessing

# Using presets
stoffel dev --preprocessing=minimal
stoffel dev --preprocessing=standard
stoffel dev --preprocessing=production

# Explicit values
stoffel dev --beaver-triples=64 --random-shares=130

Testing

  • Test automatic analysis output display
  • Test preset override
  • Test explicit flag override
  • Test config file loading

Reference

  • RFC-0001
  • Depends on: STO-377 (SDK bytecode analysis)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions