๐งช solx vs solc โ Community Benchmark Suite
This repo allows developers to submit their own smart contracts to benchmark and compare how solx performs against solc in terms of output, performance, and compatibility.
๐ Purpose
We want real-world usage data. By submitting your own contracts (or forks of existing ones), you help us:
- Evaluate solx's compatibility with various existing contracts
- Benchmark solx vs solc compilation output
- Identify edge cases or gaps
๐ Requirements
- Foundry for running the tests
- Node.js (v14 or later) for building the dashboard
- Git for cloning and contributing
๐งฐ Project Template
We provide a Foundry template in /template-foundry-project that includes:
- Basic Foundry configuration with both
solxandsolccompiler targets - A test suite scaffold
- Integration with the comparison script
๐ How to Contribute
-
Fork this repository
-
Create your project from the template:
# Replace 'my-contracts' with your project name (e.g., erc20, nft-marketplace, etc.) cp -r ./template-foundry-project my-contracts/ -
Add your contracts and tests:
- Place contracts in
my-contracts/src/ - Add tests in
my-contracts/test/ - Update
foundry.tomlif needed
- Place contracts in
-
Setup solx compiler:
- Download the latest version from the releases page
- Create and place it in the
./binaries-solxfolder:mv path/to/downloaded/solx-macosx-v0.1.0-alpha.3 binaries-solx/ chmod +x binaries-solx/solx-macosx-v0.1.0-alpha.3 - Update your project's
foundry.tomlto point to the binary:[profile.solx] solc_version = "../binaries-solx/solx-macosx-v0.1.0-alpha.3"
-
Run benchmarks and submit PR:
# Generate gas reports and build dashboard ./compare.sh my-contracts- Create a new branch:
git checkout -b add/my-contracts - Commit your changes
- Push and create a PR
- Fill out the PR template with:
- Contract details and source
- Test coverage information
- Interesting benchmark findings
- Any edge cases or observations
- Create a new branch:
๐ Running Benchmarks
The compare.sh script automates the entire process of generating gas reports and building the visualization dashboard:
./compare.sh my-contractsThis will:
- Read the solc version from your project's
foundry.toml - Extract the solx version from the binary path
- Generate gas reports for both compilers in
reports/my-contracts/:gas-report-solc-{version}.jsongas-report-solx-{version}.json
- Build the interactive dashboard automatically
After the script completes:
- Open
dashboard/index.htmlin your browser - Select your project from the dropdown
- View detailed gas comparisons for:
- Contract deployment costs
- Method-by-method gas usage
- Multiple compiler versions (if available)
The dashboard features:
- Interactive charts showing gas usage comparisons
- Detailed deployment cost analysis
- Method-by-method gas usage breakdown
- Support for multiple compiler versions
- Color-coded visualization (purple for solc, blue for solx)
๐ก Guidelines
- You can add contracts you've written or fork existing open-source ones
- Keep submissions focused on one contract or suite per folder for clarity
- Prefer Solidity 0.8.x for now (matching current Solx compatibility)
- Be descriptive in your PR using the provided template
- Include all relevant compiler settings in your
foundry.toml - Make sure all tests pass with both compilers before submitting
๐ข Got Feedback?
Join the conversation on Telegram if you find bugs, have questions, or want to help build out better tools.