You can contribute to Warp by raising issues and PRs. Simply filing issues for problems you encounter is a great way to contribute. Contributing implementations is greatly appreciated.
Please do:
- DO give priority to the current style of the project or file you're changing even if it diverges from the general guidelines.
- DO include tests for both, new features and bug fixes
- DO keep the discussions focused on the initial topic
Please do not:
- DON'T raise PRs with style changes
- DON'T surprise us with big pull requests. It's better to first raise it as an issue and have it discussed
- DON'T commit code that you didn't author. This may breach IP
- DON'T submit PRs that alter licensing, contributing guide lines or code of conduct
First, please make sure you have all the required external dependencies installed.
Then, with a Python3.9 virtual environment activated, perform the following instructions:
-
Clone this repo and change directory into the
warp
folder. -
Install the JavaScript dependencies:
yarn
- Install the Python dependencies:
pip install -r requirements.txt
If you are using a M1 chipped Mac and getting a 'gmp.h' file not found
error when installing Cairo run the following:
CFLAGS=-I`brew --prefix gmp`/include LDFLAGS=-L`brew --prefix gmp`/lib pip install ecdsa fastecdsa sympy
Then run the pip command above again.
- Compile the project:
yarn build
- Compile Warp libraries
yarn warplib
- Test the installation worked by transpiling an example ERC20 contract:
bin/warp transpile exampleContracts/ERC20.sol
To look what features we are currently working on or tasks that are pending to do, please checkout the project on github.
It can be tedious to manually recompile the project after every minor change. You can automate the process of recompiling by executing the following command in a separate terminal:
yarn dev
Alternatively to yarn dev
you can run typescript in interpreted mode to achieve the same. This is an example using transpile
command:
npx ts-node src transpile example_contracts/ERC20.sol
Warp includes three sets of tests:
-
Compilation Tests: These tests ensure that transpiled contracts are valid Cairo code.
-
Behaviour Tests: These tests verify the correct functionality of transpiled contracts.
-
Semantic Tests: These tests involve transpiling Solidity's semantic tests and checking that the runtime behaviour remains consistent.
Start by running the compilation tests to verify that your contribution doesn't break any fundamental features. These tests are also the quickest to execute.
yarn test:examples
Behaviour tests involve transpiling a set of Solidity contracts and deploying them to a testnet. Each deployed contract undergoes testing for all of its runtime functionality.
- Run the setup script (Required only once):
tests/behaviour/setup.sh
- In a separate terminal, start a StarkNet testnet server (make sure cairo-lang is installed in the environment):
yarn testnet
- Run the tests:
yarn test
To generate benchmarks locally during development:
yarn testnet:benchmark
yarn test
python starknet-testnet/generateMarkdown.py
This saves the benchmarks at benchmark/stats/data.md
Semantic tests involve transpiling each of Solidity's behaviour tests and deploying them. Each test is executed, and its result is compared to the output of its Solidity counterpart.
Execute instructions 1 and 2 from Behaviour Tests if you haven't already. Then:
- Run semantic tests:
yarn test:semantic
The project uses GitHub Actions to build its artifacts and run tests. We do our best to keep the suite fast and stable. For incoming PRs, builds and test runs must be clean.