Convert old Solidity source mappings to the Ethdebug format.
pip install -e .ethdebug-converter <solc-json-file> -o <output-file>Example:
ethdebug-converter examples/Counter/0.8.0/output.json -o Counter_ethdebug.json-o, --output: Output file path (default: stdout)-c, --contract: Specific contract name to convert (default: first found)--runtime: Convert runtime bytecode instead of deployment bytecode--format: Output format -jsonorpretty(default: pretty)--validate: Validate output with ethdebug-stats after conversion (runsethdebug-statson the generated file)
The tool expects Solidity compiler output in combined JSON format generated with:
solc --combined-json abi,bin,srcmap,srcmap-runtime Contract.sol > output.jsonGenerates Ethdebug format JSON files compatible with ethdebug-stats analyzer.
The examples/ directory contains pre-generated Solidity compiler outputs for different versions. Here's how these files were generated:
First, you need to install solc-select to easily switch between Solidity compiler versions:
pip install solc-select- Install the desired Solidity version:
solc-select install 0.7.0- Switch to that version:
solc-select use 0.7.0- Generate the combined JSON output:
solc --combined-json abi,bin,srcmap,srcmap-runtime TaxCalculator.sol > TaxCalculator_0.7.0.jsonexamples/
├── Counter/
│ ├── Counter.sol # Source contract
│ ├── 0.5.0/
│ │ └── output.json # Compiler output for Solidity 0.5.0
│ ├── 0.6.0/
│ │ └── output.json # Compiler output for Solidity 0.6.0
│ ├── 0.7.0/
│ │ └── output.json # Compiler output for Solidity 0.7.0
│ ├── 0.8.0/
│ │ └── output.json # Compiler output for Solidity 0.8.0
│ └── 0.8.30/
│ └── output.json # Compiler output for Solidity 0.8.30
└── TaxCalculator/
├── TaxCalculator.sol # Source contract
├── 0.7.0/
│ └── output.json
├── 0.8.0/
│ └── output.json
└── 0.8.30/
└── output.json
To convert any of the example files to Ethdebug format:
# Convert Counter compiled with Solidity 0.8.0
ethdebug-converter examples/Counter/0.8.0/output.json -o Counter_0.8.0_ethdebug.json
# Convert TaxCalculator runtime bytecode
ethdebug-converter examples/TaxCalculator/0.7.0/output.json --runtime -o TaxCalculator_0.7.0_runtime_ethdebug.json
# Validate the output with ethdebug-stats
ethdebug-stats Counter_0.8.0_ethdebug.json --format text