CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-py-solc-x

Python wrapper and version management tool for the solc Solidity compiler.

77

1.05x

Evaluation77%

1.05x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-1/

Solidity Compile Flag Harness

Design and implement a helper that compiles Solidity sources while exposing fine-grained compiler controls for optimization, metadata hashing, revert-string handling, output selection, and optional on-disk emission.

Capabilities

Optimizer control

  • When optimization is enabled with a specific run count (e.g., 350) the compilation uses that optimizer configuration and produces deployed bytecode for the sample contract that differs from the non-optimized output. @test

Metadata and revert strings

  • When metadata hashing is disabled and revert strings are stripped, the produced deployed bytecode omits the metadata hash trailer and contains no revert string literals for the sample contract. @test

Output selection

  • When the output selection requests only ABI, creation bytecode, and deployed bytecode, the returned artifacts include exactly those entries for each contract and no AST/IR extras. @test

Output directory write

  • When an output directory is provided with overwriting allowed, the full standard JSON compilation result is written into that directory (for example, as build/combined.json) and replaces any existing file. @test

Implementation

@generates

API

from pathlib import Path
from typing import Dict, Iterable, Mapping, Optional

def compile_with_flags(
    sources: Mapping[str, str],
    enable_optimization: bool,
    optimizer_runs: int,
    metadata_hash_mode: str,
    revert_string_mode: str,
    output_selection: Iterable[str],
    output_directory: Optional[Path],
    overwrite: bool = False,
) -> Dict:
    """
    Compile the provided Solidity sources with the given compiler flag configuration.
    Supports metadata hash modes like 'ipfs', 'bzzr1', or 'none', and revert string modes
    'default', 'strip', or 'debug'.
    Returns the compilation artifacts requested by the output selection.
    """

Dependencies { .dependencies }

py-solc-x { .dependency }

Solidity compiler wrapper used to configure optimizer, metadata, revert-string, output selection, and output directory settings.

Install with Tessl CLI

npx tessl i tessl/pypi-py-solc-x

tile.json