YUL and EVM assembly recompiler to LLVM, targetting RISC-V on PolkaVM.
Visit contracts.polkadot.io to learn more about contracts on Polkadot!
This is experimental software in active development and not ready just yet for production usage. Please do report any compiler related issues or missing features that are not yet known to us here.
Discussion around the development is hosted on the Polkadot Forum.
resolc
depends on the solc binary installed on your system.
Building from source requires a compatible LLVM build.
revive
requires a build of LLVM 18.1.4 or later with the RISC-V embedded target, including compiler-rt
. Use the provided build-llvm.sh build script to compile a compatible LLVM build locally in $PWD/llvm18.0
(don't forget to add that to $PATH
afterwards).
To install the resolc
Solidity frontend executable:
bash build-llvm.sh
export PATH=${PWD}/llvm18.0/bin:$PATH
make install-bin
resolc --version
Cross-compiles the Revive compiler to WASM for running it in a Node.js or browser environment.
Install emscripten. Tested on version 3.1.64. To build resolc.js execute:
bash build-llvm.sh
export PATH=${PWD}/llvm18.0/bin:$PATH
export EMSDK_ROOT=<PATH_TO_EMSCRIPTEN_SDK>
bash emscripten-build-llvm.sh
source $EMSDK_ROOT/emsdk_env.sh
export LLVM_LINK_PREFIX=${PWD}/llvm18.0-emscripten
export PATH=$PATH:$PWD/llvm18.0-emscripten/bin/
make install-wasm
Please consult the Makefile targets to learn how to run tests and benchmarks.
Ensure that your branch passes make test
locally when submitting a pull request.
revive
uses solc, the Ethereum Solidity compiler, as the Solidity frontend to process smart contracts written in Solidity. The YUL IR code (or legacy EVM assembly as a fallback for older solc
versions) emitted by solc
is then translated to LLVM IR, targetting Polkadots revive
pallet.
Frontend and code generator are based of ZKSync zksolc
.
Before running the tests, ensure that Geth (Go Ethereum) is installed on your system. Follow the installation guide here: Installing Geth. Once Geth is installed, you can run the tests using the following command:
make test